Re: subclassed NSOpenGLView won't draw in subclassed NSView
Re: subclassed NSOpenGLView won't draw in subclassed NSView
- Subject: Re: subclassed NSOpenGLView won't draw in subclassed NSView
- From: Shaun Wexler <email@hidden>
- Date: Tue, 8 Feb 2005 09:20:37 -0800
On Feb 7, 2005, at 6:44 PM, Carl Gieringer wrote:
Problem fixed!
I am not precisely certain what fixed this problem but I believe that
it was [[aHistoryGraphView openGLContext] flushBuffer]. Thanks to the
several people who offered this suggestion. I surmise that using that
way of flushing allowed my NSOpenGLView to propagate the fact that its
frame needed redisplay up to the window server (or wherever.)
Since you are drawing outside of drawRect: by locking focus on the GL
view and issuing commands, you need to flush the command stream to
"make things happen" when you are done, and if double-buffered you must
also swap the buffers from back to front for display. This is done for
you automatically by Cocoa when the entire window is resized or
redrawn, so you don't want to manually flush (again) in drawRect: Do
it before you unlockFocus on the view in your "other" drawing method.
Actually, locking focus on the view itself isn't necessary if you
instead use a mutex around all cgl_ctx access. See the pseudocode I
posted on the mac-opengl list for a high-performance threaded OpenGL
rendering example.
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden