Hello everyone,
first time beeing here I couldn’t manage to make the links to the tutorial URL and the image URL because everytime I got this error message:
[NOTE]Post denied. New posts are limited by number of URLs it may contain and checked if it doesn’t contain forbidden words.[/NOTE]
So you have to copypaste the URLs and delete the space in “ht tp”. Are actually 2 URLs too many -.- this is really annoying if I can’t even link to 1 page or 1 image. well whatever…
I’m following this tutorial “ht tp://ogldev.atspace.co.uk/index.html” and I am at chapter 22 “Loading models using the Open Asset Import Library” now. You can see there what the model should look like but instead mine looks like this: “ht tp://postimg.org/image/6vq9ovbkx/”
In the tut he’s using ImageMagick but I’m useing FreeImage so I thought the bug might be when loading the texture.
bool Texture::Load()
{
FIBITMAP* bitmap = FreeImage_Load(FreeImage_GetFileType(m_imagePath, 0), m_imagePath);
printf("Loading texture: '%s'
", m_imagePath);
glGenTextures(1, &m_textureObj);
glBindTexture(m_textureTarget, m_textureObj);
glTexParameteri(m_textureTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(m_textureTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
FIBITMAP *pImage = FreeImage_ConvertTo32Bits(bitmap);
int nWidth = FreeImage_GetWidth(pImage);
int nHeight = FreeImage_GetHeight(pImage);
glTexImage2D(m_textureTarget, 0, GL_RGB, nWidth, nHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, (void*)FreeImage_GetBits(pImage));
GLenum error = glGetError();
if(error){
printf("There was an error loading the texture
");
}
FreeImage_Unload(bitmap);
return true;
}
From the look of my model I thought the problem might be the alpha channel but actually I’m using only RGB. Any ideas?
thanks in advance,
Jan
EDIT1: the model file is a .md2 and the texture file a .pcx (the source is also available here “ht tp://ogldev.atspace.co.uk/www/tutorial22/tutorial22.html”)