• ### What is your GameDev Story?

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

## Recommended Posts

Hi, I have read a lot of Tutorials in the Articles section and from NeHe. but I still don't get it when it comes to placement of rotations,translations and the loadIdentity line. for example, I have a car. -> only 4 wheels and a chassi. how do I have to place glRotation.translation loadidentity... can anyone help me with some Pseudocode, or a GL Guide for dummy-dummys ? Thanks Chris

##### Share on other sites
glLoadIdentity loads (or better: resets) the current matrix to its, oh well, identity. An identity matrix does absolutely nothing, that is no change or any kind of effect on your model.

Multiplying a point in the space by an identity matrix is identical to doing a multiplication by one.

3dPoint * identityMatrix = 3dPoint

same as, for exemple:

8 * 1 = 8 ;)

##### Share on other sites
Ah, ein Namensvetter ;)

You might want to check out this site
It explains what matrices are in general and how they are used in OpenGL.
The author tries to explain everything in easy words - maybe it helps you.

Greets,

Chris ;)

##### Share on other sites
In fact, your order is defined by the camera perspective you want to have:

for a first person view:

RenderCar
Transform@CarPosition
Rotate@CarRotation
RenderScene

for a third person view:

Translate@WishedDistance (in most games only z-)
Rotate@ViewingDirection
RenderCar
Transform@CarPosition
Rotate@CarRotation
RenderScene

Little notation: At these examples you can see very nice that you really don't move the object itself, you move the whole world around it!

for a bird camera view:

Translate@BirdPosition
Rotate@Earth (for example glRotatef(90, 1, 0, 0))
RenderScene
Transform@CarPosition
Rotate@CarRotation
RenderCar

if you want to make something like a hud, put this after EVERY pseudocode:

Switch@OrthoDrawMode
DrawHud (all parameters to glVertex2f etc are now in pixels!)
Switch@PerspectiveDrawMode

if you want to put some objects in your landscape (e.g trees) by using translate and rotate too, use the following for EACH object:

glPushMatrix;
Translate@ObjectPosition
Rotate@ObjectRotation
RenderObject
glPopMatrix;

I hope these examples helped you with your question
greets, KyRo1989

##### Share on other sites
Thanks KyRo1989.

I am going to print your answer and stick it to my monitor :)

##### Share on other sites
awww i'm sorry but i made a little mistake!

if you want to place your bird along the y-axis (e.g (0, 10, 0)), then you have to call rotate first!
to get the same result calling translate first, you have to move your bird in -z-axis to bring it higher. but then rotate -90, not 90!

greets KyRo1989

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 34
• 16
• 11
• 12
• ### Forum Statistics

• Total Topics
634123
• Total Posts
3015649
×