glutHideWindow and glReadPixels on OS X
On a MAC OS X machine, I am using FBO, depth RBO and texture RBO with freeglut to render a 3D scene to FBO and doing a render to texture. All using standard glut functions and glutMainLoop at the end.
I am using glReadPixels to read from the FBO. I can see that the pixels are being read correctly.
However When I hide the glut window using glutHideWindow, I find that the entire buffer which is retrned by glReadPixels is set开发者_JAVA技巧 to clear color (ff 00 00 00). I don't change anything else. I think that the FBO is not being rendered to at all when the window is hidden. How do I change this? This is being observed on MAC OS X. Please let me know if you want to look at the code.
The window can not be covered, or the buffer will not be updated. The solution is to render to the offscreen buffer (if your card supports it). Otherwise, keep the window above others, otherwise the buffer will be invalid.
EDIT : this has to do with window system, and not with opengl
精彩评论