subwin demo now has a grandchild (subwin in subwin) for testing

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1509 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-02-26 16:14:41 +00:00
parent 3b5f3573a1
commit 5fa61c0c64

View File

@ -103,12 +103,18 @@ static void display(void)
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
glColor3d(0.1,0.1,0.4); glColor3d(0.1,0.1,0.4);
if (win == mainwin) { if (win == mainwin)
{
shapesPrintf (2, 3, "Move The mouse into different windows"); shapesPrintf (2, 3, "Move The mouse into different windows");
shapesPrintf (3, 3, "pressing keys will add to the string"); shapesPrintf (3, 3, "pressing keys will add to the string");
}
shapesPrintf (5, 3, "Window: %d", win); shapesPrintf (5, 3, "Window: %d", win);
shapesPrintf (6, 3, "String: %s", strings[win]); shapesPrintf (6, 3, "String: %s", strings[win]);
}
else
{
shapesPrintf (1, 3, "Window: %d", win);
shapesPrintf (2, 3, "String: %s", strings[win]);
}
glutSwapBuffers(); glutSwapBuffers();
} }
@ -163,7 +169,7 @@ entry(int state)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int winmax,sw1,sw2,i; int winmax,sw1,sw2,sw2sw,i;
glutInitWindowSize(640,480); glutInitWindowSize(640,480);
glutInitWindowPosition(40,40); glutInitWindowPosition(40,40);
@ -203,6 +209,15 @@ main(int argc, char *argv[])
glClearColor(0.7f,0.7f,0.7f,1); glClearColor(0.7f,0.7f,0.7f,1);
winmax = sw2 > winmax ? sw2 : winmax; winmax = sw2 > winmax ? sw2 : winmax;
sw2sw=glutCreateSubWindow(sw2,10,128,294,98);
glutReshapeFunc(resize);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutEntryFunc(entry);
glClearColor(0.4f,0.4f,0.4f,1);
winmax = sw2sw > winmax ? sw2sw : winmax;
strings = malloc(sizeof(char *)*(winmax+1)); strings = malloc(sizeof(char *)*(winmax+1));
for (i=0;i<winmax+1;i++) { for (i=0;i<winmax+1;i++) {
strings[i] = malloc(sizeof(char)*MAXSTR+1); strings[i] = malloc(sizeof(char)*MAXSTR+1);