Core Data with OpenGL
Core Data with OpenGL
- Subject: Core Data with OpenGL
- From: Richard Somers <email@hidden>
- Date: Mon, 12 Oct 2009 08:47:52 -0600
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?
Richard
_______________________________________________
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