Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7590659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:27:36+00:00 2026-05-30T20:27:36+00:00

I am messing around in a program that performs all rendering using a matrix

  • 0

I am messing around in a program that performs all rendering using a matrix set by gluOrtho2D(). What I would like to do is to rotate a specific texture around the y-axis (0,1,0) so that it looks like the original matrix was provided by gluPerspective() instead. I realize that this is not possible with an orthographic projection matrix and that I will have to set up a new perspective projection matrix. I want the textures I draw to look exactly the same as when drawn with the orthographic matrix, except sometimes when I have rotated them around the y-axis.

So to summarize:
How do I find a perspective projection matrix that is equivalent to a given orthographic matrix when shapes are drawn in the xy-plane, but gives me perspective when not in the xy-plane?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:27:37+00:00Added an answer on May 30, 2026 at 8:27 pm

    Basically what I understand is: You want to have a perspective matrix that yields the same image as the orthographic projection, when the object lies in the XY-Plane.

    So lets begin:
    You want to draw your plane in the XY-plane and you had gluOrtho2D(-w, w, -h, h); (asymmetric orthographic projection is a bit harder, if you need it, then say so).
    What you need to do now is:

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(2 * atan(h / 2)  * 180.0 / PI, w / h, 1, 3);
    
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(0, 0, -2);
    

    What I have done here is matching the center of the projective view frustum on the section of the XY-plane that was visible in the orthographic projection.

    Take the graphs of the projection frustums and some math and you can do this yourself 🙂


    Just as a reminder I will leave my answer to the old question here.

    Either you have ortho or perspective projection. You have to decide for one.
    You will not gain perspective by rotating on any axis.

    Why would you have to change a whole program just to change the projection mode?

    One possible solution:
    I assume the old GL with different matrix modes and so on:

    glMatrixMode(GL_PROJECTION); //switch to projection matrix mode
    glPushMatrix(); //push the old matrix
    glLoadIdentity();
    //apply the perspective projection
    //do your rendering
    glPopMatrix(); //pop the old matrix
    

    With the newer GL scheme you will have to do most of this on your own but it should be easy though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's a .net program for students that I've been messing around with in Reflector
I'm messing around with SDL, and I decided to make a program that opens
I am messing around with Doctrine (version 1.0.3) to see if would make a
I'm messing around with some C code using floats, and I'm getting 1.#INF00, -1.#IND00
I'm currently messing around in FORTRAN 77 and I've ran into a problem that
I'm messing around with multidimensional arrays and pointers. I've been looking at a program
I'm messing around with a program to track my internet browsing habits and I'm
Messing around with 'extension functions' for the List module. (I spent quite a while
I am messing around with a toy interpreter in Java and I was considering
I was messing around with RhinoMocks this morning and couldn't run my tests because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.