Jump to content
  • Advertisement
Sign in to follow this  
FreJa

devil texturing problem

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

Hey, I'm trying to texture a sphere. This is the result: I was expecting a normal earth texture... but this one is obviously wrong. and this is what I'm doing:
ilInit();
	ilGenImages(1, &texId);

	ilLoadImage("textures/EarthMap_768x384.jpg");
	ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);

	glGenTextures(1, &image);
    glBindTexture(GL_TEXTURE_2D, image);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexImage2D(GL_TEXTURE_2D, 0, ilGetInteger(IL_IMAGE_BPP), ilGetInteger(IL_IMAGE_WIDTH),
      ilGetInteger(IL_IMAGE_HEIGHT), 0, ilGetInteger(IL_IMAGE_FORMAT), GL_UNSIGNED_BYTE,
      ilGetData());

	ilDeleteImages(1, &texId);

any help? Thanks

Share this post


Link to post
Share on other sites
Advertisement
I just taking a stab in the dark without taking your code and running it but try to add two more texture parameters:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

I was also thinking maybe your image converter is corrupt but I don't know anything about that code so just another stab in the dark.

Share this post


Link to post
Share on other sites
Ok, I noticed your jpg is not at a power of 2. This can be the problem with many texturing problems so resize your jpg to be sizes that are the power of 2. Like 1024x512, etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by adawg1414
Ok, I noticed your jpg is not at a power of 2. This can be the problem with many texturing problems so resize your jpg to be sizes that are the power of 2. Like 1024x512, etc.


nop... still nothing :(((

Share this post


Link to post
Share on other sites
hmm... the problem doesnt seem to be with the texturing, cause I just tested it with NeHe's IPicture and there were the same problems... weird... I think I wrote more or less the same code a few days ago and all worked fine :((

Share this post


Link to post
Share on other sites
oh. my. god. I should shoot myself, really...
was missing: glEnable(GL_DEPTH_TEST)...

eheh... oops

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!