MacBook/iOS Retina


There has been some discussion on this subject but no clear definititive solution that I could find on the forums. Right now the functions in a Graphics drawImage and drawImageTransformed ultimately get down to the CoreGraphicsContext CGContextDrawImage. This function is clearly not in the GPU and from what I can find on the subject people have very limited success getting it there. The common conception is to use a UIImageView on iOS and NSImageView on Mac. Obviously this does not help us.

On most things the slower access is not very noticible at all as we do not redraw things like graphic buttons over and over. However I have a graphics app that show an image and updating anything on the screen causes a redraw to the CGContextDrawImage. So if a user is manipulating a bezier path, ellipse, rectangle, etc. over the top of the image then you almost have a worst case redraw of the whole image (assuming the ellipse mostly covers the image).  To properly handle retina I use an image that is 2X to begin with, however if the user has the document zoomed or panned this can be ultimately bigger or smaller.

Even the Juce Demo on the Image Rendering demo with RGB images (tiled or not) severly slows down on Retina machines and becomes almost unusable depending on your window size and machine (13" MacBook Retina is just terrible)

The OpenGL Renderer renders fabulously fast but it currently has some issues with stretched images (will be looking into this next) where the image does not draw properly, plus the fact that I do not want to purchase every machine to test with to make sure it is acceptable. (the thought was just to enable OpenGL on the retina machines)

So I am somewhat stuck in a pickle here. Has anyone had any luck getting the juce version of CGContextDrawImage to render on the GPU or worst case at a decent speed?

The easiest speedup is to turn off interpolation of the CGContext using "CGContextSetInterpolationQuality(context, kCGInterpolationNone);" for that image. But this only doubles the speed (which is better than nothing but does not give the best quality in all cases).


With OpenGL Renderer is there a way to only have it active on a sub-view of the top level component? So in my case the view that renders my image and tools drawing would be OpenGL and everything else is standard CG graphics.

These issues are also identical on the iPad 3/4/Air with it being just abysmal on the iPad 3 and acceptable on the iPad 4/Air. The same tests show that rendering is done in software. Again with setting interpolation to None will double the speed on the iPad 3. OpenGL is slower than the interpolated off version but faster than the raw version.




So after further reading CGContextDrawImage will never be on the GPU. Which leaves OpenGL. Which brings me to an issue on iPad in that it is slower than CoreGraphics. The odd thing is on Android it is quite fast (depending on device) and almost acceptable (even before my other optimizations).


So is there anything to adjust to get OpenGL on iPad running faster?