Re: Getting the best frame rate for NSView drawing

2012-03-30 Thread jonat...@mugginsoft.com
On 29 Mar 2012, at 18:04, Kyle Sluder wrote: On Mar 29, 2012, at 5:12 AM, lbland lbl...@vvi.com wrote: ... look at the call stack. On the Mac fill most likely calls opengl in the end as Quartz GL has gotten pretty good. Quartz GL is not enabled by default. Also, see this:

Re: Getting the best frame rate for NSView drawing

2012-03-30 Thread Per Bull Holmen
Den 11:52 30. mars 2012 skrev jonat...@mugginsoft.com jonat...@mugginsoft.com følgende: On 29 Mar 2012, at 18:04, Kyle Sluder wrote: On Mar 29, 2012, at 5:12 AM, lbland lbl...@vvi.com wrote: ... look at the call stack. On the Mac fill most likely calls opengl in the end as Quartz GL has

Re: Getting the best frame rate for NSView drawing

2012-03-30 Thread Per Bull Holmen
Den 13:21 30. mars 2012 skrev Per Bull Holmen pbhol...@gmail.com følgende: If you need to use higher level APIs, you need to use glDrawPixels (which is slw) to transfer the data from an offscreen NSGraphicsContext/CGContext into the frame buffer object, THEN draw onto the screen using

Re: Getting the best frame rate for NSView drawing

2012-03-30 Thread Uli Kusterer
On 28.03.2012, at 09:36, Kenneth Baxter wrote: For testing purposes, I have a view that is 5,000 x 5,000 and have 100 of my objects which are placed randomly and size 200 x 400. FWIW, I wrote a little game for a presentation at a conference once: On the page http://macoun.de/material2010

Re: Getting the best frame rate for NSView drawing

2012-03-29 Thread Per Bull Holmen
Den 02:50 29. mars 2012 skrev Kenneth Baxter k.b.bax...@mac.com følgende: Thanks Graham, Yes, fully aware that CGLayer and CALayer are completely different. Interesting to hear about the z position needing to be a large number - will keep that in mind. Cool visualizer. I'm going to have

Re: Getting the best frame rate for NSView drawing

2012-03-29 Thread jonat...@mugginsoft.com
On 28 Mar 2012, at 09:19, Graham Cox wrote: On 28/03/2012, at 6:36 PM, Kenneth Baxter wrote: Draw each object individually (admittedly it's just a simple oval in rect which is filled and stroked): 12fps Generate an NSImage of the object once and cache it, then just drawInRect...: 8fps

Re: Getting the best frame rate for NSView drawing

2012-03-29 Thread lbland
hi- On Mar 29, 2012, at 7:49 AM, jonat...@mugginsoft.com wrote: Like graham I am surprised that the NSImage cache approach is slower than fill/stroke. ... look at the call stack. On the Mac fill most likely calls opengl in the end as Quartz GL has gotten pretty good. ... not true on the

Re: Getting the best frame rate for NSView drawing

2012-03-29 Thread Kyle Sluder
On Mar 29, 2012, at 5:12 AM, lbland lbl...@vvi.com wrote: ... look at the call stack. On the Mac fill most likely calls opengl in the end as Quartz GL has gotten pretty good. Quartz GL is not enabled by default. Also, see this:

Re: Getting the best frame rate for NSView drawing

2012-03-29 Thread Per Bull Holmen
Den 19:04 29. mars 2012 skrev Kyle Sluder k...@ksluder.com følgende: On Mar 29, 2012, at 5:12 AM, lbland lbl...@vvi.com wrote: ... look at the call stack. On the Mac fill most likely calls opengl in the end as Quartz GL has gotten pretty good. Quartz GL is not enabled by default. Also,

Getting the best frame rate for NSView drawing

2012-03-28 Thread Kenneth Baxter
I am trying out some different ideas for animating portions of a view, but am having problems with performance.  Essentially I have an animation running using a CABasicAnimation, and when it calls back to my view, it invalidates the rect where the object was drawn, and the new place where it

Re: Getting the best frame rate for NSView drawing

2012-03-28 Thread Graham Cox
On 28/03/2012, at 6:36 PM, Kenneth Baxter wrote: I am trying out some different ideas for animating portions of a view, but am having problems with performance. Essentially I have an animation running using a CABasicAnimation, and when it calls back to my view, it invalidates the rect

Re: Getting the best frame rate for NSView drawing

2012-03-28 Thread Uli Kusterer
On 28/03/2012, at 6:36 PM, Kenneth Baxter wrote: I am trying out some different ideas for animating portions of a view, but am having problems with performance. On current hardware, the main bottlenecks in the drawing pipeline are two spots: 1) The CPU, i.e. drawing stuff using Quartz calls.

Re: Getting the best frame rate for NSView drawing

2012-03-28 Thread Kenneth Baxter
Thanks for taking the time to put together these replies Graham and Uli.  Yes, I know it's a heavy load in my test case, but it is something that could happen from time to time in the real application. The contents of about half the layers seldom change, so from that perspective, caching

Re: Getting the best frame rate for NSView drawing

2012-03-28 Thread Per Bull Holmen
Hi Ken, I'm sorry that I can't give you a great answer to your questions, I can only tell you what I do myself when I need high animation performance: I use OpenGL, even for 2D. I have wondered whether some of the more high level technologies are more suited, but judging from game programming web

Re: Getting the best frame rate for NSView drawing

2012-03-28 Thread Graham Cox
On 28/03/2012, at 11:45 PM, Kenneth Baxter wrote: The contents of about half the layers seldom change, so from that perspective, caching contents as either NSImages, CIImages, CGLayers or using CALayers would seem to be a good idea. The other half of the layers are simple, and just

Re: Getting the best frame rate for NSView drawing

2012-03-28 Thread Kenneth Baxter
Thanks Graham, Yes, fully aware that CGLayer and CALayer are completely different. Interesting to hear about the z position needing to be a large number - will keep that in mind. Cool visualizer. I'm going to have another go at a test project and see if I can work around the issues and do