add menu to opengl 3 demo. Should work as menu windows have their own classic context
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1686 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
5051e40380
commit
693b4b8de8
@ -434,8 +434,12 @@ void keyboard(unsigned char key, int x, int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void samplemenu(int menuID)
|
||||||
|
{}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
int menuA;
|
||||||
glutInit(&argc, argv);
|
glutInit(&argc, argv);
|
||||||
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
|
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
|
||||||
/* add command line argument "classic" for a pre-3.x context */
|
/* add command line argument "classic" for a pre-3.x context */
|
||||||
@ -451,6 +455,15 @@ int main(int argc, char** argv)
|
|||||||
glutDisplayFunc(display);
|
glutDisplayFunc(display);
|
||||||
glutReshapeFunc(reshape);
|
glutReshapeFunc(reshape);
|
||||||
glutKeyboardFunc (keyboard);
|
glutKeyboardFunc (keyboard);
|
||||||
|
|
||||||
|
/* Add a menu. They have their own context and should thus work with forward compatible main windows too. */
|
||||||
|
menuA = glutCreateMenu(samplemenu);
|
||||||
|
glutAddMenuEntry("Sub menu A1 (01)",1);
|
||||||
|
glutAddMenuEntry("Sub menu A2 (02)",2);
|
||||||
|
glutAddMenuEntry("Sub menu A3 (03)",3);
|
||||||
|
glutSetMenu(menuA);
|
||||||
|
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||||
|
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user