[Openmcl-devel] Core Animation demo

Raffael Cavallaro raffaelcavallaro at mac.com
Tue Jul 7 20:47:54 PDT 2009

On Jul 7, 2009, at 9:39 PM, Neil Baylis wrote:
> However, I found the problem. I carefully compared the objc code and  
> the lisp code again, and noticed that the objc code does not call  
> setNeedsDisplay in the mouse event handlers. I removed these calls  
> from the lisp version, and now the animation is just as smooth as  
> the objc version. Also, during continuous dragging, the CPU usage  
> reported by "top" is about 3.6%, which is pretty good, I think.

I have noticed one issue with your demo - If I attempt to run it a  
second time without restarting ccl, the window appears, but without  
the sprite.

There's this console error:
7/7/09 11:38:48 PM	dx86cl64[39512]	layer _NSViewBackingLayer(0x1be5d0)  
a={0, 0} p={0, 0} b=(0,0,900,600) superlayer=0x0 is already attached  
to a context

IOW, somehow the call to make-ca-layer is trying to re-use the same ca- 
layer. I've found that changing this:

(let* ((layer (#/init (objc:make-objc-instance "CALayer")))…

to this:

(let* ((layer (make-instance 'ns:ca-layer))…

solves this issue, though I'm not sure why the first would produce  
different results than the second, but, at least on my setup, it does…

Thanks again for this demo.

warmest regards,


Raffael Cavallaro
raffaelcavallaro at me.com

More information about the Openmcl-devel mailing list