Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 5, 2012, 02:22 PM   #1
DRobinson
macrumors newbie
 
Join Date: May 2012
OpenGL Flickering issue (programming)

I've recently ported an OpenGL music visualizer I built for Windows over to my Mac.

I know that might make people jump to just blaming it on porting, but hear me out - the code was all system independent, that's not the issue.

The project uses: OpenGL, Boost Libraries (multithreading, etc.) and FMOD. I got everything running, but I noticed it seems to flicker a lot on high-action/high-refresh moments.

Here's the weird part: if I put the mouse/cursor over the Mac's dock/toolbar, and OSX uses the magnify effect, all of a sudden the framerate on my program skyrockets, and flickering disappears entirely!

This leads me to believe that the OS isn't going into some sort of graphics-mode and the GPU ( and maybe the CPU, too) is probably not running properly with just the program. As soon as something else triggers it, the graphics look fine.

Does that make sense in any way? Has anybody experience that, or otherwise does anybody have any ideas about a solution (other than just telling people where to park their cursors while the program runs lol)?

Thanks,
- Dylan
DRobinson is offline   0 Reply With Quote
Old May 5, 2012, 04:32 PM   #2
Starfox
macrumors regular
 
Join Date: Apr 2011
I think BeamSync is why you're seeing that behavior. Do you have VSync on?
Starfox is offline   0 Reply With Quote
Old May 6, 2012, 01:04 PM   #3
DRobinson
Thread Starter
macrumors newbie
 
Join Date: May 2012
Quote:
Originally Posted by Starfox View Post
I think BeamSync is why you're seeing that behavior. Do you have VSync on?
I hadn't really implemented VSync yet, in the application. Well, I have, but I didn't use GLUT's built in VSync because there are, apparently, issues that make it not so great.

Though it looks like BeamSync runs outside of the applications (from what Google's telling me). I can't seem to find any graphics options/settings. The macbook has an Intel GMA 3000, if that makes a difference as far as changing Beam Sync state goes.

One thing I notice is that in the little debug mode I've built into the application, it renders how long each frame takes to render (split into the different threads). In general, the background processing thread takes ~1500-2500 microseconds per frame - save for the occasional jump when a mutex is locked; the system doesn't spin locks that frequently - but as soon as I park the mouse over the dock and the effect's enabled, those numbers start showing up as 400-600 (huge improvement).

Actually, the thread's execution speed seems to improve as long as any other window is focused above the graphical application, too.

Anyway, I'm starting to think playing around with the time-related functions (clock_t and GLUT_ELAPSED_TIME) might be a better idea because it seems that they're giving a deeper granularity on OSX than on Windows (micro-vs-milli-seconds) and I'm starting to think that it could be the cause of the issues. Maybe. It's not a huge deal, but these types of things always get me curious
DRobinson is offline   0 Reply With Quote
Old May 6, 2012, 06:33 PM   #4
ender land
macrumors 6502a
 
Join Date: Oct 2010
Does this happen if you effectively only have this app running?

Are you using a macbook pro with two graphics cards?
ender land is offline   0 Reply With Quote
Old May 6, 2012, 07:48 PM   #5
Starfox
macrumors regular
 
Join Date: Apr 2011
There's no GLUT built-in VSync. VSync is controlled by the swap interval parameter of the CGL Context and that's handled by the driver. Set that to 1 and your problems should go away.

http://developer.apple.com/library/m...21/_index.html

----------

Also, since you're using GLUT on OS X you should be able to toggle VSync from the Preferences window and get immediate feedback. Try that.
Starfox is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Mac programming should be more like iOS programming. moonman239 Mac Programming 13 Feb 17, 2014 01:37 PM
Resolved: Programming issue, no clue whats wrong. Rudsther2435 iPhone/iPad Programming 6 May 10, 2013 11:38 PM
OpenGL flickering on window resizing BehindTimes Mac Programming 9 Feb 8, 2013 07:03 AM
Cursor flickering issue on safari and embedded PDF viewer der richter OS X 10.8 Mountain Lion 1 Nov 28, 2012 11:08 AM
Beginning OpenGL 3.0+ Programming (again) in OS X, targeting multiple platforms Soulstorm Mac Programming 6 Jul 10, 2012 09:34 AM

Forum Jump

All times are GMT -5. The time now is 03:38 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC