1
\$\begingroup\$

I have the following code:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPushMatrix();
glTranslatef(.03f * state, 0.0f, 0.0f);

state = 0;

glDrawArrays(GL_TRIANGLES, 0, LOC);

glPopMatrix();

I pop the matrix at the end so that I can apply a different transformation to a different part of the array. The problem is, when glPopMatrix() is present at the end of this code, the object drawn keeps wiggling instead of moving like its supposed to.

Note: State is set somewhere out of the loop and does not cause the draw function to stop working (as the function works without glPopMatrix()).

\$\endgroup\$
0
\$\begingroup\$

I can't comment, and you did not supply enough information. From what I can see though, state never changes, since you set it to 0 in the display loop. Thus, the object will not move.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.