🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

tutorial 9 help

Started by
1 comment, last by SCRUB 23 years, 11 months ago
having problems folling this part , and as to what it EXACTLY does and why he does it . glLoadIdentity(); // Reset The View Before We Draw Each Star glTranslatef(0.0f,0.0f,zoom); // Zoom Into The Screen (Using The Value In ''zoom'') glRotatef(tilt,1.0f,0.0f,0.0f); // Tilt The View (Using The Value In ''tilt'') glRotatef(star[loop].angle,0.0f,1.0f,0.0f); // Rotate To The Current Stars Angle glTranslatef(star[loop].dist,0.0f,0.0f); // Move Forward On The X Plane glRotatef(-star[loop].angle,0.0f,1.0f,0.0f); // Cancel The Current Stars Angle glRotatef(-tilt,1.0f,0.0f,0.0f); // Cancel The Screen Tilt can you help its driving me nuts , especial how it moves the stars about in that formation !!! . thanks el_scrub
LE SCRUB
Advertisement
what dont u understand though ive gotta admit that looks bad programming whatever its trying to do. it should do a push pop
What I dont get is what It exactly does and why

1. glLoadIdentity(); ... resets the matrix ...grand everythings back at (0,0,0)

2. glTranslatef(0.0f,0.0f,zoom); .. zooms in (grand) .

3 . glRotatef(tilt,1.0f,0.0f,0.0f);

rotates axis around so instead of +z going towards you
you now have +x

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

rotates the star up (?) _angle_ ammount .

5 . glTranslatef(star[loop].dist,0.0f,0.0f);

ok so now the origin is here .

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

so you un-rotate with a new origin (this all seems a bit random)
straightening it

7. glRotatef(-tilt,1.0f,0.0f,0.0f); // Cancel The Screen Tilt

then make it face the screen .


It just seems as if im missing out on something that explains its behaviour as to how it uniformly curls around . Im probably making a real mess of interperting the code , but thats why im here .


thanks again

scrub
LE SCRUB

This topic is closed to new replies.

Advertisement