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

Thread: Different Projections in same window

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2001
    Location
    India
    Posts
    17

    Different Projections in same window

    Hello,
    Can we apply different projections in same window.
    For eg. I have to draw an object with orthogonal projection and rest of the scene with perspective projection. Is it possible.
    How do I do it
    Thanks
    sur

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Different Projections in same window

    Of course it's possible. Just rebuild the projectionmatrix before drawing the different objects. Set an orthographic matrix before drawing the ortho-objects, and a perspective matrix before drawing the perspective-objects.
    Code :
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(...);
    DrawFirstObjects();
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glFrustum(...); // or gluPerspective(...);
    DrawSecondObjects();

  3. #3
    Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Dunblane, Scotland
    Posts
    353

    Re: Different Projections in same window

    If you want the ortho. and perp. stuff to be in a seperate quadrant to make an editor or such like also change the viewport (glViewport) and use a stencil test to the same area to stop commands like glClear effect the whole screen and not just the viewport. I have some code if you want.(email me if you want)
    Reality is for idiots only the best over come it!

Posting Permissions

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