Sign in to follow this  
Alessandro

Reading color pixel information from FBO

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:

[code]
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);
[/code]

The pixel_rgb just contains null data.

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this