KrisLibrary  1.0.0
GLRenderToImage.h
1 #ifndef GL_RENDER_IMAGE_H
2 #define GL_RENDER_IMAGE_H
3 
4 #include <KrisLibrary/camera/viewport.h>
5 #include <KrisLibrary/image/image.h>
6 #include <vector>
7 
8 namespace GLDraw {
9 
29 {
30 public:
32  ~GLRenderToImage();
33 
35  bool Setup(int w,int h);
37  void Begin(const Camera::Viewport& vp);
39  void Begin();
41  void End();
42 
44  void GetRGBA(std::vector<unsigned int>& image);
46  void GetRGBA(std::vector<unsigned char>& image);
48  void GetRGBA(std::vector<std::vector<unsigned int> >& image);
50  void GetRGBA(Image& image);
52  void GetRGB(std::vector<unsigned char>& image);
54  void GetRGB(Image& image);
55 
57  void GetDepth(const Camera::Viewport& vp,std::vector<float>& image);
59  void GetDepth(const Camera::Viewport& vp,std::vector<std::vector<float> >& image);
61  void GetDepth(const Camera::Viewport& vp,Image& image);
62 
64  void GetZBuffer(std::vector<float>& image);
65 
66  int width,height;
67  unsigned int color_tex,fb,depth_rb;
68 };
69 
70 }
71 
72 #endif //GL_RENDER_IMAGE_H
Allows for GL calls to draw to an image.
Definition: GLRenderToImage.h:28
void GetRGBA(std::vector< unsigned int > &image)
scan line order, top left to bottom right
Definition: GLRenderToImage.cpp:189
void GetDepth(const Camera::Viewport &vp, std::vector< float > &image)
scan line order, top left to bottom right
Definition: GLRenderToImage.cpp:333
void Begin()
Call Begin before rendering.
Definition: GLRenderToImage.cpp:166
A class containing viewport / camera information. This uses OpenGL coordinate convention in which x i...
Definition: viewport.h:11
Contains all definitions in the GLDraw package.
Definition: AnyGeometry.h:14
bool Setup(int w, int h)
Call this first to see if render to image is supported.
Definition: GLRenderToImage.cpp:51
void End()
Call End after rendering.
Definition: GLRenderToImage.cpp:179
Definition: image.h:6
void GetRGB(std::vector< unsigned char > &image)
pixels in scan line order in RGB format, top left to bottom right
Definition: GLRenderToImage.cpp:259
void GetZBuffer(std::vector< float > &image)
this is the raw value in the z buffer
Definition: GLRenderToImage.cpp:300