devil texturing problem

Started by
6 comments, last by FreJa 17 years, 6 months ago
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
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
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.
nop, still the same prob :(
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
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.
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 :(((
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
Ok, sorry I can't help, I have no idea how to use DevIL.
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 :((
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."
oh. my. god. I should shoot myself, really...
was missing: glEnable(GL_DEPTH_TEST)...

eheh... oops
"Through me the road to the city of desolation,Through me the road to sorrows diuturnal,Through me the road among the lost creation."

This topic is closed to new replies.

Advertisement