Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 8 of 8

Thread: Glut on x display

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2010
    Posts
    4

    Glut on x display

    Hi,
    I have a smal problem. I making aplication in to the CAVE. There is more than one display. I can make glut aplication that is in one display. But now I try to create aplikaction in to 2 display. I try this with putenv. But both of this windows are in first one. I think that is caused by glutInit. Firstly I call putenv("DISPLAY=:0.1"); which make first window on first display, but I supposed that putenv("DISPLAY=:0.0") make second window in to second display but it isnt . It is still in first display. I think that after I call glutinit, program will save display and all of other windows display here. But glutinit i call just once. So can anybody help me with this problem please ?
    Code :
    putenv("DISPLAY=:0.1"); //display 1
     
        glutInit(&argc, argv);
        //glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
     
        glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STEREO); //stereo vizual
     
        //glutInitWindowPosition(5, 5);
        //glutInitWindowSize(WIDTH, HEIGHT);
        glutInitWindowPosition(5, 5);
        glutInitWindowSize(600, 450);
     
     
        // window0
        /* Create main window and set callbacks. */
     
     
        int id_w1 = glutCreateWindow("vokno1");
     
        this->win = id_w1;
        windows[0] = id_w1;
        active_windows[0] = true;
     
        glutDisplayFunc(myDisplay);
        glutReshapeFunc(myReshape);
     
        glutIdleFunc(myIdle);
     
        /* Create main menu. */
        glutCreateMenu(myMenu);
        glutAddMenuEntry("Quit", 99);
     
        /* Menu will be invoked by the right mouse button */
        glutAttachMenu(GLUT_RIGHT_BUTTON);
     
     
     
        init();
     
        //wokno 2----
         glutInitWindowPosition(200, 5);
        glutInitWindowSize(600, 450);
     
        putenv("DISPLAY=:0.0"); //display 0
     
        int id_w2 = glutCreateWindow("vokno2");
        //this->win = id_w2;
        windows[1] = id_w2;
        active_windows[1] = true;
     
     
      glutDisplayFunc(myDisplay);
      glutReshapeFunc(myReshape);
     
      //glutIdleFunc(myIdle);
     
      //glutCreateMenu(myMenu);
      //glutAddMenuEntry("Quit w2", 1);
     
      //glutAddMenuEntry("hide w2", 7);
      //glutAddMenuEntry("show w2", 8);
     
      init();
     
     
        /* Run endless main loop to process events. */
        glutMainLoop();

    PS sorry for mistake my english is quite bad

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: Glut on x display

    AFAIK with separate X displays, each program is tied to only one screen which is determined at startup, so you would have to run 1 program per screen, and send message between programs for synchronization.

    Tools like Xinerama or RandR (or TwinView on Nvidia) will help, by considering all physical screens in a single large X virtual screen, avoiding the need for separate programs.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2010
    Posts
    4

    Re: Glut on x display

    thanks a lot,
    Xinerama looks good but can you help me how to use it ? I didnt find any source how to install just ftp://ftp.xfree86.org/pub/XFree86/4.0/ but it didnt work

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: Glut on x display

    It is often simpler to rely on your Linux distribution to handle this, than try to compile X by yourself.

    So, what distribution do use ?
    Which version ?
    Which video hardware ?
    Which graphic drivers ?
    Whats is the output of :
    glxinfo | head; glxinfo |grep OpenGL

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2010
    Posts
    4

    Re: Glut on x display

    ok just wait for a while. I must find out this information because that is school's server.

  6. #6
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,567

    Re: Glut on x display

    Quote Originally Posted by ZbuffeR
    AFAIK with separate X displays, each program is tied to only one screen which is determined at startup, so you would have to run 1 program per screen, and send message between programs for synchronization.
    You can do this in separate threads within the same program as well. In each thread, create separate connections to the X server pointing to different screens (e.g. :0.0, :0.1, :0.2, etc.), and create a GLX context in each to talk OpenGL to the X server:

    * http://www.equalizergraphics.com/doc....html#multigpu

    You could also jam these N X connections and N GLX contexts and associated drawing all in one thread as well, rendering to each serially, with the obvious loss in performance associated with doing embarrassingly parallel work in series.

    And of course, as ZbuffeR said, you could assign totally separate programs to render to each screen as well.

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2010
    Posts
    4

    Re: Glut on x display

    yea I was thinking about seperate threads but I dont know how can do this because create threads with technology such as Qt isnt my bussines

  8. #8
    Junior Member Regular Contributor
    Join Date
    Aug 2009
    Posts
    130

    Re: Glut on x display

    Surely you can create threads outside of Qt?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •