PDA

View Full Version : texture mapping



flyer
10-07-2002, 04:35 PM
Hi

I have a bitmap that was made in paint (windows bmp )I made the image 256x256.
When I went to render it, it did not show the picture just a white square . I did every thing I knew to do. I only drawn one
quad (front)because I only need one quad for
a 2d scroller (not a 3d cube), here is some of the code
void drawscene( )
{

glBindTexture(GL_TEXTURE_2D,g_tex[RAMP1]);

glPushMatrix();

glTranslatef(0.0f,0.0f,-5.0f);

glBegin(GL_QUADS);
glTexCoord2f(0.0f,0.0); glVertex2f(-1.0f,-1.0f);
glTexCoord2f(1.0f,0.0f); glVertex2f(1.0f,-1.0f);
glTexCoord2f(1.0f,1.0f); glVertex2f(1.0f,1.0f);
glTexCoord2f(0.0f,1.0f); glVertex2f(-1.0,1.0f);
glEnd();

glPopMatrix();
}

So can some one on puting a texture on one quare

thanks

Gavin
10-08-2002, 12:22 AM
Are you sure you have uploaded your texture properly, test it with glDrawPixels

Bob
10-08-2002, 01:40 AM
Another common problem is to forget to change the default minification filter. The default minification filter is GL_LINEAR_MIPMAP_NEAREST, which requires a full mipmap chain. Try set the minification filter to GL_LINEAR or GL_NEAREST.

Put this directly after you have uplaoded your texture (or change existing code if you already have a similar line).



glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

flyer
10-08-2002, 04:26 AM
Thank you!! that did . Bob