Re: Smooth OpenGL animation possible, even if main thread blocks?
Re: Smooth OpenGL animation possible, even if main thread blocks?
- Subject: Re: Smooth OpenGL animation possible, even if main thread blocks?
- From: vincent habchi <email@hidden>
- Date: Mon, 28 Jun 2010 15:30:18 +0200
Le 28 juin 2010 à 15:01, Markus Hanauska a écrit :
> What does work, but I doubt it is allowed, is to directly call 'display' on the CALayer. Apple says "you should not call this method directly", but so far it seems to work and has not crashed... on the other hand it might crash if the CALayer is destroyed on the main thread asynchronously (that can be avoided, though, by making sure the other thread stops first, before the CALayer is ever destroyed). Another issue is that it might cause refreshes of the CALayer, even thought the layer is not even visible right now (e.g. the whole Window is minimized); but that could be solvable, too, though I'm not sure how (querying UI properties of elements from a thread other than main is definitely not thread-safe).
I never called -display directly. I think the benefit of having a runloop is precisely to avoid this call. When I wanted to remove one CALayer, I stopped the Runloop (by calling a suitable method), the thread then quit after removing its CALayer (in my case, I was refreshing in parallel a lot of CALayers grouped in a CAScrollLayer, and, to keep a reasonable number of threads, I destroyed the layers that weren't visible by a certain margin).
As for the second issue, you can implement a test in the -drawLayer:inContext delegate method, no?
Jedoch, viel Spaß ;)
Vincent_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden