PDA

View Full Version : "Flickerless" Buffer Swap



-=MadMan=-
02-22-2005, 03:59 PM
Hi everyone.

I've been trying to find the solution on this problem, but i'm tired reading all this posts.
So here it is. I'm new to Linux, Qt and OpenGL. We are writing a game, Qt has some problems with flickering on it's Canvas. So i've desided to rewrite some part under OpenGL. But once again i've got the same problem.
Please, please. Tell me how to sync buffer swapping with monitors raytrace.
Long time ago, when i was interested in writing my own 3D Engine without OGL or D3D i used some assembler code. But this case is different :(

Thanks to anyone. Bye. ;)

Korval
02-22-2005, 04:20 PM
You shouldn't have to do anything. The "swap buffers" call (which is not technically part of OpenGL, but the windows system dependent implementation code) ought to handle any sync to the monitor's refresh rate. If it isn't... well, maybe you can find another function? Otherwise, there's nothing you can do except wish for a better OpenGL implementation.

Speaking of OpenGL implementations, what card and drivers are you using?

sqrt[-1]
02-22-2005, 06:10 PM
I'm no linux expert but if you have
GLX_SGI_swap_control
can't you call:
glXSwapIntervalSGI(1);

dorbie
02-23-2005, 10:23 AM
Yep this is a sync to vertical retrace issue.

You need your swap to wait for the video to hit it's vertical blank period where the display device 'isn't looking' and during this period you can swap the buffer contents with no tearing.

These are system configuration settings but some drivers allow software control using the extension.

-=MadMan=-
02-25-2005, 07:57 AM
I'm using ATi Radeon 9500, but the tsrget platform is VIA KM400 integreated graphics. And the driver is FireGL 4.0.4 for Xorg ( could be mistake in driver version :) )
Unfortunatly Qt disables extensions, to make it crossplatform. But I don't need it :) I'll try to use GLX.
Thanks a lot! Now I'm know the right direction to follow ;)

dorbie
02-25-2005, 12:31 PM
There's probably a system setting that will enable swap sync by default. I don't know what that would be on a Linux system though.

-=MadMan=-
02-25-2005, 01:21 PM
You mean some driver flag? Perhaps, but it would be more useful to be able initiating this mode from code. Anyway it's may work. I'll try to find it.
Tried to use glXGetVideoSyncSGI(...) and glXWaitVideoSyncSGI(...), but it didn't worked. glXGetVideoSyncSGI(...) returns the same value all the time, but it should be an raycycles iterator. Both function returned success code. :-/
Any ideas?

newt
02-28-2005, 11:45 AM
export __GL_SYNC_TO_VBLANK=1

works on most cards that allow this.

The glXGet and glXWait functionsd you mention will
not work unless your card supports (and implements
correctly) the SGI_video_sync extenstion.