Syncing to retrace with GeForce cards

Hi,
I am using a simple Opengl program on a linux platform and am experiencing problems with tearing. Basically, the program simulates a sports–ball that approaches the camera at a constant velocity along the z-axis. At some distance from the camera the ball disappears (by moving it out of view of the camera). Because of timing issues, I must sync the balls movement with vertical refresh.

On the last frame, I can clearly see tearing occur. I’ve made every attempt at making my code as efficient as possible, but it really is a simple bit of code and all calculations should easily be made before the buffers are swapped.

I’m thinking this is a problem with swap buffers and GL_SYNC_TO_VBLANK which I use to sync swap buffers with vertical retrace (as directed by NVIDIA notes).

I’ve heard that on my old GeForce256, GL_SYNC_TO_VBLANK is not hardware accelerated and so syncing with retrace does not work properly.

Does anyone know anything about this?? That is, does anyone know why the 256 does not sync properly with swap buffers, and if later cards (e.g., the GeForce4 Ti) is any better at syncing with retrace.

Otherwise, would anyone be interested in running my code on a machine with a better graphics card and tell me if they are experiencing tearing on the last frame.

thanks,
Simon

I had the impression that all GeForce products would sync to vertical blank… though I’ve not tinkered with the video card you’ve mentioned.

A couple suggestions:

First, make sure you are getting a direct rendering context. Use the glXIsDirect() query to verify that the context you are using is actually direct-rendering. I initially had a problem with the GLX rpm not deleting pre-existing files on my system during the install. glxInfo indicated that my system supported direct rendering; however, when I created a context glXIsDirect() would return that my rendering was not direct! I ended up installing from the source rpm to solve this problem. Turns out I had been linking with the wrong GL libs.

Anyway, if you’re not getting a direct context then the __GL_SYNC_TO_VBLANK will not work. Make sure your context is direct.

Next, you may need to investicate use of “page flipping” with full-screen applications on GeForce cards (making the assumption your application is full screen).
If not a full screen application, then this will not be a option for you… unless you can afford a Quadro!!!

Good Luck!

Hi ScuzziOne,
thanks for your reply. I followed your suggestions and have discovered that i do have a direct rendering context. So it seems that is not the problem. I’m a bit of a newbie to setting environment variables. Can you tell me: when setting an environment variable using bash shell, should i type at the command prompt:
export __GL_SYNC_TO_VBLANK=1
OR
export GL_SYNC_TO_VBLANK=1.
I’ve just realised that I have been using the later (without the first two underscores). I’ve seen both types of exports in user manuals/websites relating to GL_SYNC_TO_VBLANK.

Is it important to have the first two underscores? Am I setting the environment variable correctly? I’ve noticed when I set using the former (with underscores) my whole system freezes and I cannot leave X, and so must reboot.

Any thoughts would be greatly appreciated.
cheers,
Simon

Originally posted by ScuzziOne:
[b]I had the impression that all GeForce products would sync to vertical blank… though I’ve not tinkered with the video card you’ve mentioned.

A couple suggestions:

First, make sure you are getting a direct rendering context. Use the glXIsDirect() query to verify that the context you are using is actually direct-rendering. I initially had a problem with the GLX rpm not deleting pre-existing files on my system during the install. glxInfo indicated that my system supported direct rendering; however, when I created a context glXIsDirect() would return that my rendering was not direct! I ended up installing from the source rpm to solve this problem. Turns out I had been linking with the wrong GL libs.

Anyway, if you’re not getting a direct context then the __GL_SYNC_TO_VBLANK will not work. Make sure your context is direct.

Next, you may need to investicate use of “page flipping” with full-screen applications on GeForce cards (making the assumption your application is full screen).
If not a full screen application, then this will not be a option for you… unless you can afford a Quadro!!!

Good Luck![/b]

To make sure I’m telling you correctly, I just tried out both environment variables you mentioned to see what would happen. The __GL_SYNC_TO_VBLANK variable is the only one of the two which enables the vertical blank syncing.

As far as environment variable setting, looks like you’ve got it right. The two underscores are simply part of the variable name and have no other special meaning. As you stated in the previos post, you should simply have to set the following variable:

export __GL_SYNC_TO_VBLANK=1

On my system with RedHat7.3 and nVidia GLX/driver 1.0-2960, this successfully enables the vertical blank syncing. However, it sounds like this feature is locking your system up for some reason.

Only suggestion I have on the lockups is to make sure you’ve got the latest driver/GLX versions as well as one of the latest X server versions such as the 4.2.0 which came with the RehHat7.3. Other than that, the only thing I can think of is to give the GLX SRPM a try if you installed from the binary RPM. The SRPM will extract a source directory in which you manually run a makefile to remove possibly conflicting libraries and install the nVidia versions in the correct places. Again, I had to go this route myself to get rid of the conflicting files which were not removed by the binary RPM install. Perhaps you have a similar problem whereby you’re linking with an incorrect library? Not sure though…

Best of Luck!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.