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?
in OpenGL, every texture must have power-of-two dimensions (ie 256512, or 1024512 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”.
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.
I fixed it.
The problem was default min filter. I wonder why it was set to linear_mipmap_nearest.