Image Bugs and request

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Image Bugs and request

Post by tuan kuranes »

Image lacks a "loaded" state check in all loading methods "Image::operator=, Image::loadrawdata, Image::loaddynamic," but Image::load :

Code: Select all

        if( m_pBuffer && m_bAutoDelete )
        {
            delete[] m_pBuffer;
            m_pBuffer = NULL;
        }
Even Image::Load has a Bug, as it doesn't check a for m_bAutoDelete option.

All those non-verification make sure memory leaks as soon as an Image is used twice.

While I'm here, I'd really like to have an access to the m_bAutoDelete private attribute in Image, when loading dynamic image, as in here :

method prototype :

Code: Select all

Image& loadDynamicImage( uchar* pData, 
ushort uWidth, 
ushort uHeight, 
PixelFormat eFormat,
bool autoDelete = false);
and method :

Code: Select all

//-----------------------------------------------------------------------------
Image& Image::loadDynamicImage( uchar* pData, ushort uWidth, 
ushort uHeight, PixelFormat eFormat,  bool autoDelete)
{
OgreGuard( "Image::loadDynamicImage" );

m_uWidth = uWidth;
m_uHeight = uHeight;
m_eFormat = eFormat;
m_ucPixelSize = PixelUtil::getNumElemBytes( m_eFormat );
m_uSize = m_uWidth * m_uHeight * m_ucPixelSize;

m_pBuffer = pData;
m_bAutoDelete = autoDelete;   
OgreUnguardRet( *this );
}
setting default flags, depth and mipmaps would also be useful, but I would be happy just with autodelete.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Please can you just submit these as patches.
User avatar
:wumpus:
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3067
Joined: Tue Feb 10, 2004 12:53 pm
Location: The Netherlands
x 1

Post by :wumpus: »

By a happy coincidence I'm working on this class, and adressing these issues. A patch is nice but not really necessary.
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

I have hard time accessing sourceforge patch system, so til I succed in posting overthere :

http://tuan.kuranes.free.fr/ogreimage.zip

And a new GLrenderer patch that fixes Light enumerant erros using gl funcfions and adding an gl error log reporting in log file in debug mode :

http://tuan.kuranes.free.fr/glrenderer.zip
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

Post Reply