Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Veranderlike

Pages: 1
1
I implemented the DesktopVR project in OpenGL but I'm having some issues getting the perspective projection to work right. The original Direct X app uses a method called Matrix.PerspectiveOffCenterLH to calculate the perspective matrix. The openGL equivalent method is glFrustrum (after switching to the projection matrix mode :P) wich accepts the same basic arguments (as dictated by parameter names anyway).  However it is painfully obvious that the way these two methods work is very different, and I'm having trouble finding documentation explaining the Matrix.PerspectiveOffCenterLH method in more detail (apart from: Builds a customized, left-handed perspective projection matrix.) I did find some resourses on the OpenGL method though : http://www.glprogramming.com/red/chapter03.html#name3

My linear algrebra is really horrible and if anyone has implemented this in openGL or can help explain how I might solve the problem I would be eternally greatful.

changing the original paramters from :
(nearPlane*(-.5f * screenAspect + headX)/headDist,nearPlane*(.5f * screenAspect + headX)/headDist, nearPlane*(-.5f - headY)/headDist,nearPlane*(.5f - headY)/headDist,nearPlane, 100);
to
(nearPlane*(-.5f * screenAspect + headX)*headDist,nearPlane*(.5f * screenAspect + headX)*headDist, nearPlane*(-.5f - headY)*headDist,nearPlane*(.5f - headY)*headDist,nearPlane, 100);

seemed to produce more accurate results but it still doesnt look as cool as it does in the video :P

Also, openGL provides another method called glPerspective(GLdouble fovy, GLdouble aspect,
GLdouble near, GLdouble far) but then I need to calculate the FOV parameter (more detail in the link I posted)

I also read a reply on another form where the following solution was suggested:

For lateral (X-Y) headtracking, you need to rmultiply the projection matrix with M=
1 0 X X*znear
0 1 Y Y*znear
0 0 1 0
0 0 0 1

(newP = oldP*M)

X Y being the head position, znear being the near clipping pane distance.

http://www.ogre3d.org/phpBB2/viewtopic.php?t=38030&postdays=0&postorder=asc&start=50&sid=5085e0cd34bb1c6c8ff88d508aa21631

But I had no luck implementing that either :(

Any help would be greatly appreciated!


Pages: 1