Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Lock swapbuffers to frame rate

  1. #1
    Newbie Newbie
    Join Date
    Dec 2012

    Lock swapbuffers to frame rate

    I am developing an application for research in which I need extreme precision of frame updates.

    The graphics is very simple - a high resolution checkerboard which inverts every 4 frames. The key thing is that there must be no dropped frames or variation of the update rate. I thought of simply having the two images in double buffered memory and simply issuing the swapbuffers command to flip them but I don't know a way of tying the code execution to the vsync. The same thing could be achieved by translating the pattern horizontally or vertically by one square except that the image would need to be bigger than the screen so that the edges don't move. Is there any simple way to do this fairly simple task with the required precision?

    Any help much appreciated

  2. #2
    See glXSwapIntervalSGI. If you can guarantee to call you swapbuffers faster than 16ms, this will give you a steady 60Hz on a 60Hz monitor.

  3. #3
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Montreal, Canada
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts