Jump to content
  • Advertisement

Archived

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

Shock

OpenGL Using OpenGL and Interface's/Menu's

This topic is 5612 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello All Im trying to make a program in OpenGL, where I can load up images (TGA''S) and display them on the screen as menu''s. What I would like to know, is what''s the best way to do this. I have my application running fullscreen in 800x600. So far from what I know in OpenGL I thought I could make quad(s) and texture that to display the menu''s, but I dont know how to calculate the size of the quad to the size of my window res(800x600), that is too make my quad the same size as my window in diff res modes. Is their a better way of doing this? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Sounds like a common conceptual difficulty many people face when learning OpenGL.

Call glOrtho(left, right, bottom, top, near, far) passing coords for each, I''d recommend:


glOrtho(0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f);


and then just call


glBegin(GL_QUADS);
glVertex2f(0.0f, 0.0f); //bottom left of quad

glVertex2f(1.0f, 0.0f); //bottom right of quad

glVertex2f(1.0f, 1.0f); //top right

glVertex2f(0.0f, 1.0f); //top left

glEnd();


Of course, you''ll need to texture the quad, but I''ll leave that up to you... Try [url]http://nehe.gamedev.net[/url] for help on that.

Share this post


Link to post
Share on other sites
You might want to use those two functions, which i posted here so many times:


void Enter2DMode()
{
glPushAttrib(GL_LIGHTING_BIT|GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);

//glEnable(GL_BLEND);

//glBlendFunc(GL_DST_ALPHA,GL_SRC_ALPHA);


glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, (GLdouble)window_width, (GLdouble)window_height, 0.0, -250.0, 250.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
}

void Leave2DMode()
{
//glDisable(GL_BLEND);

glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopAttrib();
}


Height Map Editor | Eternal Lands | Fast User Directory

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!