load texture with GL_INVALID_ERROR

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
riveranb
Posts: 28
Joined: Fri Sep 23, 2011 9:37 am

load texture with GL_INVALID_ERROR

Post by riveranb »

I think I need help here.

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.
riveranb
Posts: 28
Joined: Fri Sep 23, 2011 9:37 am

Re: load texture with GL_INVALID_ERROR

Post by riveranb »

Well
Find the problem by myself -_-|||

glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, parameter);
I pass parameter with any possible value. (should be 1 or 2 or 4)
Post Reply