VSync on SDL+OpenGL

Started by
11 comments, last by rotalever 17 years, 6 months ago
Any one knows a way to specify the vsync for SDL+OpenGL ?
Advertisement
Try SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);, although note that it might not work in windowed mode. So to see if it works, you'll need to go full screen.

Cheers,
Shadx
Thanks, that work!. Now the problem is how to specify de refresh rate. Any idea ?
The refresh rate is a function of the OS (well, windows manager). In windows, right-click on the screen, Properties, Advance, Monitor Tab should bring you to where you can change the refresh rate.

Shadx
OK, thanks. That work again!
Isn't there any way to change the refreshrate via SDL?
and FSAA?
i dont know about refresh rate but AA is done with multiample
check the sdl doc or header file for info
You really shouldn't change the refresh rate from inside of the program, at least not unless the user specifies it. Older monitors (like mine) can't support many refresh rates, if your program defaults to, say, 75Hz, it'll come up black on my screen and I won't be able to play.

This has even happened with some professional games, too. That sends me on a hunt through config files and registry values to find where they hide the refresh rate.

And why do you even want to change the refresh rate?
"This has even happened with some professional games, too. That sends me on a hunt through config files and registry values to find where they hide the refresh rate."

That's a programming bug you found in other games.
I'm sure there are games out there that would try to create a 1000000 x 1000000 @ 2billion hertz fullscreen if you tell it to.

You can query for the supported monitor modes and choose whichever you want. Wow!

Sorry, I don't know the SDL API but I'm sure the ability is in there.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement