Skip to main content
gamedev.net
🔒 Locked

devil texturing problem

Started by FreJa 6 replies 900+ views
Original Post
FreJa
FreJa
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, ℑ);
    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."
adawg1414
adawg1414
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.
FreJa
FreJa
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."
adawg1414
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.
FreJa
FreJa
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."
adawg1414
adawg1414
Ok, sorry I can't help, I have no idea how to use DevIL.
FreJa
FreJa
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."
FreJa
FreJa
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."

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.