c++ - SDL2 and OpenGL, forcing FPS with Vsync disabled? -


i'm having issue opengl functions seem force application run 60fps. i'm using sdl2 , specify

sdl_gl_setswapinterval(0) 

during initialization, thought disabled vsync. example, following line of code return 16 ms every time (assuming code run in loop, if have drawn on-screen in similar fashion take 16 ms run function instead , 1 in order of microseconds instead of milliseconds):

uint32 begin = sdl_getticks(); glint lightbuffer = glgetuniformlocation(cnight_shader.gprogramid, "lightbuffer"); glint varying_time = glgetuniformlocation(cnight_shader.gprogramid, "varying_colour"); glactivetexture(gl_texture2); glbindtexture(gl_texture_2d, texcolorbuffer);  gluseprogram(cnight_shader.gprogramid); gluniform1i(lightbuffer, 2); gluniform1f(varying_time, cnight_shader.f1); draw_quad(0, 0, screen_width, screen_height); // (0, 0, mytexture); gluseprogram(null); glbindtexture(gl_texture_2d, 0); glactivetexture(gl_texture0); uint32 end = sdl_getticks(); std::cout << end - begin << std::endl; 

any on appreciated. i'd note if don't use shaders or buffers , simple:

glbindtexture(gl_texture_2d, texture_id); draw quad(); glbindtexture(gl_texture_2d, 0); 

this not force fps, i'm thinking issue related shaders, don't understand why.

so figured out, turns out drivers had set vsync forced on causing this, , getting confused because thought vsync force delay when swapping buffers, that's not case, explained here.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -