I am a 2nd year Ph.D. student studying VISUAL PERCEPTION at Deakin
University, Melbourne, Australia. I am investigating via a series of
computer based and applied experiments how people learn to judge
time-to-contact with approaching objects, for example, how do people
learn to time a successful catch of an approaching tennis ball.
Over the last year i have taught myself (there is no one at Deakin
University familiar with OpenGL) how to program in C and create the
stimuli for my experiments using the OpenGL API. I have written a simple
program that displays a sphere which translates along the z-axis towards
the observer (camera) for x amount of frames. Each frame is synchronized
to the vertical refresh using #export GL_SYNC_TO_VBLANK=1.
My problem is this. The experiments that I am running are extremely time
critical. I need to time exactly how long the sphere is translating for,
so that I can calculate its velocity and calculate exactly when the
sphere would “collide” with the observer.
I have been told by users of other graphics APIs and OS’s that the best
way to get accurate timing is to use vertical retrace. That is, time the
animation of objects by counting the number of vertical retraces, such
that in my sphere example, if vertical retrace is at 60 Hz and i wanted
the ball to translate for ONE SECOND i would write code for the
translation to occur for 60 frames/retraces.
Would anyone have any code or information that they could share with me
about how to determine what the actual operating refresh rate is when my
program is running, specifying a particular frame
rate?(glxSwapIntervalSGI() does not appear to be supported), and/or how
to time the translation of the sphere so that it is synchronized with
VBLANK and will swap buffers for X amount of retraces?
I am using a SGI230 workstation (intel processor), RedhatLinux6.2, and
nvidia’s Geforce 256 DDR. None of the OpenGL extensions [e.g.,
glXWaitVideoSyncSGI(); GLX_SGI_swap_control] that may have been able to
address this issue appear to be supported.
any replies would be greatly appreciated as i’m really stuck on this
PS: sorry about my naive description of vertical retrace issues, i’m
really a novice at this stuff.