• ### Announcements

• #### Wondering what's new and changed at GameDev.net?06/20/17

Check out the latest Staff Blog update that talks about what's changed, what's new, and what's up with these "Pixels".

#### Archived

This topic is now archived and is closed to further replies.

# glOrtho() ???

## 2 posts in this topic

I''m on the stage of implementing a Menu system in my "Sparetime-project". I''ve planned to have a "Title-screen" menu where the user can choose settings and new game, Thus, simple 2D works perfectly! Is there any way to just swap to Ortho mode during a function and display a set of bitmaps? Some src is appreciated!
0

##### Share on other sites
You can always write directly to the OGL buffer, but it''s slow as hell.... only good way is to use textured squares.....

cya,
Phil

Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states )
0

##### Share on other sites
I think you should do something like:

  // Make sure we''re working with the projection matrix. glMatrixMode(GL_PROJECTION); // Save the current (presumeably perspective) matrix. glPushMatrix(); glLoadIdentity(); // Set up the orthogonal projection. glOrtho(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); ... /* Do menu stuff */ // Go back to the previous matrix. glPopMatrix();

You may have to do something to the modelview matrix, as well. I''m not sure what, since I haven''t tried this yet.

According to the OpenGL standard, you can only be sure of having 2 entries on the projection matrix stack. That means that you couldn''t recursively use glPushMatrix each time you drew a submenu, for example. You''d have to keep track of whether or not you were in a submenu, and not push/pop if it was.

Uuuuuulrika-ka-ka-ka-ka-ka
0