Results 1 to 3 of 3

Thread: Double Buffer Drawing

  1. #1
    Member Contributor
    Join Date
    Jan 2001
    Location
    Portland, ME., USA
    Posts
    86

    Double Buffer Drawing

    Hi,
    I have a complex scene (terrian + a number of balls rolling around in it). What I would like to do is draw the terrian to the back buffer (doesn't update to often, but it does get updated) and use the front buffer for the movement of the balls. Graphically, drawing the balls isn't that tough, but computing there movement does take some time. This coupled with rendering the entire scene each frame is slow.

    Is this possible with fairly smooth animation?
    lobstah

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2001
    Location
    Holland
    Posts
    179

    Re: Double Buffer Drawing

    Lobstah,

    I don't think the back buffer can be used in such a way easily, because you have to issue a SwapBuffer in order to get the image of the terrain from the back buffer into the front buffer before drawing the balls.
    Unfortunately, swapping buffers usually leaves the back buffer in an undefined state. There are some cards that support extensions to keep the back buffer intact, or swap the image from the front buffer into the back buffer, but that certainly is not universally available.

    An approach that may work is to render the terrain once and then extract that image (including the depth values) (glReadPixels). Then, as long as the camera orientation does not change you start your frame with a glDrawPixels of the previously stored image and then draw the moving stuff.
    Do keep in mind though that glReadPixels tends to be a slow operation.

    Have you considered other optimization techniques, like using display lists for the terrain?

    HTH

    Jean-Marc

  3. #3
    Member Contributor
    Join Date
    Jan 2001
    Location
    Portland, ME., USA
    Posts
    86

    Re: Double Buffer Drawing

    Hi Jean,
    I had a feeling this was the case. I did some reading on auxilary buffers, etc. and came to the same conclusion. I was hoping that there was trick available.

    I am now using display lists and concentrating on optimizing processing throughput.

    Thanks for taking the time to respond.

    Have a great day!

    Lobstah...
    lobstah

Similar Threads

  1. Drawing an incremental off-screen buffer -- seeing double
    By somedave in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 06-11-2016, 03:15 PM
  2. Double vs Float vs Int for drawing
    By Davidthefat in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 08-18-2010, 08:30 AM
  3. Replies: 6
    Last Post: 01-16-2006, 11:27 PM
  4. How to use double buffer
    By Roberto Mendoza in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 11-22-2001, 09:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean