🎉 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!

glRotate & glMultMatrix

Started by
1 comment, last by alistair b 23 years, 11 months ago
are the statements: float A=-k*0.531f, float m[] = { 1,0,0,0, 0,cos(A),-sin(A),0, 0,sin(A),cos(A),0, 0,0,0,1}; glMultMatrixf(m); and: glRotatef(-k*0.531f, 1.0f, 0.0f, 0.0f); (k is a counter ie k=1,2,3,4... equivalent?....i think they ought to produce the same result, but they don''t seem to....the one using glMultMatrixf() does rotate, but the speed is all wrong and the screen flickers. does it ignore glPush/glPop statements? alistair btw, i know the glMultMatrix method is slower, but i''ve got several transforms which i want to compress into a single matrix so i only use one gl() call
Advertisement
Hey Alistair,

I think the reason that you''re getting different results is that the function glRotate(..) takes the angle in degrees, but when you do it yourself, the sin() and cos() functions expect an angle in radians , so you need to multiply your angle (-k * 0.531f) by Pi/180 (or 180/Pi... I always get them confused).

I''m sure that if this is not the case, someone here will swiftly descend upon me with a spurious retort... pack of heartless bastards

-------------
squirrels are a remarkable source of protein...
thanks!...i can''t believe i was doing that!! (must have been more tired than i thought)

anyway, problem solved!

alistair

This topic is closed to new replies.

Advertisement