design question: OpenGL and cocoa
design question: OpenGL and cocoa
- Subject: design question: OpenGL and cocoa
- From: email@hidden
- Date: Thu, 10 Apr 2003 22:37:04 -0700 (PDT)
I'm new to this whole object-oriented approach with OpenGL and was hoping get
some advice.
I have a view defined as:
@interface MyView : NSOpenGLView
This view is responsible for drawing an image on the screen. The image is
composed of multiple objects of different shapes. However instead of having the
view know about how to draw these shapes, I thought I would "ojectify" (is that
even a word?) them.
So I have created the following model:
@interface MyShape
{
}
-(void) draw;
@end
@interface MySquare : MyShape
{
}
@end
@interface MyCircle : MyShape
{
}
@end
@interface MyTriangle : MyShape
{
}
@end
and each of these objects overides the -(void)draw method and uses openGL to
draw the appropriate shape.
Thus the idea is that MyView's drawRect method will iterate over all the MyShape
objects it needs to draw and simply call the object's -(void)draw method.
Something to me doesn't feel right, and I am not sure what that is. I think it
might have to do with the MyShape objects not knowing about the context into
which it must draw to?
any help would be appreciated..
thanks
Zameer
__________________________________________________________
Get your FREE personalized e-mail at
http://www.canada.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.