vivendi
01-21-2012, 01:39 PM
I'm trying to render a teapot to a Frame Buffer, but all i see is the clear color, i don't see a teapot. I also checked the glGetError and glCheckFramebufferStatus(EXT), but they are all good. Anyone any idea what the problem could be??
This is my render function:
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); // Bind our frame buffer for rendering
glPushAttrib(GL_VIEWPORT_BIT | GL_ENABLE_BIT); // Push our glEnable and glViewport states
glViewport(0, 0, window_width, window_height); // Set the size of the frame buffer view port
glClearColor (0.0f, 1.0f, 0.0f, 1.0f); // Set
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the depth and colour buffers
glLoadIdentity(); // Reset the modelview matrix
glTranslatef(0.0f, 0.0f, -5.0f); // Translate back 5 units
glRotatef(rotation_degree, 1.0f, 1.0f, 0.0f); // Rotate according to our rotation_degree value
// TEAPOT
glFrontFace(GL_CW);
glutSolidTeapot(1.0f); // Render a teapot
glFrontFace(GL_CCW);
// Then i'm reading all the pixels and pass that to another program
// which renders the result. But no teapot :-(
glReadPixels(0, 0, 1024, 768, GL_RGB, GL_UNSIGNED_BYTE, pixels);
glPopAttrib(); // Restore our glEnable and glViewport states
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // Unbind our texture
int r = glGetError(); // r = 0 -> OK
int s = glCheckFramebufferStatus(GL_FRAMEBUFFER); s = 36053 = OK
int sx = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); sx = 36053 = OK
[/B]
[/B]
This is my render function:
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); // Bind our frame buffer for rendering
glPushAttrib(GL_VIEWPORT_BIT | GL_ENABLE_BIT); // Push our glEnable and glViewport states
glViewport(0, 0, window_width, window_height); // Set the size of the frame buffer view port
glClearColor (0.0f, 1.0f, 0.0f, 1.0f); // Set
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear the depth and colour buffers
glLoadIdentity(); // Reset the modelview matrix
glTranslatef(0.0f, 0.0f, -5.0f); // Translate back 5 units
glRotatef(rotation_degree, 1.0f, 1.0f, 0.0f); // Rotate according to our rotation_degree value
// TEAPOT
glFrontFace(GL_CW);
glutSolidTeapot(1.0f); // Render a teapot
glFrontFace(GL_CCW);
// Then i'm reading all the pixels and pass that to another program
// which renders the result. But no teapot :-(
glReadPixels(0, 0, 1024, 768, GL_RGB, GL_UNSIGNED_BYTE, pixels);
glPopAttrib(); // Restore our glEnable and glViewport states
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); // Unbind our texture
int r = glGetError(); // r = 0 -> OK
int s = glCheckFramebufferStatus(GL_FRAMEBUFFER); s = 36053 = OK
int sx = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); sx = 36053 = OK
[/B]
[/B]