• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Core Data with OpenGL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data with OpenGL


  • Subject: Re: Core Data with OpenGL
  • From: Richard Somers <email@hidden>
  • Date: Mon, 12 Oct 2009 12:23:26 -0600

Rob, your comment got me thinking and I did some checking. I am drawing to a CAOpenGLLayer which has two OpenGL contexts, one public and one private. The frameworks switch at times to the private one (outside of the normal drawing cycle). This private one is where some of my OpenGL commands are going during the core data part of the application. Still not sure of what to do however.

When a view draws, you are guaranteed that the context will be current and ready for drawing. But outside of that there is no guarantee that the correct context will remain current.

I could do the required OpenGL setup for the model object during the first draw call. But how would I do the OpenGL cleanup when the model object is removed from the managed object context? The only message sent to the model object is didTurnIntoFault which knows nothing about the context.

Richard

On Oct 12, 2009, at 10:05 AM, Rob Barris wrote:

since there are CGL calls to set and get the current GL context - it
seems this would be easy to solve (assuming you know which context you
actually want to target at these times)

On Mon, Oct 12, 2009 at 7:34 AM, Richard Somers  wrote:

Consider an application using Core Data and OpenGL.

Normally a model object (MVC) has no knowledge of views or controllers but
in this case it must draw itself. When the draw method is called by the view
or controller the appropriate OpenGL context is current. So far so good. The
problem however is with OpenGL resources needed to support drawing.


When a model object is added to the managed object context, specific OpenGL
resources need to be created. When a model object is removed from the
managed object context, OpenGL resources need to be cleaned up.


A seemingly straight forward solution would be to do the OpenGL
initialization and cleanup work in the awakeFromInsert, awakeFromFetch, and
didTurnIntoFault methods of NSManagedObject. The problem is however, the
OpenGL context is not current when these methods are called. These methods
are called by the Core Data framework which has no knowledge of the OpenGL
context.


Any suggestions or comments?

_______________________________________________

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


  • Prev by Date: Re: Core Data with OpenGL
  • Next by Date: Re: Problem with OpenSSL header files
  • Previous by thread: Re: Core Data with OpenGL
  • Next by thread: Re: Core Data with OpenGL
  • Index(es):
    • Date
    • Thread