My first guess was that my drivers are forcing vsync onto SDL so i tried forcing it off in nvidia's control panel and then the framerate wasnt limited but was over 5000 frames per second.
I don't have that problem in other games, but i suppose they might do something to disable vsync.
I just wonder if there is a way to remove this limit so i would have framerate higher than my refresh rate.
My old gpu never had this problem with very same code i posted below.
ScreenShot: http://localhostr.co...pZ5xZ2i/sdl.jpg
Code:
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
int WINDOW_OPT[3] = {800, 600, 32};
void InitGL()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, WINDOW_OPT[0], WINDOW_OPT[1], 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glCullFace(GL_FRONT);
}
int main(int argc, char** argv)
{
SDL_Surface* window = SDL_SetVideoMode(WINDOW_OPT[0], WINDOW_OPT[1], WINDOW_OPT[2], SDL_HWSURFACE | SDL_OPENGL | SDL_GL_DOUBLEBUFFER);
SDL_Event event;
SDL_WM_SetCaption("TEST", NULL);
InitGL();
bool run = true;
while(run)
{
while(SDL_PollEvent(&event))
{
if(event.type == SDL_QUIT || event.key.keysym.sym == SDLK_ESCAPE)
{
run = false;
}
}
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glBegin(GL_QUADS);
glVertex2f(100, 100);
glVertex2f(200, 100);
glVertex2f(200, 200);
glVertex2f(100, 200);
glEnd();
SDL_GL_SwapBuffers();
}
SDL_Quit();
return 0;
}