Sign in to follow this  

DevIL is making no sense to me

This topic is 4094 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 really getting pretty frustrated about this. My goal is to draw planet earth, which will be composed of two spheres: one with the main texture map, and the second with the clouds map (GL_LUMINANCE). I'm trying to use DevIL to load the textures. So: Declare the image name:
ILuint imageName;

Initialize il and do the image loading:
ilInit();
ilGenImages(1, &imageName);
ilBindImage(imageName);

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

Texture parameters:
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());

now this is a strange question, but: why does this work (although with texture problems... see my other thread pls ;))?! I mean, I dont do glGenTextures, I dont even do glBindTexture!! Can anyone please tell me how to load textures with DevIL properly? Huge thanks!!

Share this post


Link to post
Share on other sites
I've never used DevIL, but you might wanna check that ilGetInteger(IL_IMAGE_BPP) actually returns the number of bytes per pixel and not the number of bits per pixel.

Quote:

now this is a strange question, but: why does this work (although with texture problems... see my other thread pls ;))?! I mean, I dont do glGenTextures, I dont even do glBindTexture!!

Well, it can work for any number of weird reasons, however you shouldn't do it :) The glGenTextures you can actually skip, and I guess you can skip the glBindTexture too, however then you don't now the ID of the texture, which will lead to all sorts of problems later on when you got more textures :)

And I guess the weird texture in your other post could be because of weird texcoords..

Share this post


Link to post
Share on other sites
Quote:
Original post by angry
I've never used DevIL, but you might wanna check that ilGetInteger(IL_IMAGE_BPP) actually returns the number of bytes per pixel and not the number of bits per pixel.

Quote:

now this is a strange question, but: why does this work (although with texture problems... see my other thread pls ;))?! I mean, I dont do glGenTextures, I dont even do glBindTexture!!

Well, it can work for any number of weird reasons, however you shouldn't do it :) The glGenTextures you can actually skip, and I guess you can skip the glBindTexture too, however then you don't now the ID of the texture, which will lead to all sorts of problems later on when you got more textures :)


I switched to NeHe's IPicture... simpler.


Quote:

And I guess the weird texture in your other post could be because of weird texcoords..


well... I'm using glu quadrics, like:


mapQuadric = gluNewQuadric();
gluQuadricDrawstyle(mapQuadric, GLU_FILL);
gluQuadricNormals(mapQuadric, GLU_SMOOTH);
gluQuadricTexture(mapQuadric, GL_TRUE);


they never gave any problems before...


thanks again

Share this post


Link to post
Share on other sites

This topic is 4094 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.

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