Re: NSOpenGLView subclass draw issues in NSPanel
Re: NSOpenGLView subclass draw issues in NSPanel
- Subject: Re: NSOpenGLView subclass draw issues in NSPanel
- From: Brent Gulanowski <email@hidden>
- Date: Thu, 15 Jul 2004 15:45:54 -0400
On Wed, 14 Jul 2004 18:10:49 -0400, David Wilson <email@hidden> wrote:
>
Hi all-
>
>
I've got a custom NSOpenGLView subclass that I'm using in a utility
>
panel in my application where the panel may not be open at all times.
>
When the panel first opens, everything displays properly, all the
>
OpenGL calls are displayed without issue. However, if the user closes
>
the panel and then reopens it, the custom subclass displays as only
>
(properly sized) white rectangle. Doing a little bit of detective work,
>
I've got the following information but still no answer:
>
>
1) My subclass's custom drawRect: is not getting called when the panel
>
reopens, or when the panel is dragged after being reopened, despite
>
being called during/after drags and while the panel was open the first
>
time.
>
>
2) The view's superview has not changed, and the view can still be
>
found in its superview's list of subviews.
>
>
3) Calling setNeedsDisplay:YES on my view causes the drawRect: to be
>
called, but no drawing appears to happen.
>
>
4) The act of closing the window is not causing my subview to be
>
deallocated, and the act of reopening it is not causing a new instance
>
to be created.
>
>
My drawRect: function correctly sets the appropriate GL context before
>
all drawing, so I don't think that's the issue; I'm just at a loss as
>
to what might have changed between the close and the reopen that would
>
cause drawing to suddenly fail. Any help would be well appreciated. :)
You probably need to call -setView on the context each time the panel
is brought back. When the window is taken off-screen, something might
be disconnecting the view from the context. Off-screen windows are not
valid drawables:
(from the docs for NSOpenGLContext)
- (NSView *)view
Returns the receiver's view. Returns nil if the receiver has no
drawable or is in full-screen or offscreen mode.
--
Brent Gulanowski
http://www.boredastronaut.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.