read_pixels.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef IGL_OPENGL_READ_PIXELS_H
  2. #define IGL_OPENGL_READ_PIXELS_H
  3. #include "../igl_inline.h"
  4. #include "gl.h"
  5. #include <Eigen/Core>
  6. namespace igl
  7. {
  8. namespace opengl
  9. {
  10. /// Read full viewport into color, alpha and depth arrays suitable for
  11. /// igl::png::writePNG
  12. ///
  13. /// @param[in] width width of viewport
  14. /// @param[in] height height of viewport
  15. /// @param[out] R width by height list of red values
  16. /// @param[out] G width by height list of green values
  17. /// @param[out] B width by height list of blue values
  18. /// @param[out] A width by height list of alpha values
  19. /// @param[out] D width by height list of depth values
  20. template <typename T>
  21. IGL_INLINE void read_pixels(
  22. const GLuint width,
  23. const GLuint height,
  24. Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & R,
  25. Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & G,
  26. Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & B,
  27. Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & A,
  28. Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & D);
  29. }
  30. }
  31. #ifndef IGL_STATIC_LIBRARY
  32. #include "read_pixels.cpp"
  33. #endif
  34. #endif