Game buttons
Which one should buttons in a game be, views or objects that draw to the main view's OpenGL context?
Generally speaking it is usually faster to draw your buttons yourself right in your main OpenGL view.
It is faster, but is it otherwise better?
What, is faster not better enough for you? 
Yes, you can draw them in their own views if you wish. One thing that is probably a negative is that if you're using OS supplied buttons, they don't usually look good with your game graphics, but that's up to your choice of aesthetic appeal. You'd be surprised how little details like that matter to customers. Sometimes you'll even get negative comments for things like that, unless it isn't too tacky.

Yes, you can draw them in their own views if you wish. One thing that is probably a negative is that if you're using OS supplied buttons, they don't usually look good with your game graphics, but that's up to your choice of aesthetic appeal. You'd be surprised how little details like that matter to customers. Sometimes you'll even get negative comments for things like that, unless it isn't too tacky.
When I do this to draw into an NSOpenGLView that is a button,
the whole main NSOpenGLView is cleared into 0, 0, 1, 0. Only this view should be cleared. How to solve this problem? (Is it that I manually call this drawRect method instead of letting the application do it?)
Code:
- (void)drawRect {
[self reshape];
glClearColor(0, 0, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glColor3f(5.0f, 0.0f, 1.0f);
glBegin(GL_POLYGON);
{
glVertex2f(INDENT, INDENT);
glVertex2f(size.width - INDENT, INDENT);
glVertex2f(size.width - INDENT, size.height - INDENT);
glVertex2f(INDENT, size.height - INDENT);
}
glEnd();
glPopMatrix();
}
Dude, if you're drawing your button using OpenGL, it makes no sense at all not to draw it into your main OpenGL view. I was thinking you were talking about using a system button or Quartz drawing into another NSView.
Just draw your game scene first, then draw your button scene on top of that in the same OpenGL view.
Just draw your game scene first, then draw your button scene on top of that in the same OpenGL view.
Thanks. However, could you explain the problem. Why is the clear function used for another OpenGL context?
My guess would be that you didn't make the button's glContext the active one before you started drawing to it.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Strange bug with yellow minimize buttons | GolfHacker | 21 | 8,888 |
Jun 20, 2007 05:15 PM Last Post: GolfHacker |
|
| GLUI buttons | eShad0w | 1 | 6,001 |
Jul 6, 2006 12:17 PM Last Post: Duane |
|
| textured windows/animated buttons | hyperzoanoid | 5 | 3,582 |
Jan 5, 2003 01:19 PM Last Post: hyperzoanoid |
|
| Receiving mouse clicks from different buttons | Tobi | 6 | 4,471 |
May 20, 2002 12:22 AM Last Post: Tobi |
|

