PDA

View Full Version : Framebuffer Bind Problem



McLeary
10-06-2011, 10:29 AM
I am having some problems with Framebuffer Objects. Maybe I am missing something. Hope you guys can help me.

I need to render an image to a framebuffer for later use. In order to check if everything is in place, I create an image with the following code



static optix::float4 *pix = new optix::float4[ this->mCamera.mWidth * this->mCamera.mHeight ];
for( int i = 0; i < this->mCamera.mWidth * this->mCamera.mHeight; i++ ) {
if( i < 50000 )
pix[i] = optix::make_float4( 1.0f, 0.0f, 0.0f, 1.0f );
else
pix[i] = optix::make_float4( 1.0f, 1.0f, 0.0f, 1.0f );
}


On my render function, I try to draw the image using glDrawPixels.



glDrawPixels( this->mCamera.mWidth, this->mCamera.mHeight, GL_RGBA, GL_FLOAT, pix );


So far so good, the image is displayed without problems. Now, for some reason, when I create a framebuffer object, the image is not being displayed. I use the following lines in my initialization function to create a framebuffer



GLuint id = 0;
glGenFramebuffersEXT( 1, &amp;id );
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, id );
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );

// Do not work


What is odd is that if I do not bind any framebuffer, it works. I mean that, if I just create the framebuffer with glGenFrameBufferEXT, glDrawPixels works fine.



GLuint id = 0;
glGenFramebuffersEXT( 1, &amp;id );

// This works


Am I missing some configuration step?

Thanks in advance.

McLeary
10-06-2011, 10:56 AM
Ok, looks like I miss a post where this problem was reported

http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&amp;Number=234319

Should I delete this post?