Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (590)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Spinning the Minimap with the player?  (Read 508 times)
0 Members and 1 Guest are viewing this topic.
Offline zFollette

Junior Devvie


Exp: 2 years


I like jokes


« Posted 2014-01-14 00:00:09 »

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.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
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.

Humor will keep you alive.
Offline Longarmx
« Reply #1 - Posted 2014-01-14 00:25:37 »

Doesn't glRotate() work?

Offline zFollette

Junior Devvie


Exp: 2 years


I like jokes


« Reply #2 - Posted 2014-01-14 00:28:37 »

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.

Humor will keep you alive.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline opiop65

JGO Kernel


Medals: 159
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #3 - Posted 2014-01-14 00:32:12 »

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.

Offline zFollette

Junior Devvie


Exp: 2 years


I like jokes


« Reply #4 - Posted 2014-01-14 00:44:27 »

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.

Humor will keep you alive.
Offline Longarmx
« Reply #5 - Posted 2014-01-14 03:29:41 »

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

Offline zFollette

Junior Devvie


Exp: 2 years


I like jokes


« Reply #6 - Posted 2014-01-14 11:41:35 »

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

Humor will keep you alive.
Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 4
Exp: 8 years



« Reply #7 - Posted 2014-01-14 11:46:16 »

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.

Offline RobinB

JGO Ninja


Medals: 44
Projects: 1
Exp: 3 years


Spacegame in progress


« Reply #8 - Posted 2014-01-14 11:49:27 »

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.
Offline zFollette

Junior Devvie


Exp: 2 years


I like jokes


« Reply #9 - Posted 2014-01-17 22:06:39 »

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 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.

Humor will keep you alive.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Longarmx
« Reply #10 - Posted 2014-01-17 22:11:12 »

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

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (34 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (66 views)
2014-11-07 19:57:14

TehJavaDev (70 views)
2014-11-03 22:04:50

BurntPizza (68 views)
2014-11-03 18:54:52

moogie (83 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!