PDA

View Full Version : glTexImage2D



02-26-2003, 05:25 AM
Hi!

I wrote a nice TGA loader. Everything was fine untill I tried to load the texture to OpenGL(via glTexImage2D).
I got no error message, but the texture simply wasn't there! It just didn't appear on the screen!
To make the things worther, I tried using gluBuildMipMaps2D - and it worked!!!
I was using the same parameters.
What can be the problem?

kehziah
02-26-2003, 05:34 AM
in OpenGL, every texture must have power-of-two dimensions (ie 256*512, or 1024*512 etc.). If you call glTexImage2D with a non-power-of-two-sized image, the texture wont be created.
However, gluBuildMipmaps2D will resize the image for you before building the mipmaps, this is why "it works".

Deiussum
02-26-2003, 05:35 AM
Your texture probably doesn't have dimensions that are a power of 2. gluBuildMipMaps2D will resize them to be a power of 2 if they aren't already. glTexImage2D will not.

02-26-2003, 08:01 AM
I fixed it.

The problem was default min filter. I wonder why it was set to linear_mipmap_nearest.