• Advertisement
Sign in to follow this  

Reading color pixel information from FBO

This topic is 2200 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I have FBO working just fine (generated texture is bind to a simple test quad and show ok).

However I have troubles reading the color information of the buffer. Here is how I do it:


glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);
glReadBuffer(GL_COLOR_ATTACHMENT0);
unsigned char *pixels_rgb= new unsigned char[window_width * window_height * 4];
glReadPixels(some_x, some_y, 1, 1, GL_RGBA_INTEGER, GL_UNSIGNED_INT, pixels_rgb);


The pixel_rgb just contains null data.

Share this post


Link to post
Share on other sites
Advertisement
Never mind: I solved it (made an error with the unsigned char assignment). Sorry.

However, there is still something I'd like to ask. Using glReadPixels to get pixel information is very slow. What alternative could be used? Maybe PBO's?

Share this post


Link to post
Share on other sites
Never mind: I solved it (made an error with the unsigned char assignment). Sorry.

However, there is still something I'd like to ask. Using glReadPixels to get pixel information is very slow. What alternative could be used? Maybe PBO's?

Share this post


Link to post
Share on other sites
PBO can help make glReadPixels a async operation. That way, you can hide the latency if you don't need the pixel values *immediatly* after the call to glReadPixels.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement