Ok so i have a lcd monitor with a refresh rate of 60hz. What i want to do is synchronize my drawing with the refresh rate. So i might draw a circle on the first refresh and then wait 59 refreshes after which I draw a square. Basically i need to treat it like a slide show sought of.
How would i do this.
which platform are u in windows/linux? and which utility toolkit if any are u using. FYI glut automatically keeps vsync on by default.
windows, no im not using a toolkit thought if thats required thats no prob. Basically what i want is like being able to assing a calback to the actual draw event, such that if the monitor were 60hz it would get called 60 times per second. Is there any way to do this.
There is no callback on vsync AFAIK.
If you really want to be tied to 1/60 of the refresh rate, you can do wglSwapInterval(60);
Or simply run a timer within your code, triggered every second, with vsync on using wglSwapInterval(1); to avoid any tearing. This is a better solution, if you do not mind a little jitter (depending on timer precision, between rendered frame you may have 58 or 61 refreshes).
I am using windows and glut. What is the header for wglswapinterval. It cant find the function
U would need glew for this and.
You don’t specifically need GLEW. Any extension loading software would do. Or just load the swap interval extension yourself.