So far, I've used glPushMatrix() and glPopMatrix() to draw two or more objects with different transformations successfully. However, I now need to have a particular object move relative to another object... which, from what I'm gathering, means I need to use glPushMatrix() a second time before I've popped the previous matrix off the stack. In the OpenGL tutorials I've read, there is no parameter for glPopMatrix() which I believe I understand, it's just reverting to the Matrix that was on the stack at the time it was last Pushed.
The libnds version has a parameter for what number to pop down the stack. The question is... do I leave that "1" in this case? Like so:
Code: Select all
glPushMatrix();
//Rotate, Translate, Scale...
glCallList((u32*)object_bin);
glPushMatrix();
//Rotate, Translate, Scale...
glCallList((u32*)object2_bin);
glPopMatrix(1);
glPopMatrix(1);
This does, by the way, appear to be working as intended. The docs say "Pops num matrices off the stack," so I'm supposing now that I think about it, I could just use glPopMatrix(2) instead of calling it with 1 twice at the end?