OpenGL and NSOpenGLView troubles
OpenGL and NSOpenGLView troubles
- Subject: OpenGL and NSOpenGLView troubles
- From: ryan <email@hidden>
- Date: Sat, 08 Jun 2002 23:52:22 -0700
Hi,
I have developed a simple 2 window application. The main window has
some buttons and the 2nd window is a CustomView set to instantiate class
GLView : NSOpenGLView. The app comes up and it works, I can render GL
calls, get mouse events, etc. But then I click on the close button and
the window dissapears. Since the window is not set to 'Release when
closed' it stays around.
From the other window I can click on a button which does: [glWindow
makeKeyAndOrderFront:self]. So this is great, the window comes back..
but now the OpenGL view is white (I have it set default to black). I
can't draw anymore in it, and I have to restart the app to get my
drawing back.
So I read lots of docs and tried a large number of things... including
trying to recreate the GL context and recalling my init GL calls.
Nothing seems to work at all.
I might try doing away with NSOpenGLView and use straight up NSViews and
maintain all the extra stuff myself, but I thought I'd ping the list to
see if anyone knows whats going on here?
I also thought about using a NSWindowController to completely release
and close the window, then reinit it from the NIB when I need to
redisplay the GL window.
Questions:
- What really happens to a window that gets closed but not released?
Can I do the makeKeyAndOrderFront: to show it again?
- If so, why does it seem like my OpenGL view goes away and never comes
back?
- If I need to reinitalize the entire OpenGL context from scratch, where
do I do that? I have the GLView object a delegate to its window so it
gets windowDidBecomeKey:, but this gets called quite a bit.
I know I could put the GL view in the main window, make the GL view
window uncloseable (my current 'solution') but I'd rather be able to
bring back a closed GL window that hasn't been dealloc'ed and redisplay
it. Even if I have to completely reinit the GL context (recreate draw
lists, etc).
Any suggestions?
Thanks!
-ryan
_______________________________________________
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.