An image for the background....

Hi,

I’m sorry, but I don’t speak very well anglish…

I just a little question… is a person know what I can use an *.bmp file for the background? I know what i can use *.bmp file for texture…

Thank you for your help

Best regards

Jérôme

Hi Jerome !

If you know how to use a BMP file as a texture, then you know how to use it as a background: what you want to do is draw a quad that occupies the whole screen, using your background picture as the texture !

Look at the following:

// You don't want a lit background ! //
glDisable(GL_LIGHTING);
// You want the polygon to be filled ! //
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
// Don't really need that //
glClear(GL_DEPTH_BUFFER_BIT);
// But you need this ! //
glDepthMask(GL_FALSE);
// Make the viewport as big as the view //
glViewport(0,0,pRenderedParameters->m_iWidth,pRenderedParameters->m_iHeight); 
// Switch to projection matrix //
glMatrixMode(GL_PROJECTION);
// Load identity //
glLoadIdentity();
// Use an Ortho projection //
glOrtho(0,1,0,1,-1,1);
// Switch to modelview matrix //
glMatrixMode(GL_MODELVIEW);
// Load identity //
glLoadIdentity();
// Enable texturing //
glEnable(GL_TEXTURE_2D);
// If using Modulate in texenv, need to use white //
glColor3f(1,1,1);
// Bind the texture (this calls glBindTexture) //
pDoc->m_pBackgroundMap->BindTexture();
// Draw a quad that is as big as the view //
glBegin(GL_QUADS);
glTexCoord2f(0,0);
glVertex2f(0,0);
glTexCoord2f(1,0);
glVertex2f(1,0);
glTexCoord2f(1,1);
glVertex2f(1,1);
glTexCoord2f(0,1);
glVertex2f(0,1);
glEnd();
// Finished ! //
glDisable(GL_TEXTURE_2D);
glDepthMask(GL_TRUE);

Hope this helps !

Regards.

Eric

[This message has been edited by Eric (edited 01-30-2001).]

Thank you a lot Eric…

I try that!

Jérôme