View Full Version : Why is the texture not working?

02-07-2001, 06:36 PM
I realize that this may be kind of a dumb problem, but here it is:

I'm trying to texture a cube, which is made of 6 quads. I'm pretty sure that I've got the texure coordinates correct, and I think it can find the texture file, because I have it set up to to give an error if it can't for some reason.

It compiles just fine, and will use colored vertices, but it if I try to bind the texture to it, the cube comes out white. I did remember to turn on texture mapping, so I'm not sure what else to try. Is there a special .lib file in need to link, or a special bitmap format it needs?

02-07-2001, 06:57 PM
If it turns white, that usually means that there was an error loading the texture.

This can be anything from invalid pointers to data, to non-power-of-2 texture sizes.

Use glGetError() to get an idea of what is going wrong.


02-07-2001, 08:38 PM
I had that same problem a while back. My solution was that I had forgotten to enable textures via glEnable. If you are using NeHe's code it is glEnable(GL_TEXTURE_2D);

02-08-2001, 05:30 AM
This could be the standard OpenGL default mipmap problem.
OpenGL texture parameter defaults for minification filtering is GL_LINEAR_MIPMAP_NEAREST, so if you don't load all levels of the texture you get no texture applied.
Set the GL_TEXTURE_MIN_FILTER to GL_LINEAR or GL_NEAREST and see if it works.

02-08-2001, 05:53 AM
I also think you must set wrap-modes.

Do so with


, unless you already did it http://www.opengl.org/discussion_boards/ubb/tongue.gif