Sign in to follow this  
SteveDeFacto

wglSwapInterval in main loop?

Recommended Posts

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this