I'm using a framebuffer object with a color buffer attachment to do some per-pixel hit testing. I'd like to render it to the screen for debugging and testing but right now all I'm getting is a big white nothingness. I assume I have to send some render command similar to glSwapBuffers(), but as I'm only using one buffer I don't know what it would be swapping to. Is there an equivalent command for using just one buffer?
Here's my setup:
// Store the real framebuffer
glGetIntegerv(GL_FRAMEBUFFER_BINDING_OES, (GLint*) ®ularFbo);
// Generate an offscreen framebuffer/renderbuffer for rendering the hit detection polys
// Create framebuffer
glGenFramebuffersOES(1, &hitDetectionFbo);
glBindFramebufferOES(GL_FRAMEBUFFER_OES, hitDetectionFbo);
// Create colorbuffer
glGenRenderbuffersOES(1, &colorBuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, colorBuffer);
// Create storage (RGBA) for color buffer
glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_RGBA8_OES, SCREEN_WIDTH, SCREEN_HEIGHT);
// Attach color buffer to framebuffer
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, colorBuffer);
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
This doesn't flag any glErrors but I'm clearly missing something, as nothing is appearing on screen after I switch over to my new FBO. The program will render just fine if I continue to use the original framebuffer (through a glBindFramebufferOES(GL_FRAMEBUFFER_OES, regularFbo)
call).
Thanks for the help, -S