Texture problem

Started by
2 comments, last by rotos 21 years, 7 months ago
I've run into a problem with OpenGL texturing. When tring to set a texture with glTexture2D, all I get is a white image, but if I call gluBuild2DMipMaps, the texture shows up properly. This is a problem, as I'm using an orthographic projection, so the mipmaps just waste space, and it seems to be the issue behind all my textures being scaled to one half their normal size.

glTexImage2D(GL_TEXTURE_2D, 0, 4, ImageSets[k].Width, ImageSets[k].Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Data);
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, ImageSets[k].Width, ImageSets[k].Height, GL_RGBA, GL_UNSIGNED_BYTE, Data);
 
Does anyone know why this is happening? [edited by - rotos on September 11, 2002 3:52:36 PM]
Advertisement
This sounds uncannily like a problem i just had - openGL will act as if texturing is disabled if all the mipmaps are not present, so you''l have to disable mipmapping. Something like glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); i think.
Check your texture is a power of 2 in width and height. If it is not, TexImage will not work (INVALID_VALUE error), and a white texture is produced.
When you call gluBuild2DMipmaps, your texture is automatically resized to a power of 2. This is why they appear smaller when you use this method.

http://users.ox.ac.uk/~univ1234
quote:Original post by OrangyTang
This sounds uncannily like a problem i just had - openGL will act as if texturing is disabled if all the mipmaps are not present, so you''l have to disable mipmapping. Something like glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); i think.


That did it. Thanks.

This topic is closed to new replies.

Advertisement