Skip to main content
GameDev.net gamedev.net
🔒 Locked

multiple FBOs bug

Started by BloodLust666 Apr 26, 2010 at 5:06 PM 4 replies 800+ views
Original Post
BloodLust666
BloodLust666
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
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
karwosts
karwosts
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.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
BloodLust666
BloodLust666
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.
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
karwosts
karwosts
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.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
BloodLust666
BloodLust666
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.
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
BloodLust666
BloodLust666
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
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.