glTexImage2D - White textures
Whenever I try to have a face textured using glTexture2D, all I get as a result is a white texture. However when using gluBuild2DMipmaps I do get a texture.
Now this might suggest there is a mipmapping problem here, however to my knowledge I turned mipmapping off, this is all the texture related code:
glGenTextures (1, &texture);
glBindTexture (GL_TEXTURE_2D, texture);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, tex -> width, tex -> height, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex -> data);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
And yes, textureing is enabled.
Got some ideas?
Well, the image you are trying to load has both dimensions that are powers of 2 right? (2*2, 4*4,16*16,32*32) so on.
----------------------------------------------------"Plant a tree. Remove a Bush" -A bumper sticker I saw.
Yes, 256*128 should be a correct texture size.
[edited by - James Trotter on June 18, 2003 9:41:56 AM]
[edited by - James Trotter on June 18, 2003 9:41:56 AM]
GLenum error=GL_NO_ERROR;glGenTextures (1, &texture);glBindTexture (GL_TEXTURE_2D, texture);glTexImage2D (GL_TEXTURE_2D, 0, 4, tex -> width, tex -> height, 0, GL_RGBA, GL_UNSIGNED_BYTE, tex -> data);error=glGetError();if (error!=GL_NO_ERROR){ // Something}glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
and tell us your error value... (if an error happens

PM
Times change...
Excuse my poor english!
PM Times change...
Excuse my poor english!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement