Jump to content
  • Advertisement
Sign in to follow this  
Adrian Bibby Walther

OpenGL ilutGLBindTexImage creates a 1*1 texture

This topic is 2301 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

I have been trying to solve this for some time, but after googling and googling, again ang again. I finally decided to post it here.
I use the following code to load a texture into OpenGL, using DevIL:

bool CImage::Load(const std::string &File){
ILuint Image;
if(ilGetInteger(IL_IMAGE_ORIGIN) == IL_ORIGIN_LOWER_LEFT) iluFlipImage();
Tex = ilutGLBindTexImage();
Width = ilGetInteger(IL_IMAGE_WIDTH);
Height = ilGetInteger(IL_IMAGE_HEIGHT);
int W,H;
return Tex != 0;

My problem is that after the texture is loaded, it only has a size of 1*1 ie. one pixel, which it 512 times smaller than the actual image.
The pixel is the same color as the top left pixel in the actual image, so I know that some of the data is loaded.

If you want you can download the code here, and check it out: [attachment=10879:Engine.zip]

PS: I don't know if this fits in this forum. It kind of has to do with OpenGL, and kind of doesn't.

Share this post

Link to post
Share on other sites
I wasn't a fan of the DevIL/OpenGL built in loading functions. They were always buggy every time I used them.

The way I go about loading an OpenGL texture with DevIL is by creating a generic function that creates a texture from any pixel pointer and then just passing in the pixels from ilGetData(). Edited by Lazy Foo

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!