opengl perspective and orthogonal

Posted on 2008-06-18
Last Modified: 2013-12-21
By using the function
glortho( 0,0,maxX,maxY,0,maxZ) I can define the viewing volume in my viewport....
I have set the option in the user interface window  to select either ortho view or perspective view..... My coordinate axes x,y,z  lie at the lower left corner of the graphical window in orthographic view...

the problem is if the user selects the perspective view....the picture disappears and it is somewhere in the graphics window.....  and the coordinate axes comes to the center.....
glperspective(45, w/h,1.0, 12000);

is there anything I have  to improve the relation between ortho and perspective....

Thanking you

Question by:jsbsudha
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
LVL 53

Assisted Solution

Infinity08 earned 150 total points
ID: 21811673
>> and the coordinate axes comes to the center.....

If that's the only problem, you can simply do a translation ... no ?
LVL 20

Assisted Solution

ikework earned 150 total points
ID: 21813838
either do what i8 suggested or put the origin {0,0,0} in ortho-view as well in the center of the screen, this can be done by:

glortho( -width*0.5f, width*0.5f, height*0.5f, -height*0.5f, 0, maxZ)

LVL 20

Expert Comment

ID: 21813857
but anyway a good solution would be to give your client/customer a button in the gui to center the object(s) into the window .. otherwise they're gonna be frustrated very soon, searching for the object .. ;)
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 18

Accepted Solution

Jose Parrot earned 200 total points
ID: 21871928
Ortho is parallel projection, thus resulting in constant size of projected objects, regardless the distance between objects and the projection plane.

Perspective is conic projection, thus resulting in variable size of projected objects, dependent of distance between objects and the projection plane.
The figure compares the methods.

Althought obvious, the construction methods differences are reffered to suggest pre-sets such that the results are coherent in terms of projected sizes.

Probably the distance between objects and projection plane are large enough to make conic projection so small when compared to the parallel projection (where distance doesn't influentiate in the projection size). By adjusting proper distances, both methods can result in approximated similar sizes.

LVL 18

Expert Comment

by:Jose Parrot
ID: 21872023
About orign position.
As you have different positions of the orign (lower left for ortho and center for perspective), what you see in ortho is the upper right quadrant (just positive x's and y's) and in perspective, all the four quadrants.

Also, the combination of:
    distance object-viewport   +
    small viewport   +
    different orign positions
can produce what you describe. In the below figure, we notice that the blue object doesn't appear in the viewport (in red) when the method is perspective.
This can be your case.


Author Comment

ID: 21877375
thank you for explaining me clearly about the perspective and orthogonal....  I  would like to consider your answer..... Before that my application suddenly shows the runtime exception error...I am in urgent condition to solve the error......I am going to post that question now....

Author Comment

ID: 21996349
what is the solution for it?I want to make my perspective projection  to start from lower left my orthographic projection.....
LVL 53

Expert Comment

ID: 21996409
See the first few posts ;)

Author Comment

ID: 21996542
I don't want to move my orthographic view to center........
may be I can do translation but.........please wait

i willc ome again

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question