Results 1 to 10 of 10

Thread: Glut subwindow

  1. #1

    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

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2004
    Location
    Czech Republic
    Posts
    10

    Re: Glut subwindow

    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).]

  3. #3

    Re: Glut subwindow

    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.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Glut subwindow

    glutDestroyWindow( int window);


    Originally posted by glcrazy:

    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.

  5. #5

    Re: Glut subwindow

    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 ?

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Glut subwindow

    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.

  7. #7

    Re: Glut subwindow

    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.

  8. #8
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Glut subwindow

    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?

  9. #9

    Re: Glut subwindow

    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.!

  10. #10
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Glut subwindow

    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.

Similar Threads

  1. glut subwindow prevents shader from working
    By carla_sch in forum OpenGL: General
    Replies: 5
    Last Post: 05-20-2017, 03:04 PM
  2. GLUT: transparent subwindow?
    By Hornet86 in forum OpenGL: General
    Replies: 1
    Last Post: 10-07-2009, 06:32 AM
  3. glut subwindow problem
    By Beau in forum OpenGL: General
    Replies: 1
    Last Post: 02-26-2007, 03:20 AM
  4. creating a window and a subwindow with glut
    By dvm in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-04-2004, 05:33 AM
  5. how can i close an open subwindow in glut?
    By pavelk in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-03-2002, 08:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean