Multiply current Matrix with the stacked Matrix

Hi there is there anyway to multiply your current matrix with the one on the stack?

I’m testing out some object oriented coding with multiple cameras
So I have created a 3D world system
every object in it have global positions but local rotations
but to rotate every object locally before i draw them i have to first load an identity matrix then rotate then move it and then

somehow apply it with the camera-matrix that was pushed on the stack. I guess i could make every object store a local rotation matrix and multiply it with the camera-matrix or i hoped that opengl was smart enought to make a built in “multiply current matrix with top stacked matrix operation”, because this probly would be super efficiant rather than storing matrixes some other place.

so is there one?


glPushMatrix(); //push camera matrix on stack
    
    glLoadIdentity();               //creation of object matrix starts here
    glRotatef(rx,1.0f,0.0f,0.0f);   //apply local rotations
    glRotatef(ry,0.0f,1.0f,0.0f);  
    glRotatef(rz,0.0f,0.0f,1.0f);
    
    //space for my hoped matrix operation //merge camera matrix with object matrix
    
    glTranslatef(px,py,pz);         //apply global position
    
    glBegin(GL_LINES);
        glColor4f(1.0f,0.0f,0.0f,alpha);
        glVertex4f(+scale,0.0f,0.0f,alpha);
        glVertex4f(0.0f,0.0f,0.0f,alpha);

        glColor4f(0.0f,1.0f,0.0f,alpha);
        glVertex4f(0.0f,+scale,0.0f,alpha);
        glVertex4f(0.0f,0.0f,0.0f,alpha);

        glColor4f(0.0f,0.0f,1.0f,alpha);
        glVertex4f(0.0f,0.0f,+scale,alpha);
        glVertex4f(0.0f,0.0f,0.0f,alpha);
    glEnd();

glPopMatrix(); //pop camera matrix on the stack

Yes, there is glMultMatrixf.
Personally, I suggest that you don’t use these things as they are considered deprecated. Do your own matrix math or use a ready made library. Here is mine
http://www.geocities.com/vmelkon/glhlibrary.html

and some examples here
http://www.geocities.com/vmelkon/gl3_and_glh.html

No i dont understand how do you get/use the pushed matrix without using popmatrix? glMultMatrixf( PushedMatrix? )

If you want to get the matrix,
float mymatrix[16];
glGetFloatv(GL_MODELVIEW_MATRIX, mymatrix);

If you want to know how to use push and pop

glPushMatrix();
glMultMatrixf(…);
DrawObject();
glPopMatrix(); //for every push, there must be a pop

Alright so what you are saying is that my function that i’d like to exist doesnt exist. gotcha.