Solved

opengl perspective and orthogonal

Posted on 2008-06-18
9
2,797 Views
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


0
Comment
Question by:jsbsudha
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 53

Assisted Solution

by:Infinity08
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 ?
0
 
LVL 20

Assisted Solution

by:ikework
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)


ike
0
 
LVL 20

Expert Comment

by:ikework
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 .. ;)
0
 
LVL 18

Accepted Solution

by:
JoseParrot 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.

Jose
ortho-perspective.GIF
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 18

Expert Comment

by:JoseParrot
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.

Jose
ortho-perspective2.GIF
0
 

Author Comment

by:jsbsudha
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....
0
 

Author Comment

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

Expert Comment

by:Infinity08
ID: 21996409
See the first few posts ;)
0
 

Author Comment

by:jsbsudha
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Which best Pygame version for Python on OS X 10.9.5 ? 3 77
scoresClump  challenge 31 123
bunnyEars2 challenge 6 104
Any Fantasy Football Brute force AI suggestions? 2 43
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now