Advertisement

about lesson 4

Started by August 21, 2000 11:46 PM
3 comments, last by Wyglif 24 years, 5 months ago
The rotation variables for the triangle and square in lesson 4: rtri+=0.2f; rquad-=0.15f; I didnt find any code that set them back to 0 when they reach 360 or -360. How is it that it continues to rotate properly?
They continue to rotate properly because all of the trig functions repeat themselves. sin(10) == sin(370) == sin(730) and so on. And I wouldn''t be surprised if OpenGL (you''re talking about NeHe''s stuff, right?) automatically wraps whatever you give it.
Advertisement
quote:
They continue to rotate properly because all of the trig functions repeat themselves. sin(10) == sin(370) == sin(730) and so on.


wrong, because the trig functions accept parameters in radians
but yeah thats how it works
when it overlaps it just starts over again
Oh, so the call to glRotatef(rquad,1.0f,0.0f,0.0f); would loop rquad back to 0 if needed?
Well, yeah. All standard C functions assume all arguments are in radians, but OpenGL wants everything in degrees.

This topic is closed to new replies.

Advertisement