Archived

This topic is now archived and is closed to further replies.

Texture problem

This topic is 5572 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites