I am trying to do a screen capture and write it to a jpeg file. My understanding is that the framebuffer will contain whats being rendered to the display and using PixelRead should grab whats in the framebuffer. What I am seeing is just a black image rather than whats rendered on the display.
The problem could be elsewhere, but if you want to debug it, just fill your buffer with some color, like white, to
see it it’s actually being overwritten. Also make sure your writing functions are working. Fill it with some known
color to see if it’s actually being written correctly.
As you suggested, I filled my pixelbuffer with another color prior to the glReadPixels call, but still get the same result. Likewise,the writing function seem to be working correctly. I initialized this to a different color which was overwritten by the initialized color in pixelBuffer. So it seems pixelBuffer is not reading the framebuffer for some reason.
My video card does not support GL_ARB_pixel_buffer_objects, which should not matter for glPixelRead right? Or maybe my graphics card does not support openGL also? Guess I will try to find a system which I know supports openGL and run my code on that. Thanks for you suggestions.
Try in a first step to copy to framebuffer to a texture with glCopyTexImage2D and then clear the framebuffer and draw the last texture on a quad. This way you could check if your allocations, arrays, file writing,… are wrong or not.