This is very strange error.I have an ms3d(milkshape 3d) model.I am rendering it but it doesnt appear correctly.It is covered by repeated white textures.
I load textures with sfml.My texture loading code:
bool CImage::Load(char * szFilename, bool bMipMap)
{
m_bMipMap = bMipMap;
m_szFilename = szFilename;
sf::Image img_data;
img_data.loadFromFile(m_szFilename);
m_uiWidth = img_data.getSize().x;
m_uiHeight = img_data.getSize().y;
m_uiImage = 0;
glGenTextures(1, &m_uiImage);
glBindTexture(GL_TEXTURE_2D, m_uiImage);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if(m_bMipMap)
{
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, m_uiWidth, m_uiHeight, GL_RGB, GL_UNSIGNED_BYTE, img_data.getPixelsPtr());
}
else
{
glTexImage2D(GL_TEXTURE_2D, 0, 3, m_uiWidth, m_uiHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, img_data.getPixelsPtr());
}
return true;
}
Any help will be appreciated.