PDA

View Full Version : Creating menus in an opengl window???



Fyp2001
03-05-2001, 09:41 AM
Does anyone know how to create a menu such as file edit etc in an opengl window. i am not using glut i am using nehe tutorials. I know how to do it in vc++ but how in opengl. is it when you create you window and you pass a parameter. Any suggesstions are most welcome.
fyp2001

danoon
03-05-2001, 12:43 PM
You can't use Windows GDI functions in conjunction with OpenGL. You will have to draw your own menus.

Deiussum
03-05-2001, 04:27 PM
It definitely IS possible to use menus with OpenGL. I'm assuming you are using the Win32 API for menu creation since you said you used the Nehe tutorials. All you have to do is to create a menu resource, then use that id as a parameter to CreateWindow, and as the hMenu member of the WNDCLASS that you register. You then check for the WM_COMMAND message for menu commands, where the WPARAM
is the notification code and identifier of the menu option that generated the event.

So... if you have a file->new option that you gave the ID FILE_NEW, you could use something like this in the WM_COMMAND case of your message handler

switch(LOWORD(wParam))
{
case FILE_NEW:
// do whatever
blah;
}