From 693b4b8de896f4fcc2310715dab115f5ca0d433d Mon Sep 17 00:00:00 2001 From: dcnieho Date: Sun, 1 Jun 2014 03:50:51 +0000 Subject: [PATCH] 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 --- .../progs/demos/smooth_opengl3/smooth_opengl3.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/freeglut/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c b/freeglut/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c index 3d8e279..93e708d 100755 --- a/freeglut/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c +++ b/freeglut/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c @@ -434,8 +434,12 @@ void keyboard(unsigned char key, int x, int y) } } +void samplemenu(int menuID) +{} + int main(int argc, char** argv) { + int menuA; glutInit(&argc, argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); /* add command line argument "classic" for a pre-3.x context */ @@ -451,6 +455,15 @@ int main(int argc, char** argv) glutDisplayFunc(display); glutReshapeFunc(reshape); 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(); return 0; }