Glut subwindow

Hello,

In my display routine I want to create a GLUT sub window for each "if " statement

I mean

If ………
{ create glut subwindow1 ;
………… ;
}

if ……….
{ create glut subwindow2 ;
………… ;
}

if ……….
{ create glut subwindow3 ;
………… ;
}

How can I do that ?

Thanks in advance for any help

Hi,
you nearly done that, it’s easy :

it’s useful to keep identifiers to those windows, so
make globals like :

int win1, win2, win3, win4;

then for each window paste code like :

win1= glutCreateSubWindow(mainWindow,startX,startY,sizeX,sizeY);
//of course, you need main window set up already, for ex
//glutInitWindowSize(mainWidth, mainHeight);
//glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH | etc.);
//mainWindow=glutCreateWindow(“YourMainWindow”);

glutDisplayFunc(win1disp);
//as this subwindow is now “selected” by glut you shall register win1disp procedure , which renders its contents
// --> this is just void win1disp() {…}
// you can also register more callbacks or menu for this window if you like

btw: there’s a simple example code for subwindows within glut distribution
(progs\examples\subwin.c)

[This message has been edited by tachyon_eagle (edited 02-16-2004).]

Thankx alot tachyon_eagle . It works with me in proper way . There is still one thing . How can I “kill” the subwindow because it still there even if the program doing something else ?

and I wonder where I can get the example you mnetioned ? I mean progs\examples\subwin.c

Thankx again.

glutDestroyWindow( int window);

Originally posted by glcrazy:
[b]
Thankx alot tachyon_eagle . It works with me in proper way . There is still one thing . How can I “kill” the subwindow because it still there even if the program doing something else ?

and I wonder where I can get the example you mnetioned ? I mean progs\examples\subwin.c

Thankx again.[/b]

Hello nexusone,

Thank you very much, I try to put this command, but I get unresolved error which stop the program.

As you see here ,
If ………
{ create glut subwindow1 ;
………… ;
}

if ……….
{ create glut subwindow2 ;
………… ;
}

if ……….
{ create glut subwindow3 ;
………… ;
}

I creat a sub window for each choice ( I mean each If statement ) and I was confuesed where to put “glutDestroyWindow( int window);” , Do I have to put it in each if statment or where exactly ?

Did you send the corrent window number to the command?
As for where to put it, not sure since I don’t know what you are trying to do.

Should be at a place after you have done something in that window and are ready to close it.

I don’t know where to put ‘glutDestroyWindow( int window);’ exactly nexusone. It works now but not in proper way . I will keep trying till I can find the correct solution.

Thank you always nexusone for your cooperative and help.

If you give more details as to what you are tying to do?

Like open a window for dialog and close it after the user responds?

I used each subwindow to render a part of the code … I’m demonstaring an image resolution as illustration tool for understanding the meaning of resolution . Each different ‘image’ (resolution) must be in seprate subwindow. Once the user chose what resolution he wants ( ‘if statments’ as shown in my past replies) a subwindow appears . When he choose another choice the subwindow must disappear and another subwindow comes out with his choice and so on .

I hope I clarified my work correctly.!

You need to track which window is active and then use that as part of your “if” logic for when the user clicks on the window.