+ {\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
+ else\r
+ {\r
+ /* close child window */\r
+ printf("close child window\n");\r
+ glutSetWindow(nWindow);\r
+ glutDestroyWindow(nChildWindow);\r
+ nChildWindow = -1;\r
+ bChildSizeDone = GL_FALSE;\r
+ bChildPosDone = GL_FALSE;\r
+ }\r
+ break;\r
+\r
+\r
+ default:\r
+ break;\r