Perspective <> Orthographic Toggle

sgt_pinky

Well-known member
Joined
Jan 5, 2005
Messages
80
Location
Melbourne, Australia
Hi,

I just have a basic View Mesh application, so that you can view a mesh, rotate it, etc.

I want to have a check box that allows me to turn off perspective, but I cant get the projection to work.

At the moment I have:

Code:
dRender.Transform.Projection = Matrix.PerspectiveFovRH(CSng(Math.PI) / 4, fAspect, objectRadius / 64.0F, objectRadius * 200.0F)

I have tried Matrix.OrthoRH, but without any success. Any suggestions?

Cheers,

Pinky

Edit: Ok, I managed to get the projection to work with:

Code:
dRender.Transform.Projection = Matrix.OrthoRH(fTarget.Width, fTarget.Height, objectRadius / 64.0F, objectRadius * 200.0F)

I am just using the arcBall provided in the SDK to rotate the mesh. I am having trouble zooming now, in Orthographic projection. It just changes the zplane, and ends up cutting the mesh in half.

This is how I set my View Matrix:

Code:
Dim vFrom As New Vector3(0, 0, 3 * objectRadius)
Dim vAt As New Vector3(0, 0, 0)
Dim vUp As New Vector3(0, 1, 0)
dRender.Transform.View = Matrix.LookAtRH(vFrom, vAt, vUp)

That works fine for Perspective, but not Orthographic.
 
Last edited by a moderator:
Back
Top