#### Archived

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

# Tutorial 09 - Moving Bitmaps in 3D Space Question

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

## Recommended Posts

Hiya, I have a question regarding a small part of this tutorial which I do not fully understand. The bit in question is where you ''rotate'' the scene. Now, I''m fairly new to OpenGL and C Programming in general, but up till now I''ve fully understood everything. What vexes me is this: We create a for loop, then we reset the scene - so the cartesian co-ordinates are in the centre of the screen (right?), now it says we rotate the view,so what exactly are we rotating ? I mean, why not just have glRotatef( tilt, 1.0f, 0.0f, 0.0f) outside the loop? I don''t understand why it is tilting hte view each time it draws a star? if you see what I mean. The whole bit is confusing, and tho the provided explanation is good, I''m still slightly unsure - Many thanks for your help Yumbelie

##### Share on other sites
"it''s all relative"

The scence is relative to some cooridante system.

For example:
vertex (x,y,z) is the position of some static object in the world. In the way openGL works, that vertex will not have to change!

rather than changing the numbers we just rotate the whole coordinate system(matrix.) It really makes everything easier.

##### Share on other sites
Right, okay, I understand the purpose of that statment now, as I understand it because you have reset the view with glLoadIdentity() you now need to reposition the ''camera'' above the bitmaps so you can see them, now however I need someone to explain what the 4 lines below do (in really really simple terms for retards ))

glRotatef( star[loop].angle, 0.0f, 1.0f, 0.0f);
glTranslatef(star[loop].dist, 0.0f, 0.0f);

glRotatef(-star[loop].angle, 0.0f, 1.0f, 0.0f);
glRotatef(-tilt, 1.0f, 0.0f, 0.0f);

According to the tutorial the first two rotate the scene, and the second two cancel the rotations...But I don''t understand why, and whats going on properly. I''ve tried removing the statments and observing there affect on the drawn scene but I''m not really much clearer. If someone can spell out whats happening so I can hammer it thru me thick head be much appericated; ))

Thanks again

yumbelie

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 12
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633723
• Total Posts
3013545
×