Results 1 to 3 of 3

Thread: Different Projections in same window

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2002
    Posts
    20

    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
    2,978

    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
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Dunblane, Scotland
    Posts
    333

    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!

Similar Threads

  1. projections
    By mikethebike in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 01-11-2012, 06:10 PM
  2. Having problems with projections
    By profbalse in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 09-15-2003, 02:52 PM
  3. projections
    By karteek in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-01-2003, 01:47 PM
  4. custom projections
    By zen in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 12-15-2002, 10:32 PM
  5. Mixed projections
    By martinjy in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-21-2001, 12:31 PM

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