Working around adaptive Vsync


On my machine with my OpenGL code I can either have no vsync or adaptive vsync, the latter which means vsync unless the frame runs too long, then that frame isn’t synced, it might well not even appear on screen. Adaptive vsync is nice and convenient, but I’d like to experiment with skipping frames to render at 30 FPS instead of 60, and forced vsync doesn’t seem to be available, SDL_GL_SetSwapInterval(1) also sets adaptive vsync (I guess it’s up to the driver to decide).

I’ve found a workaround which is to run my OpenGL code twice back to back, so regardless whether or not the first frame is vsynced the second one will be at the right time, which kind of works, but maybe that’s a tad inefficient? The code that I run twice is merely this:

	for(int i=0; i < 2; i++)
		float hoff = 2. * (fb.h - fb.maxdim.y) / (double) fb.maxdim.y;
		glLoadIdentity();             // Reset the projection matrix
		glViewport(0, 0, fb.maxdim.x, fb.maxdim.y);

		float tscale = 1.f;
		glTexCoord2f(0.f, 0.f);			glVertex2f(-1., 1.+hoff);
		glTexCoord2f(tscale*1.f, 0.f);		glVertex2f(1., 1.+hoff);
		glTexCoord2f(tscale*1.f, tscale*1.f);	glVertex2f(1., -1.+hoff);
		glTexCoord2f(0.f, tscale*1.f);		glVertex2f(-1., -1.+hoff);


But I have a feeling that this is neither the most efficient (it doesn’t seem to lower my GPU activity, which it should given that it does less, the OpenCL code that fills the texture isn’t doubled) nor the most elegant way to have vsync at half the refresh rate. Is there any known way of working around an OpenGL driver that insists on adaptive vsync?

Btw isn’t it weird that I have no tearing when vsync is off? It seems I can have like 200 FPS yet no tearing. I shouldn’t complain, it’s hardly a bad thing, it just makes me wonder how that works.