My scene is drawn based on the location of several (often several million) vertices (kept in VBO's) and a camera. I can easily tell in my code when my scene has changed and when it hasn't. There are also some odd cases such as the window being resized, but I believe I can easily enumerate and handle those as well.

Can I (in user code or through some OpenGL property) leverage this to increase the performance when the scene is static? Clearly when the scene is changing, all of the math must be done to properly calculate what should be rendered. But when the scene is static, that picture isn't changing each frame.

I've tried implementing something in my code to do this, but the result is a flickering scene (and I'm not entirely sure why). Basically I check to see if anything has changed and if it hasn't I simply return from the display(GLAutoDrawable drawable) function that is invoked by the JOGL FPSAnimator.

I feel like this is probably a common problem that should have a standard solution. However, I haven't been able to find anything so far.


1 Answer 1


You can render the scene to a FBO when it changes, and render the FBO to the screen every frame. It's a little more effort than just enabling a property, but still quite straightforward to implement. This approach also allows you to render something on the background and foreground independent of the scene.

edit: Check this tutorial on using FBOs. You need to do the following initialization steps:

  1. Create and bind a Frame Buffer Object
  2. Create a Renderbuffer Object same size as the screen. Bind it to GL_DEPTH_COMPONENT. Renderbuffers are buffers that you are not using as a texture. In this case you need a Renderbuffer for depth buffer.
  3. Create a texture same size as the screen. Specify the format to include alpha channel, if you want to render something behind the scene also.
  4. Attach both the Renderbuffer object and the texture to the FBO (Attaching images to FBO)

When rendering the scene to the FBO:

  1. Bind the Frame Buffer Object
  2. Render the scene
  3. Bind 0 to restore normal screen rendering

When rendering the FBO to the screen:

  1. Bind the texture attached to the FBO
  2. Render a full-screen quad. Provide texture coordinates for each vertex spanning the whole texture range.

This should be enough for you. If you still need further help, I can try to provide working code sample when I have time.

  • \$\begingroup\$ Sounds like a reasonable solution. That may even be better than what I had intended. I've also got sort of a HUD with statistics that may be changing more often. It sounds like your solution would enable me to update the HUD every frame while still using the FBO for the static scene. I'll give it a try (once I learn a little more about FBO's)! \$\endgroup\$
    – Luke
    Mar 16, 2012 at 14:30
  • \$\begingroup\$ Any chance you could provide some rough pseudo code on how to render the scene to a FBO and then draw that FBO on the screen? I'm having a hard time finding examples that are doing exactly what I need. Do I have to connect the FBO to a texture and then render the texture using glTexCoord2f. Or is there a simpler way? \$\endgroup\$
    – Luke
    Mar 16, 2012 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .