Site Stability Read more... ×

# OpenGL D3DXMatrixLookAtLH

This topic is 5176 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

With OpenGL you are free to choose between using gluLookAt and making your own camera manipulation system. Can you do the same thing with DX and D3DXMatrixLookAtLH function? Thanks in advance.

##### Share on other sites
You can use any method you like D3DXMatrixLookAtLH is just a helper function. You can fill the view matrix yourself.

##### Share on other sites
Yes.

You might notice that D3DXMatrixLookAtLH returns a matrix. In D3D, you compute the transformation matrices yourself (usually using D3DX) and hand them to the renderer. In D3D, there is a separate "view" matrix (as opposed to the "model-view" matrix in OpenGL) that is set by the camera.

##### Share on other sites
Hi there Calin,
How are you doing?

[The Problem]
Building your own camera manipulation system

[The Solution]
You certainly may, if I understand correctly you want to be able to manipulate it using your own methods such as specifying the position, which direction the camera is facing and the up vector (which way is up?).

The D3DX classes are mostly helper classes, you may choose to build the view matrix yourself.

Here are some resources on building 3rd person camera's :)

ToyMaker's Camera in Direct3D
Game Tutorial's 3rd Person camera in OpenGL
A Simple Third-Person Camera

I hope this helps, take care buddy.

##### Share on other sites
This might be useful, it shows the row make up of the camera matrix, sorry for the layout of it:

Row 1
Right.x
Up.x
Look.x
0.0f

Row 2
Right.y
Up.y
Look.y
0.0f

Row 3
Right.z
Up.z
Look.z
0.0f

Row 4
-position.right
-position.up
-position.look
1.0f

Note that the dot in row 4 is dot product

##### Share on other sites
I find it easier to treat the camera just like any other object. Create your matrix from the camera's position and rotation, invert it, and set it to the device's View matrix.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 11
• 15
• 21
• 26
• 11