PDA

View Full Version : Texturing problem



lsdi
12-07-2002, 09:40 AM
Im loading some TGAs... but if I do not use gluBuild2DMipmaps the texture are not shown,

Code:




glBindTexture(GL_TEXTURE_2D,textures[nextFreeGlTextures].glName);

gluBuild2DMipmaps( GL_TEXTURE_2D,
3,
texture->GetImageWidth(),
texture->GetImageHeight(),
GL_RGBA,
GL_UNSIGNED_BYTE,
texture->GetPixels());

glTexImage2D(GL_TEXTURE_2D,
0,
GL_RGBA,
texture->GetImageWidth(),
texture->GetImageHeight(),
0,
GL_RGBA ,
GL_UNSIGNED_BYTE,
texture->GetPixels());


glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);

glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);

Bob
12-07-2002, 10:17 AM
Check some documentation about glTexImage2D and see what is says about the width and height of the texture.

Or if you don't want to, they both have to be a power of two.

lsdi
12-07-2002, 12:08 PM
Thanks Bob, I forgot this detail.


But the texture have some quality-loss, why?

Ps: Im loading a TGA but only 3 color components (GL_RGB).

Thanks Bob