Disable/Enable Perspective

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

    ________
   /|      |\
  / |      | \
 /  |______|  \
/   /      \   \

//____ _
| / \ |
| / \ |
| / \ |
| / \ |
| / \ |
| / \ |
|/
____________|

Figure1. No perspective
_______
/|*****/|
/|___/|
||_||
**|
/
|
/
**|/_____|/

Figure 2. With Perspective

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

change the projection matrix
from projection to Orthographic (glOrtho)

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)

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:
[b]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 ?

[/b]