Sign in to follow this  
BloodLust666

multiple FBOs bug

Recommended Posts

I'm not sure what's going on but I have one FBO rendering a scene to a texture, then taking that texture, texturing a quad and rendering that to another texture, then taking that texture and rendering it finally to the screen. It seems, though, that at the beginning of my simulation the window flashes once on what objects are to be rendering but then goes black... It may have to do with ordering on rendering, but I didn't think it did. The only time I'm clearing the texture is right before having to render to it again, so I don't understand why my screen would be black

Share this post


Link to post
Share on other sites
I think we're going to need to see some code to help you out, what you described sounds feasible enough.

This is probably more appropriate for the opengl forum anyway, as this sounds pretty API specific.

Share this post


Link to post
Share on other sites
oh oops, sorry, can this can be moved to openGL please :) thanks

There's a lot of actual code though and a lot of OO-ness... Maybe pseudo code could work?


foreach RenderTarget
bindTarget
foreach Camera rendering to this target
SetViewport
glClear
RenderScene
foreach Object
foreach Material attached to object
bindTexture
render VBO
glDrawBuffers



That's essentially how I have my engine structure.

Share this post


Link to post
Share on other sites
Quote:

Maybe pseudo code could work?


Not promising that I myself can help you, but I'm going to guess that this isn't going to be enough. 90% of these issues come down to an incorrect API call, so I think you're going to at least need to get some real code down on the screen.

Share this post


Link to post
Share on other sites

foreach RenderTarget
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_bufferID); // m_bufferID is 0 if window
foreach Camera rendering to this target
glViewport(m_viewport.left, m_viewport.top, m_viewport.width, m_viewport.height);
glScissor(m_viewport.left, m_viewport.top, m_viewport.width, m_viewport.height);
glClearColor(m_clearColor.x, m_clearColor.y, m_clearColor.z, m_clearColor.w);
glClearDepth(1.0f);
glClearStencil(0);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
RenderScene
foreach Object
foreach Material attached to object
glBindTexture(GL_TEXTURE_2D, m_id); // some of these could be render targets
render VBO
glDrawBuffers( m_bufferList.size(), &m_bufferList[0]);



I'm about 99% certain my FBOs are set up correctly because when I use only 2 rendertargets (the window, and a render texture) everything looks fine. The scene is rendered to the texture, then the texture is rendered to the screen just fine. As soon as I re-direct that texture to render to another texture, and then how THAT second texture render to the screen is when nothing shows up except for the first frame.

Share this post


Link to post
Share on other sites
ummmm, so I definitely have this working now... NO idea why it didn't work before. All I simply did was create a VERY simple shader that basically just passed the same data along and now it works perfectly. Any idea why this is the case? Or should I just conclude that the fixed pipeline sucks. heh :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this