From: Diederick Niehorster Date: Sun, 1 Jun 2014 03:50:51 +0000 (+0000) Subject: add menu to opengl 3 demo. Should work as menu windows have their own classic context X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=c9c91332b9c0908c943cc10fa5ad073df6f3434e;p=freeglut add menu to opengl 3 demo. Should work as menu windows have their own classic context git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1686 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/progs/demos/smooth_opengl3/smooth_opengl3.c b/progs/demos/smooth_opengl3/smooth_opengl3.c index 3d8e279..93e708d 100755 --- a/progs/demos/smooth_opengl3/smooth_opengl3.c +++ b/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; }