From: <dc...@us...> - 2014-06-01 03:50:55
|
Revision: 1686 http://sourceforge.net/p/freeglut/code/1686 Author: dcnieho Date: 2014-06-01 03:50:51 +0000 (Sun, 01 Jun 2014) Log Message: ----------- add menu to opengl 3 demo. Should work as menu windows have their own classic context Modified Paths: -------------- trunk/freeglut/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c Modified: trunk/freeglut/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c =================================================================== --- trunk/freeglut/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c 2014-05-31 22:47:17 UTC (rev 1685) +++ trunk/freeglut/freeglut/progs/demos/smooth_opengl3/smooth_opengl3.c 2014-06-01 03:50:51 UTC (rev 1686) @@ -434,8 +434,12 @@ } } +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 @@ 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; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |