X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2Fsubwin%2Fsubwin.c;h=0572873cb902fee714b597b1ba2d7a973aa9f464;hb=85fe5ac7b6efe580eab22820aa740a4b2dcafb0c;hp=df8ef627d54ea38bba6fd47ca45417c393891454;hpb=f60b402b55bc80ecadfb4a392b8f288a4e6aa356;p=freeglut diff --git a/progs/demos/subwin/subwin.c b/progs/demos/subwin/subwin.c index df8ef62..0572873 100644 --- a/progs/demos/subwin/subwin.c +++ b/progs/demos/subwin/subwin.c @@ -85,7 +85,7 @@ resize(int width, int height) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - //gluOrtho2D(0, width, 0, height); + /*gluOrtho2D(0, width, 0, height);*/ glMatrixMode(GL_MODELVIEW); glLoadIdentity() ; @@ -103,12 +103,18 @@ static void display(void) glDisable(GL_LIGHTING); glColor3d(0.1,0.1,0.4); - if (win == mainwin) { - shapesPrintf (2, 3, "Move The mounse into different windows"); - shapesPrintf (3, 3, "pressing keys will add to the string"); + if (win == mainwin) + { + shapesPrintf (2, 3, "Move The mouse into different windows"); + shapesPrintf (3, 3, "pressing keys will add to the string"); + shapesPrintf (5, 3, "Window: %d", win); + shapesPrintf (6, 3, "String: %s", strings[win]); + } + else + { + shapesPrintf (1, 3, "Window: %d", win); + shapesPrintf (2, 3, "String: %s", strings[win]); } - shapesPrintf (5, 3, "Window: %d", win); - shapesPrintf (6, 3, "String: %s", strings[win]); glutSwapBuffers(); } @@ -163,14 +169,14 @@ entry(int state) int main(int argc, char *argv[]) { - int winmax,sw1,sw2,i; + int winmax,sw1,sw2,sw2sw,i; glutInitWindowSize(640,480); glutInitWindowPosition(40,40); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE); - glutCreateWindow("OpenGLUT Sub Windows"); + glutCreateWindow("FreeGLUT Sub Windows"); glutReshapeFunc(resize); glutDisplayFunc(display); @@ -191,17 +197,26 @@ main(int argc, char *argv[]) glutKeyboardFunc(key); glutSpecialFunc(special); glutEntryFunc(entry); - glClearColor(0.7,0.7,0.7,1); + glClearColor(0.7f,0.7f,0.7f,1); winmax = sw1 > winmax ? sw1 : winmax; - sw2=glutCreateSubWindow(mainwin,328,240,314,236); + sw2=glutCreateSubWindow(mainwin,322,240,314,236); + glutReshapeFunc(resize); + glutDisplayFunc(display); + glutKeyboardFunc(key); + glutSpecialFunc(special); + glutEntryFunc(entry); + glClearColor(0.7f,0.7f,0.7f,1); + winmax = sw2 > winmax ? sw2 : winmax; + + sw2sw=glutCreateSubWindow(sw2,10,128,294,98); glutReshapeFunc(resize); glutDisplayFunc(display); glutKeyboardFunc(key); glutSpecialFunc(special); glutEntryFunc(entry); - glClearColor(0.7,0.7,0.7,1); - winmax = sw2 > winmax ? sw2 : winmax; + glClearColor(0.4f,0.4f,0.4f,1); + winmax = sw2sw > winmax ? sw2sw : winmax; strings = malloc(sizeof(char *)*(winmax+1)); for (i=0;i