Advertisement

glTexImage2D - White textures

Started by June 16, 2003 06:10 PM
4 comments, last by keinstein 21 years, 8 months ago
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.
Advertisement
256*128 would qualify wouldn''t it?
Yes, 256*128 should be a correct texture size.

[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!
Well the funny thing is, there is no error, glGetError just returns no error, zero, nada, niente, nothing...

Yet gluBuild2DMipmaps works, but it f4x0rs up my Alpha channel because of the rescaling...

This topic is closed to new replies.

Advertisement