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 2 of 2

Thread: opengl mdi, qt, and viewport

  1. #1
    Junior Member Regular Contributor
    Join Date
    Apr 2010
    Posts
    110

    opengl mdi, qt, and viewport

    hello.
    I modified a 3d engine for the qt library, i have inserted a opengl scene in a simple widget.
    The problem is that i have try to create a mdi opengl application, then i can have more than one viewport with inside a different opengl scene.
    The engine(wild magic5) is built for only one viewport.
    Now if i try to create more than one subwindow ,only the lastest have a correct visualization.
    The other windows are black and draw nothing.
    How i can create multiple vieport in opengl?
    I think to call glviewport(x,x,x,x) in the render function on the widget, but i have a doubt:
    now all viewport coordinates are 0,0,100,100 , but i have access to mdisubwindow object from the render function, but what coordinates i must use? how i can do?
    thanks.

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: opengl mdi, qt, and viewport

    It is explained here in the case of Windows
    http://www.opengl.org/wiki/Platform_...ltiple_Windows

    If you are on another OS, such as *nix, then the function is
    http://www.opengl.org/wiki/Platform_...ows#glX_vs_wgl

    I don't know about QT but perhaps it has its own function call that wraps on wgl or glX or whatever.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Posting Permissions

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