#### Archived

This topic is now archived and is closed to further replies.

# Matrices...

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

## Recommended Posts

Hi, i''m doing a 3d engine and i have some doubts about matrices, so...here we go!!! I''m using a 3x3 matrix to represent camera matrix and a CVector class to represent camera position. When i press the right key: If (keys[VK_RIGHT]) { camera.rotateY(1 * piover180); camera.yrot += 1.0; } The same happens with VK_LEFT but instead of positive values i use negative values. camera.rotateY(1 * piover180); constructs y rotation matrix and then multiplies it by the current matrix. So...the camera matrix is now facing the correct position but the camera isn''t until i use glRotatef(). I''m using the camera.rot to know how much i must rotate the scene with glRotatef(360.0 - camera.yrot, 0.0, 1.0, 0.0); Isn''t this information(how much the scene must be rotated) stored in the matrix ? If not, then i ask, i should use this matrix for what ? The movement system is working fine but i would like to know if i am doing it in the right way. Moving forward: if (keys[VK_UP]) { camera.position.x += sin(camera.yrot * piover180) * 0.05; camera.position.z += cos(camera.yrot * piover180) * 0.05; } The same happens with VK_DOWN but instead of += i use -=. So...my questions are: The matrix provides information to use in glRotatef(HERE, 0.0, 1.0, 0.0); ? If not, the matrix is used for what ? Thanks...

##### Share on other sites
Look up glMultMatrix on google.

Thanks Dobbs...

1. 1
Rutin
70
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633422
• Total Posts
3011804
• ### Who's Online (See full list)

There are no registered users currently online

×