PDA

View Full Version : Render to FBO



shlomip
07-05-2011, 07:28 AM
Hi,I need to render the scene to frame buffer object, in the first step I just render the meshes to FBOs. In the next step I need to render all the FBOs to one FBO.
I did it like this:
1)active the shader.
2)bind all the fbo to the shader
3)DrawQuad
4)unbind and deactive the shader.

when DrawQuad is:


glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glColor3f(1.0f, 1.0f, 1.0f);

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);glVertex2f(-1.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f);glVertex2f(1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f);glVertex2f(1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f);glVertex2f(-1.0f, 1.0f);
glEnd();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);

and the program render the scene to the screen, and not to the FBO.
I think its becouse of "glBegin(GL_QUADS);".
there are another way to render some FBO to one FBO?

thanks.

shlomip
07-05-2011, 09:08 AM
Lol... 2 days i try to solve this problem... the mistake was that before the drawquade call i call another function that render to another fbo... :D

never mind, solved. ;)