Re: Core Data with OpenGL
Re: Core Data with OpenGL
- Subject: Re: Core Data with OpenGL
- From: Dado Colussi <email@hidden>
- Date: Tue, 13 Oct 2009 13:25:13 +0200
On Mon, Oct 12, 2009 at 11:30 PM, Richard Somers <email@hidden
> wrote:
> So you are saying that I should abandon this and put the draw method
> somewhere else like in a controller. Perhaps you could fill the picture in a
> little more for me. So far I have yet to find any sample code that is a
> document based core data application that uses OpenGL.
>
There is no strictly correct way of solving your problem. Below are my
recommendations.
Design your model objects as data containers. Hence no drawing behavior in
model objects. If you add behavior to your model objects, make minimal
assumptions about the world outside the model objects.
Have separate classes that know how to draw your model objects in a
particular rendering technology. For OpenGL, have a custom NSOpenGLView
class that knows how to translate your model objects to OpenGL commands.
Create a controller class that acts as a resource manager. Make the
controller decide when to allocate an OpenGL context, how many of them to
have around, how the contexts are associated with the views, and generally
make it orchestrate the whole thing.
If your design does not fit this model well, then consider changing your
design.
/Dado
_______________________________________________
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