I'm writing a little program for a class first it's supposed to create a triangle and have it rotate on it's y axis, then draw another triangle 3 spaces over and have it rotate on it's x axis, both in place. I can get both of them to spin correctly, the first spins in place on the y like it's supposed to, and the second spins on it's x axis but it also orbiting around the first object as it's spinning on it's axis.
my code is like this:
glRotatef(rotate, 0.0f, 1.0f, 0.0f);
glTranslate(0.0f, -0.5f, 0.0f);
triangle.draw();
glRotate(rotate, 1.0f, 0.0f, 0.0f);
glTranslate(rotate, 3.0f, 0.0f, 0.0f);
triangle.draw();
do i need to do a pushmatrix and popmatrix for each triangle object? or what am I doing wrong?
my code is like this:
glRotatef(rotate, 0.0f, 1.0f, 0.0f);
glTranslate(0.0f, -0.5f, 0.0f);
triangle.draw();
glRotate(rotate, 1.0f, 0.0f, 0.0f);
glTranslate(rotate, 3.0f, 0.0f, 0.0f);
triangle.draw();
do i need to do a pushmatrix and popmatrix for each triangle object? or what am I doing wrong?
