I’ve just started experimenting with openGL in the hope that a little hardware acceleration would give my animated 2D components a better frame rate. However, simply attaching an OpenGLContext to the top level component actually slows down the rendering relative to the software renderer (on both mac and iPhone at least). This effect can be easily observed using the JUCE Demo on the opening page.
I’m guessing that folks here are not simply switching the entire rendering of their application over to openGL? When is it a good idea to use openGL over the software renderer? Is it ever a good idea when doing 2D stuff?
When you’re testing, make sure you use a fully-optimised release build, because that’ll make a big difference to the GL renderer.
It’s much faster for some things, and not for others… At the moment I think the only bottleneck is if you’re drawing a lot of memory-based images, and that’s something I’m planning on improving by caching images in texture memory.
I'm doing a release build with -O3 optimisation. On the rendering demo page in the JUCE demo with all component animation options set, I get . . .
iPod touch 5th gen:
30 fps using the software renderer and 9 FPS using OGL
iPhone 4S:
35 fps using the software renderer and 11 FPS using OGL
iPad 2 (bigger display area, so you'd expect slower):
15 fps software / 7 fps OGL
I haven't found a combination of settings where OGL > Software yet. Am I missing any special flags or something?
I’m doing a release build with -O3 optimisation. On the rendering demo page in the JUCE demo with all component animation options set, I get . . .
iPod touch 5th gen:
30 fps using the software renderer and 9 FPS using OGL
iPhone 4S:
35 fps using the software renderer and 11 FPS using OGL
I haven’t found a combination of settings where OGL > Software yet. Am I missing any special flags or something?[/quote]
TBH I was thinking more about desktop OSes rather than iOS. On iOS the CoreGraphics renderer will be hard to beat (I assume that’s what you’re talking about when you say “software” renderer, and not the actual software renderer)
Meh. It’s ok. I have spent the afternoon judiciously adding setOpaque(true) to small regions and staggering animations so that there are fewer visible simultaneous components mid-animation on screen at any given time. This has gotten the frame-rate up considerably without significant loss in whizbang factor.