Sign in to follow this  
FreJa

devil texturing problem

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this