Jump to content
  • Advertisement

Archived

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

keinstein

glTexImage2D - White textures

This topic is 5657 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

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?

Share this post


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

Share this post


Link to post
Share on other sites

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!

Share this post


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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!