switching projection modes

Posts: 45
Joined: 2002.04
Post: #1
ok, so I have a menu system setup when my game initially starts, and from that I want to change over to my game view.

My menus use a 2D view (gluOrtho2D) and I want to switch to a perspective view for my game... (gluPerspective).

I am using GLUT, so I have entirely separate callbacks for each, menus and game..

all I get is a black screen when I switch over..

this is my setup:

    gluPerspective(45, 4.0 / 3.0, 1, 1000);
    gluLookAt(0.0, 5.0, -5.0,  0.0, 0.0, 0.0,  0.0, 1.0, 0.0);

my draw callback function looks like this:

        glVertex3f(0.0, 0.0, 0.0);
        glVertex3f(10.0, 0.0, 0.0);
        glVertex3f(10.0, 0.0, 10.0);
        glVertex3f(0.0, 0.0, 10.0);
    gluOrtho2D(0.0, game_settings.width, game_settings.height, 0.0);
    draw_fps((float)game_settings.width - 250, 20.0);
    //the follow quad is just to test... and it doesn't work..
        glVertex2f(0.0, 0.0);
        glVertex2f(10.0, 0.0);
        glVertex2f(10.0, 10.0);
        glVertex2f(0.0, 10.0);

I have no idea what is going on..
I just get a black screen..

I was under the impression that one was able to combine different views together.. to achieve different effects...

I want to do all my UI graphics in a 2D space and overlay them on my 3D scene..



/* Drunk...... fix later.... */
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
You're only pushing and popping the MODELVIEW matrix, not the PROJECTION matrix. You should be pushing and popping both.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  switching screen resolution NelsonMandella 3 4,684 Apr 25, 2010 01:33 PM
Last Post: SethWillits
  Full Screen Switching Blacktiger 3 4,654 Feb 9, 2008 03:05 PM
Last Post: Blacktiger
  Projection Matrix vs. Animation Speed jbirac 0 2,338 Dec 20, 2005 12:50 AM
Last Post: jbirac
  Trouble with fullscreen switching codeman9 14 7,303 Aug 11, 2004 01:37 PM
Last Post: arekkusu
  Switch Between Fullscreen and Windowed Modes - Again... thaeez 2 4,014 Jul 9, 2004 02:49 AM
Last Post: thaeez