Weirdest thing.....I decided to use Free Image to load my images in OpenGL and it worked........well, almost. The texture loads using FreeImage but seems like it's not being mapped to the polygon at all. here's a screen shot of the current scene.
As you can see, the texture loaded as I'm creating a quad based on the width and height of the image so that works. What I don't get is, why isn't it mapped to the polygon? (I have GL_TEXTURE_2D) turned on....here's the code to load a freeimage texture.
bool Texture::loadTexture(const char* texName, const char* fileName, int texID,
GLenum image_format, GLuint internal_format, GLuint level, GLuint border)
{
this->texID = (GLuint)texID;
mFormat = FreeImage_GetFileType(fileName);
if(mFormat == FIF_UNKNOWN)
mFormat = FreeImage_GetFIFFromFilename(fileName);
if(mFormat == FIF_UNKNOWN)
return false;
if(FreeImage_FIFSupportsReading(mFormat))
mBitmap = FreeImage_Load(mFormat,fileName);
if(!mBitmap)
return false;
mData = FreeImage_GetBits(mBitmap);
mWidth = FreeImage_GetWidth(mBitmap);
mHeight = FreeImage_GetHeight(mBitmap);
if((mData == 0) || (mWidth == 0) || (mHeight == 0))
return false;
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &this->texID);
//glBindTexture(GL_TEXTURE_2D,this->texID);
glTexImage2D(GL_TEXTURE_2D, level, internal_format, mWidth, mHeight,
border, image_format, GL_UNSIGNED_BYTE, mData);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // Linear Filtering
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // Linear Filtering
FreeImage_Unload(mBitmap);
return true;
}
that seems OK, so i don't know what it could be.... I looked at the texture manager example with some modifications due to my texture class, please let me know.