This topic is now archived and is closed to further replies.


FreeImage lib, how to build textures?

Recommended Posts

Hi! maybe some of you know the library FreeImage. I integrated it in my code and wanted to create a ogl-texture out of the bitmaps i´ve loaded in. The code looks like this: bitmap = FreeImage_LoadJPEG(TexName, JPEG_ACCURATE); width = FreeImage_GetWidth(bitmap); height = FreeImage_GetHeight(bitmap); bpp = FreeImage_GetBPP(bitmap); glGenTextures(1, &TexID); // Create The Texture // Typical Texture Generation Using Data From The Bitmap glBindTexture(GL_TEXTURE_2D, TexID); glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmap->data); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); Everything is compiled fine, but when i use the texture the colours are false and also the geometry, something must be wrong... Thnx, Max

Share this post

Link to post
Share on other sites