Skip to main content
gamedev.net
🔒 Locked

Z-Axis

Started by HyprLogik 1 reply 550+ views
Original Post
HyprLogik
HyprLogik
As stated in the Red Book: Example 3-4 draws an automobile, assuming the existence of routines that draw the car body, a wheel, and a bolt. Example 3-4 : Pushing and Popping the Matrix draw_wheel_and_bolts() { long i; draw_wheel(); for(i=0;i<5;i++){ glPushMatrix(); glRotatef(72.0*i,0.0,0.0,1.0); glTranslatef(3.0,0.0,0.0); draw_bolt(); glPopMatrix(); } } draw_body_and_wheel_and_bolts() { draw_car_body(); glPushMatrix(); glTranslatef(40,0,30); /*move to first wheel position*/ draw_wheel_and_bolts(); glPopMatrix(); glPushMatrix(); glTranslatef(40,0,-30); /*move to 2nd wheel position*/ draw_wheel_and_bolts(); glPopMatrix(); ... /*draw last two wheels similarly*/ } This code assumes the wheel and bolt axes are coincident with the z-axis... How would you make the wheel and bolt axes coincident with the z-axis? Using glLoadIdentity()? Not too sure about that one, because wouldn''t glLoadIdentity() simply move back to the point 0,0 making the wheel completely out of place? Thanx.
|-|A[k3R$Z R //|-|AT |V|Ak3 t|-|3 //0R|D g0 R0||||D!!
HyprLogik
HyprLogik
well?
|-|A[k3R$Z R //|-|AT |V|Ak3 t|-|3 //0R|D g0 R0||||D!!
HyprLogik
HyprLogik
please help!!!!!!!111
|-|A[k3R$Z R //|-|AT |V|Ak3 t|-|3 //0R|D g0 R0||||D!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.