Using OpenGL and Interface's/Menu's

Started by
3 comments, last by Shock 20 years, 10 months ago
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
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 quadglVertex2f(1.0f, 0.0f); //bottom right of quadglVertex2f(1.0f, 1.0f); //top rightglVertex2f(0.0f, 1.0f); //top leftglEnd();


Of course, you''ll need to texture the quad, but I''ll leave that up to you... Try http://nehe.gamedev.net for help on that.
Tx Alot for the help! :D
Tx Alot for the help! :D
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

This topic is closed to new replies.

Advertisement