PDA

View Full Version : Disable/Enable Perspective



gunsboy
03-24-2003, 06:24 AM
I am viewing some 3D objects. I need to be able to disable/enable the perspective view.

So if I have two objects that are the same size, and one is closer than the other one to the eye, both should look the same when perspective is disabled.


Figure1. No perspective
_______
/| /|
/_|____/ |
| |___|__|
| / | /
|/_____|/

Figure 2. With Perspective

________
/| |\
/ | | \
/ |______| \
/ / \ \
/___/_______ \___\
| / \ |
| / \ |
| / \ |
| / \ |
| / \ |
| / \ |
|/______________\|

gunsboy
03-24-2003, 06:27 AM
Figure1. No perspective
_______
****/|*****/|
***/_|____/*|
**|**|___|__|
**|*/****|*/
**|/_____|/

Figure 2. With Perspective

********________
*******/|******|\
******/*|******|*\
*****/**|______|**\
****/***/******\***\
***/___/_______*\___\
***|***/********\***|
***|***/********\***|
***|***/********\***|
***|***/********\***|
***|**/**********\**|
***|*/************\*|
***|/______________\

Mazy
03-24-2003, 06:30 AM
change the projection matrix
from projection to Orthographic (glOrtho)

gunsboy
03-24-2003, 10:00 AM
I'm not sure how to do that !!

The command I was using to set perspective was
gluPerspective(45,(double)sizeX / (double)sizeY, radius / 8, radius * 8);

I tired something like :

glOrtho(0, (double)sizeX, 0, (double)sizeY, radius / 8, radius * 8);

but did not work .. any suggestions ?



Originally posted by Mazy:
change the projection matrix
from projection to Orthographic (glOrtho)

nexusone
03-24-2003, 12:35 PM
Maybe you have to wrong order for the ortho view.

glOrtho( left, right, bottom, top, zNear, zFar )


glOrtho(0, (double)sizeX, (double)sizeY , 0 , radius / 8, radius * 8);


Also be more discriptive on what you mean by does not work?



Originally posted by gunsboy:
I'm not sure how to do that !!

The command I was using to set perspective was
gluPerspective(45,(double)sizeX / (double)sizeY, radius / 8, radius * 8);

I tired something like :

glOrtho(0, (double)sizeX, 0, (double)sizeY, radius / 8, radius * 8);

but did not work .. any suggestions ?