Jump to content
  • Advertisement
Sign in to follow this  
FreJa

DevIL is making no sense to me

This topic is 4369 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
Advertisement
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
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!