Jump to content
  • Advertisement

Archived

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

yumbelie

Tutorial 09 - Moving Bitmaps in 3D Space Question

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
"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 this post


Link to post
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!