Re: OpenGL Troubles
Re: OpenGL Troubles
- Subject: Re: OpenGL Troubles
- From: David Spooner <email@hidden>
- Date: Mon, 24 Feb 2003 09:36:48 -0700
On Monday, February 24, 2003, at 02:28 AM,
email@hidden wrote:
But I get an "invalid drawable" message! I know that the current
context is the right one, and that it -update'd with the latest view
I think the view has to be associated with a window before you it can be
associated with an opengl context. I use NSView's -viewDidMoveToWindow
something like...
- (void) viewDidMoveToWindow
{
[_openGLContext setView:(window != nil ? self : nil)];
}
You'll need to implement -reshape if you don't subclass NSOpenGLView
- (void) reshape
{
[_openGLContext update];
}
In -lockFocus, I call
[_openGLContext makeCurrentContext];
Also, I would call NSOpenGLContext's -makeCurrentContext from -drawRect:
rather than overriding -lockFocus
dave
_______________________________________________
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.