views:

19

answers:

1

The FreeGLUT API has several functions for window management:

int  glutCreateWindow(const char * title );
int  glutCreateSubWindow(int window, int x, int y, int width, int height);
void glutDestroyWindow(int window);
void glutSetWindow(int window);
int  glutGetWindow(void);
void glutSetWindowTitle(const char* title);
void glutSetIconTitle(const char* title);
void glutReshapeWindow(int width, int height);
void glutPositionWindow(int x, int y);

I'm completely new to this. How would I go about creating four windows, with unique titles and positions? It seems that once a second window has been created with glutCreateWindow(), there is no way to access the first one again.

So far, I can create a single window with glutCreateWindow("window 1");, then reshape and reposition it with glutReshapeWindow(width, height) and glutPositionWindow(x, y), but I'm at a loss as to how to manage several windows simultaneously.

I'm running MinGW/MSYS on Windows XP, if that helps.

+1  A: 

Each time you create a window with glutCreateWindow it returns the window ID of the new window. You can store this in a variable and use this to access the window later via glutSetWindow.

Also note that you would normally set the display function for a window just after creating it.

RD1
Ah, that makes sense. I was under the impression that the return value was an error code, not a reference to the window. Thank you! `:)`
e.James