- glutReshapeWindow(300,300);\r
- }\r
- else if (cChar=='m')\r
- {\r
- printf("main window position\n");\r
-\r
- /* The window position you request is the outer top-left of the window,\r
- * the client area is at a different position if the window has borders\r
- * and/or a title bar.\r
- */\r
- if (nPosX<400)\r
- glutPositionWindow(600,300);\r
+ {\r
+ printf("main window resize\n");\r
+ if (nWidth<400)\r
+ glutReshapeWindow(600,300);\r
+ else\r
+ glutReshapeWindow(300,300);\r
+ }\r
+\r
+ break;\r
+\r
+\r
+ case 'm':\r
+ case 'M':\r
+ if (nChildWindow!=-1)\r
+ {\r
+ glutSetWindow(nChildWindow);\r
+\r
+ /* The window position you request is relative to the top-left\r
+ * corner of the client area of the parent window.\r
+ */\r
+ if (!bChildPosDone)\r
+ glutPositionWindow(glutGet(GLUT_WINDOW_X)+50,glutGet(GLUT_WINDOW_Y)+50);\r
+ else\r
+ glutPositionWindow(glutGet(GLUT_WINDOW_X)-50,glutGet(GLUT_WINDOW_Y)-50);\r
+ bChildPosDone = !bChildPosDone;\r
+ }\r
+ else\r
+ {\r
+ printf("main window position\n");\r
+\r
+ /* The window position you request is the outer top-left of the window,\r
+ * the client area is at a different position if the window has borders\r
+ * and/or a title bar.\r
+ */\r
+ if (nPosX<400)\r
+ glutPositionWindow(600,300);\r
+ else\r
+ glutPositionWindow(300,300);\r
+ }\r
+\r
+ break;\r
+\r
+\r
+ case 'c':\r
+ case 'C':\r
+ if (nChildWindow==-1)\r
+ {\r
+ /* open child window */\r
+ printf("open child window\n");\r
+ nWidth = glutGet(GLUT_WINDOW_WIDTH);\r
+ nHeight = glutGet(GLUT_WINDOW_HEIGHT);\r
+\r
+ nChildWindow = glutCreateSubWindow(nWindow,(int)(nWidth*.35),(int)(nHeight*.35),(int)(nWidth*.3),(int)(nHeight*.3));\r
+ glutKeyboardFunc( SampleKeyboard );\r
+ glutDisplayFunc( Redisplay );\r
+ glutReshapeFunc( Reshape );\r
+ }\r