Hiiii.. thanks for that reply.. i will go ahead with a single FBO and multiple renders.. hey please check this code bit
int DrawGLScene(GLvoid)
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
glPushAttrib(GL_VIEWPORT_BIT);
glScissor(0, 0, width, height);
glViewport(0,0,width,height);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f,0.0f,-2.0f);
GLfloat vVertices[] = { 0.0f, 0.5f, 0.0f,
-0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f };
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glUseProgram ( programObject ); // to this object i have attached a vertex and fragment shader
glVertexAttribPointer ( 0, 3, GL_FLOAT, GL_FALSE, 0, vVertices );
glEnableVertexAttribArray ( 0 );
glDrawArrays ( GL_TRIANGLES, 0, 3 );
glPopAttrib();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glClearColor(0.0f, 0.0f, 0.2f, 0.5f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glLoadIdentity();
// Now bind the first texture to use it
glBindTexture(GL_TEXTURE_2D, img);
glEnable(GL_TEXTURE_2D);
glTranslatef(-1.2f,0.0f,-2.0f);
glColor4f(1.0f,1.0f,1.0f,1.0f);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-0.5f, -0.5, 0.5);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 0.5, -0.5, 0.5);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 0.5, 0.5, 0.5);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-0.5, 0.5, 0.5);
glEnd();
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
return TRUE;
}
This was an example i saw in the internet with just a FBO and a texture mapped quad rendering.. I tried attaching shaders to it and then tried out.. however this does not somehow seem to work.. It seems so that the fragment shader i used has been applied onto the tex quad( all i see is a rectangle with the color specified by the fragment shader.. Please help..