glRotate & glMultMatrix
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
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...
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...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement