PDA

View Full Version : help please! (making a graphical menu)



MarsuGL
08-19-2001, 01:35 PM
Hello,
I want to have a bmp that fits exactly my windows, the pb is that the window is 640*480
and, i want my menu to be blended with the background and to be ALWAYS ON TOP, like if it was a 2d menu over a 3d background.

i need help with the kind of projection to use.

i've tried to convert a fontloader code but it don't works.
could you take a look, i'm sure that the error(s) will be as fat as..as.. as what ??

in this function i try to draw a quad that even not appears. (a placement error ?)

void test(void)
{

glColor3f(1.0,0.0,0.0);
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0,640,0,480,-100,100);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glTranslated(10,10,0);


glBegin(GL_QUADS);
glVertex3f(0.0,0.0,0.0);
glVertex3f(30.0,0.0,0.0);
glVertex3f(30.0,30.0,0.0);
glVertex3f(0.0,30.0,0.0);
glEnd();


glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glEnable(GL_DEPTH_TEST);

}

iNsaNEiVaN
08-19-2001, 03:00 PM
Use this, it works fine for this occasion:

(psudo code)

Change to orthograpic projection
disable lighting
enable blending
disable depth-buffer writing

Now its in 2d and u can blend. Its easier then billboarding and I use it.

Platinum
08-19-2001, 09:49 PM
try this:
glMatrixMode(GL_PROJECTION);
glPushMatrix();
...
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
...
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
...

hope it helps http://www.opengl.org/discussion_boards/ubb/smile.gif

MarsuGL
08-21-2001, 12:18 PM
hello,
i finally make work this little piece of code, the problem was that first i was just draving a quad without texturing it, but the

glEnable(GL_TEXTURE) was written and when i have removed this line, it has worked (or if i don't remove it but map a texture onto the quad)
Why wasn't it working when texturing was enabled??

sorry for my bad english and tanks to those people which have ansvered,
Marsu

Platinum
08-22-2001, 05:32 PM
You must use :
glEnable(GL_TEXTURE_2D);

GL_TEXTURE is a constant used for changing the matrix mode, not for enabling texturing.
With glEnable use GL_TEXTURE_1D, GL_TEXTURE_2D or GL_TEXTURE_3D

also dont forget to bind your texture object with GL_TEXTURE_2D before you use it.

Platinum
08-22-2001, 05:40 PM
one more thing (hope it helps):

if you enable texturing and do not specify texture coordinates, the actual coordinate is used for all vertices (default is 0,0, so this pixel is used to cover the whole quad)