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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to