PDA

View Full Version : Screen Refresh Event



exert
06-13-2011, 09:14 PM
Hi,
I am very new to opengl.
The thing is I would like to synchronize flickering spot (rectangle changing color) with the refresh rate.
To accomplish that, I want to count the refreshes (e.g. white color during first 3 refreshes, black during next 4 etc.)

Is that possible at all ?
Any ideas ?

Rgds,
Piotr

zeoverlord
06-14-2011, 06:02 AM
If your using double buffering SwapBuffers will normally wait for the next refresh to draw, so unless you are rendering something that is to slow then every frame you render is normally synced to the refresh rate.

ZbuffeR
06-14-2011, 07:44 AM
Make sure you ask for vsync, with wglSwapInterval(1) or glXSwapInterval(1)
Make sure you draw simple stuff, wich should render much faster than refreshrate.
Use glFinish() after each swap, to avoid command buffering of GL commands.
Then count the number of renderings.

Can you explain a bit the context of your needs ?

exert
06-16-2011, 08:03 PM
Thanks ZbuffeR.

I have to implement a visual stimulator, which has to be as precise as possible. I would go for GDI, because what I need are only a few flickering squares, but it is not possible to enable vsync in it.