GLUT apple menu close application
Is there a way to disable or capture the Quit Application command when issued by the command bar? The problem I am having is my game isn't saving settings when its closed via this method, glutMainLoop isn't returning, maybe I can capture this by hooking exit(int)?
glutMainLoop never returns, as the docs say.
No, you can't alter the fixtures that GLUT gives you. If you want more control, you can write your GUI yourself in Cocoa.
You can use "atexit" to have something run when your app exits.
No, you can't alter the fixtures that GLUT gives you. If you want more control, you can write your GUI yourself in Cocoa.
You can use "atexit" to have something run when your app exits.
Can't you just do something like
Begin/Init code
glutMainLoop
Save Settings
end
Tobs
Begin/Init code
glutMainLoop
Save Settings
end
Tobs
No, because glutMainLoop doesn't return, it calls exit(1) instead.
you could always have another program load your program as a child and then you could have code after the child program exited; this probably isn't a great way to go, though...you'd be better off taking OSC's route.
-wyrmmage
-wyrmmage
Worlds at War (Current Project) - http://www.awkward-games.com/forum/
...because glut is a load of flying !$%@#.
Personally, I'd just save the settings as they are set. Of course, you could always use atexit, as osc suggested, to do what you were doing before.
Personally, I'd just save the settings as they are set. Of course, you could always use atexit, as osc suggested, to do what you were doing before.
It's not magic, it's Ruby.
Nayr Wrote:...because glut is a load of flying !$%@#.
... since when?
GLUT's very good at what it was designed for -- being a very quick and easy way to get an OpenGL program up and running.
For anything else (like, say, shipping a game), it's precisely what Nayr says it is
For anything else (like, say, shipping a game), it's precisely what Nayr says it is
GLUT is what GLUT is. It works perfectly for what it was designed for. Calling it a superlatively bad thing is not what it was designed for.
Personally, I think setting up your own custom OpenGL view is a learning experience. (BTW, if your using Cocoa, do the extra work and derive from NSView, not NSOpenGLView. You won't get true double buffering the other way). Anyway, ADC has some pretty good sample code for this sort of thing...
Nevada Wrote:Personally, I think setting up your own custom OpenGL view is a learning experience. (BTW, if your using Cocoa, do the extra work and derive from NSView, not NSOpenGLView. You won't get true double buffering the other way).Say wuh? What is `true' double buffering? NSOpenGLView has worked perfectly fine for me for years.
I think what Nevada is trying to say is that if you drag an NSOpenGLView in IB2, you can't get double buffering. However, that's not to say that NSOpenGLView is useless; dragging a custom view, making it an instance of a custom subclass of NSOpenGLView, works just fine.
Personally, these days, I prefer to avoid NSOpenGLView, however. I find that I don't want many of the things it does for me, and do want a bunch of stuff which is just as hard to add to NSOpenGLView as NSView, so there's no benefit.
Personally, these days, I prefer to avoid NSOpenGLView, however. I find that I don't want many of the things it does for me, and do want a bunch of stuff which is just as hard to add to NSOpenGLView as NSView, so there's no benefit.
OneSadCookie Wrote:I think what Nevada is trying to say is that if you drag an NSOpenGLView in IB2, you can't get double buffering. However, that's not to say that NSOpenGLView is useless; dragging a custom view, making it an instance of a custom subclass of NSOpenGLView, works just fine.Yeah, that's what I've always done. I haven't had any problems with it at all, and have not yet found a need to subclass directly from NSView.
The IB palette glView is junk. I'm not sure why they have it in there.
Eh, I just said screw it and went with NSView. I think in the long run I may need something that NSOpenGLView doesn't support. I just remember constantly trying to set up a pixel format for it, but consistently getting jitters.
Nevada Wrote:Eh, I just said screw it and went with NSView. I think in the long run I may need something that NSOpenGLView doesn't support. I just remember constantly trying to set up a pixel format for it, but consistently getting jitters.What do you mean by `jitters'? What were you using for your pixel format? Were you mistakenly trying to use NSOpenGLPFAStereo or something? If NSView is really better than NSOpenGLView performance-wise then that is *really* important! I am a bit surprised here that NSOpenGLView sounds like such a bad subclass of NSView to begin with. I am skeptical but I'll stop using it if there is something wrong with it. I have seen absolutely nothing wrong with it for years, and I have used it a LOT, so I am very curious about this.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| SDL and menu bar on OS X | A_SN_ | 9 | 8,177 |
Feb 7, 2012 11:51 AM Last Post: trailmix |
|
| Can't get menu bars to work. | XSTNX | 0 | 2,081 |
Jun 26, 2009 09:08 AM Last Post: XSTNX |
|
| OpenGL Menu engine? | BinarySpike | 4 | 6,830 |
Jun 11, 2007 09:43 PM Last Post: JeroMiya |
|
| Remove the File Menu from app | guvidu | 2 | 3,126 |
Mar 23, 2007 12:43 PM Last Post: PowerMacX |
|
| Enabling the "quit" menu function in an SDL program | ferum | 2 | 3,676 |
Sep 10, 2006 02:35 PM Last Post: PowerMacX |
|

