wglSwapInterval in main loop?

Started by
0 comments, last by Katie 12 years, 8 months ago
If I try to set wglSwapInterval when my program starts it doesn't work. Will it hurt performance if I place it in my main loop?
Advertisement
Don't put anything in your main loops you don't need.

Particularly, don't change global configuration settings like this. Why? Because behind the scenes it could have to do a lot of faffing about with the driver state. It may (just for example) want to flush the drawing queue or something like that[1]. Without tracing the behaviour, you can't be sure about that and you can't be sure that the effect will be the same on all the different drivers out there.

When you say that it doesn't work when your program starts, does it return an error? Crash? Simply not apply the setting? And are you sure you have a valid established context at the time you issue it?




[1] Certainly I have seen[2] non-OpenGL drivers where the config systems just had a big exclusive lock on them to prevent rendering and changing overlapping. There's usually no problem with this because most of the time, people do setup in one go and only then start rendering.


[2] And on at least one occasion written.

This topic is closed to new replies.

Advertisement