I want to be able to create a movie/animation of what my program
displays, so I have some code that grabs the frambuffer when I want it.
Like this:
void
Visualization::renderGL(int l,int b,int w,int h,unsigned char* buf=0) {
SbViewportRegion vp(w+l,h+b);
vp.setViewportPixels(l,b,w,h);
SoGLRenderAction myRenderAction(vp);
myRenderAction.apply(root);
if(buf) {
glReadBuffer(GL_BACK);
glReadPixels(l,b,w,h,GL_RGB,GL_UNSIGNED_BYTE,buf);
}
}
But, it seems that no matter what I get back straight 0's in buf. Is
there some magical incantation to get glReadPixels to work with
Inventor, or do I not understand how to use glReadPixels?
Kevin
|