ofSetVerticalSync questions

Hi there,

I have an application that runs continuously for long periods of time (10+ hours). I had been setting “ofSetVerticalSync=false”, but then noticed that after about an hour of running, the graphics in my application would go completely haywire. Basically, glPushMatrix() and glPopMatrix() commands seemed to have stopped working. I experienced this same problem with the OF imageLoaderExample when running it on a PC for long periods of time (1 hour+).

Then I set “ofSetVerticalSync=true”, and this fixed the problem.

I assume the draw() loop was getting ahead of the update() loop, causing the strangeness.

Now the problem is that my application takes about a 30% performance (framerate) hit with “ofSetVerticalSync=true”.

So, my question is the following:

Is ofSetVerticalSync something that should be called just once at the start of a program? Or can I set it to true once every ten minutes or so, for a few frames, and then set it back to false? And would doing so allow the system to catch up with itself and re-sync? Does this sound reasonable, or does this raise any red flags?

Thanks!

Jonathan

1 Like

hi

I suspect you have a problem somewhere else in your code - perhaps with opengl calls that is based on timing. if opengl breaks down, please try commenting out parts of your code to see if there is a specific thing you are doing that causes it. We are definitely not used to seeing this kind of problems (but as always, it could be some usage we didn’t expect like ofSetCircleResolution() called repeatedly like before).

ofVerticalSync on or off doesn’t change at all the order of update/draw calls. They will always be alternating…

what you may want to do is experiment with ofSetFrameRate, to see if you problem is timing related (ie, vertical sync off means your app goes very fast) or not. Try VS off, and ofSetFrameRate(60) to see if you can avoid your issue.

I would suspect that you might have a bug in opengl, ie, an unterminated pushMatrix() or something else that is accumulating over time. when you run w/ vertical sync off, you get the problem accumulating quicker and then more weirdness.

I’d suspect that as you comment out parts of your code, you might be able to clearly identify an operation or set of operations that’s giving you trouble.

I hope that helps!
best
zach

Hey Zach,

Thanks for the response.

However, I don’t think the problem is with my code, as I experience the same behavior when running OF’s ImageLoaderExample for long periods of time (problem starts to occur after about an hour of continuous running).

I am using a PC with a fast Radeon graphics card. I haven’t experienced this problem on a Mac (after trying to replicate it), only on a PC.

What seems to happen is that all objects suddenly are drawn at the same coordinate point, ignoring any glTranslate / glScale / commands.

Check out these screenshots of the OF ImageLoaderExample:

  1. Normal behavior, after a minute or so:

  2. Crazy behavior, after an hour or so. At this point, all motion (i.e. the pink “transparency” image) has stopped:

When I set “ofVerticalSync=true”, this problem goes away.

Since I’m sure the OF example code is bug-free, it seems this must have something to do with my graphics card, and openGl starting to croak after long periods of time when ofVerticalSync is disabled.

Setting ofVerticalSync to true gives me about a 25% performance hit, so I’d like to avoid that. That’s why I was asking about the feasibility of toggling ofSetVerticalSync on and off momentarily every 10 minutes or so, to see if that might keep things kosher.

Strange, eh? Any further ideas or insights would be great. Thanks again!

Jonathan

1 Like

that is really one of strangest errors I’ve ever seen, and worth checking out at a lower level. what graphics card, system? that’s really, really haywire. Not that I think our stuff is perfect by any stretch, but I’ve never see that kind of problem, so I think it may be very specific to your card.

a)
can you try the error reporting code here? and see if opengl is complaining about something?

http://glprogramming.com/red/chapter14.html#name1

b)
second, can you take a look at temperature information for the graphics card (Shoud be possible in the control panel) - do you think it’s overheating or overclocked? it looks like the kind of side effect you would get if the card gets unhappy.

hope that helps -

take care
zach

I would also suggest looking at unofficial optimized drivers for your ATI card.
They often fix a lot of bugs that manufacture is not aware / doesn’t care about and they can increase performance and quality a lot without the need for overlocking.

There may be others for ATI but this is the one I know.
http://www.ngohq.com/home.php?page=ati

On the other hand if you have already installed something like this and / or are overclocking the card - then the bug could be to do with that.

I have used the nvidia equivalent of these drivers and they are pretty awesome - sometimes I get fps increases by up to 20%

Theo

Hi guys,

Thanks for your help.

I added openGL error reporting, and no errors are being reported.

I think the problem has to be with my graphics card.

I tried a side-by-side comparison with the same code on a different PC, with a better graphics card, and the problem did not occur.

The screen for which I am developing this piece is very demanding – 56" - 3840 x 2160 pixels, and I think the graphics card probably just can’t handle fullscreen apps for long periods of time. That’s the only thing I can conclude.

Thanks for looking into it!

Jonathan