Results 1 to 2 of 2

Thread: glFlush and glFinish

  1. #1
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    glFlush and glFinish

    glFlush tells gl to execute all commands and returns immediatly. glFinish does the same but waits until all commands are executed.
    Now my question: How is the best way to use these commands. There are two ways i would think of:

    while (active)
    {
    draw objects

    glFlush / glFinish

    other code (input, etc.)

    SwapBuffers
    }

    ---or

    while (active)
    {
    draw objects

    glFlush / glFinish

    SwapBuffers

    other code (input, etc.)
    }

    I would prefer the first one, because while the graficscard still calculates you can do input and other stuff and therefore do it syncron. But does SwapBuffers tell the graphiscard only to swap the buffers and then returns or does it really perform the action itself and so waits until the buffers are swapped? Therefore i am not sure if the second method may be faster.
    I hope you understand my question.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: glFlush and glFinish

    There's a third way, which is the way I suggest you go for: Skip glFlush/glFinish.

    glFinish is usually called inside SwapBuffers anyways. This is because all commands before you swap the buffers must be completed, otherwise you will never know what is draw and what is not.

Similar Threads

  1. glFlush or glFinish with mulithreading?
    By imported_pjcozzi in forum OpenGL: Advanced Coding
    Replies: 18
    Last Post: 06-25-2010, 02:53 PM
  2. glFlush & glFinish
    By g0l3m in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 01-11-2007, 04:12 AM
  3. Synchronisation, threads and glFlush/glFinish
    By Ferenzzy in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 09-28-2005, 11:36 PM
  4. glFlush or glFinish?
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-08-2005, 06:28 AM
  5. glflush/glfinish
    By haust in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 08-24-2000, 04:05 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