satya

04-21-2004, 07:47 PM

Hello,

OpenGL has an api glOrtho to set the Ortho, is there an api or some way to get the Ortho?

TIA

satya

OpenGL has an api glOrtho to set the Ortho, is there an api or some way to get the Ortho?

TIA

satya

View Full Version : getting the Ortho

satya

04-21-2004, 07:47 PM

Hello,

OpenGL has an api glOrtho to set the Ortho, is there an api or some way to get the Ortho?

TIA

satya

OpenGL has an api glOrtho to set the Ortho, is there an api or some way to get the Ortho?

TIA

satya

plasmonster

04-21-2004, 08:34 PM

I'm not sure I understand your question; you want to get/use glOrtho(...)? This function is part of the gl core, so you should already have it.

jwatte

04-21-2004, 08:38 PM

glOrtho() does not "set the Ortho".

glOrtho() multiplies whichever matrix happens to be the current matrix target, with a specific matrix, defined in the specification (you can read about it in the red book). It just so happens that, if the current matrix is the projection matrix, and the projection matrix is the identity matrix, then multiplying that specific matrix into the projection matrix makes for an orthographic projection.

If you want to take an arbitrary projection matrix and extract coordinates suitable for glOrtho() from it, then that's not generally solvable, because the matrix may or may not be an orthographic projection matrix. If you KNOW that it's an orthographic projection matrix (can be mostly found out by ensuring elements 12, 13, 14, 21, 23, 24, 31 and 32 and 34 are all zero) then you can just look at the defined Ortho matrix formula in the red book, and solve for the input arguments. That's basic algebra.

glOrtho() multiplies whichever matrix happens to be the current matrix target, with a specific matrix, defined in the specification (you can read about it in the red book). It just so happens that, if the current matrix is the projection matrix, and the projection matrix is the identity matrix, then multiplying that specific matrix into the projection matrix makes for an orthographic projection.

If you want to take an arbitrary projection matrix and extract coordinates suitable for glOrtho() from it, then that's not generally solvable, because the matrix may or may not be an orthographic projection matrix. If you KNOW that it's an orthographic projection matrix (can be mostly found out by ensuring elements 12, 13, 14, 21, 23, 24, 31 and 32 and 34 are all zero) then you can just look at the defined Ortho matrix formula in the red book, and solve for the input arguments. That's basic algebra.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.