From my research I am thinking that we used to us glPushMatrix and glPopMatrix.
The (legacy) OpenGL matrix stack can be used to model the transformations and renderings of your objects as a scene graph traversal. glPushMatrix() saves the current state of the matrix of the current matrix mode, whereas glPopMatrix() restores it to where it was before the most recent call to glPushMatrix().
If you want to use the (legacy) OpenGL matrix stack, then:
glMatrixMode(GL_MODELVIEW);
// setup view/camera matrix
// ...
// visit one object (here the one that is rotated)
{
glPushMatrix();
glTranslatef(...); // <- translate object to its position
glRotatef(...); // <- rotate it
// issue draw call for first object (glDraw* or glBegin/glEnd)
glPopMatrix();
}
// visit the other object
{
glTranslatef(...); // <- translate the other object to its respective position
// issue draw call for first object (glDraw* or glBegin/glEnd)
glPopMatrix();
}
If you don't want to use the (legacy) OpenGL matrix stack, then you simply have to mimic the effect of those (legacy) OpenGL matrix stack functions, that is: Upload a modelview matrix with translation and rotation before drawing the first object, and upload a new modelview matrix with just translation before drawing the second object.
So, when we popped the stack with the unchanged matrix the model would not rotate too.
This sentence is too vague and unclear, what exactly you mean by that.
However, it just doesn't seem right to me.
What exactly do you mean by that? You have not provided any context/code to interpret this statement of yours: Do you mean that your approach works but you don't think it should and it does not "feel" right? Or does anything not work? And if not, what exactly does not work?
I have found a modern way to do this, but how do I not rotate the model?
It's also unclear what exactly you mean by "modern way" and what exactly you've found. Can you clarify?