Spinning the Minimap with the player?

So I made a minimap to go along with my game, I would like to rotate the map along with the Y axis camera rotation (around itself, not 0, 0). Here is my code.

private void miniMap() {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        Color c = Color.white;
        glColor4f(c.r, c.g, c.b, 0.5f);
        
        glPushMatrix();
        glTranslatef(-1, -1, -1);
        glRotatef(rotation.y - 90, 0, 0, 1);
        glTranslatef(1, 1, 1);
        
        

        glBegin(GL_QUADS);
        glVertex2i(10, 10);
        glVertex2i(210, 10);
        glVertex2i(210, 210);
        glVertex2i(10, 210);

        glEnd();
        glPopMatrix();
        glDisable(GL_BLEND);
    }

I realize that I should translate the quad, then rotate it, then translate it back, I do not see a change when I perform this.

Doesn’t glRotate() work?

glRotate rotates the camera in 3D space, whereas the the minimap is a 2D entity. I would like to spin the minimap around itself to correspond to the rotation of the player.

Well yes, you need to use glPushMatrix and glPopMatrix when drawing your minimap so you can modify its matrix and rotate it without moving your 3D camera. I suggest learning OpenGL first before venturing into 3D.

Point taken, though my problem is in 2D.

Yes. What opiop is saying is that you use glPushMatrix() before drawing your map. Then use glPopMatrix() after.

I know, I know the basic methods o openGL, just not completely where to implement them

Not related to the technical aspect,but I don’t think spinning the minimap is a good idea.
The minimap helps the player locating himself, like “I know the entrance I need is in the top left part of this area”. If you keep spinning the minimap, the player will lose the reference and the minimap will have no purpose other than showing things smaller.

In my opinion, if you’re making a radar or something like that, it might make sense to spin it. But not a minimap.

I agree with the guy above me, but if you want to rotate the minimap, rotate on the Z axis instead of the Y so your 2D map will move the same as the 3d map.

I don’t agree with you. Say you are at 0, 0, 0 and you go straight ahead, then your movements are in sync with those of the minimap. Now lets say you turn left and go straight. To the player, it seems you are moving straight, though the dot on the minimap will be going left.

I agree with you zFollette. I would almost always prefer a minimap that spins with the player. It helps me orient myself better and provides a direction in which I should go. But, why do you have to make the decision to spin or not? Just add an option :wink: