In some cases in my program, when I load one texture (png image file), sometimes irrlicht will pass a GL_INVALID_ERROR in testGLError();
So my program will break there in debug mode, but seems work normally in release mode.
I trace the code and add testGLError();
Code: Select all
//! loads a Texture
ITexture* CNullDriver::getTexture(io::IReadFile* file)
{
ITexture* texture = 0;
if (file)
{
texture = findTexture(file->getFileName());
if (texture)
return texture;
texture = loadTextureFromFile(file); <--- here
if (texture)
{
addTexture(texture);
texture->drop(); // drop it because we created it, one grab too much
....
}
//! opens the file and loads it into the surface
video::ITexture* CNullDriver::loadTextureFromFile(io::IReadFile* file, const io::path& hashName )
{
ITexture* texture = 0;
IImage* image = createImageFromFile(file);
if (image)
{
// create texture from surface
texture = createDeviceDependentTexture(image, hashName.size() ? hashName : file->getFileName() ); <---- here
image->drop();
}
return texture;
}
//! returns a device dependent texture from a software surface (IImage)
video::ITexture* COpenGLDriver::createDeviceDependentTexture(IImage* surface, const io::path& name, void* mipmapData)
{
testGLError() ; <----- here get GL_INVALID_ERROR, and stop in debug mode
return new COpenGLTexture(surface, name, mipmapData, this);
}
So.... Now I have no idea about this problem, could anyone give me some hint or advice?
Really appreciate for any help.