Hi Christian,
The best way to use osg::Image is using a osg::ref_ptr.
osg::ref_ptr<osg::Image> m_pImage;
And you shouldn't delete m_pImage. ref_ptr and Referenced do the job for
you.
Rafa.
On 5/15/07, Martin Aumueller <[EMAIL PROTECTED]> wrote:
Hi Christian,
On Tuesday 15 May 2007, [EMAIL PROTECTED] wrote:
> Hi,
>
> I have a problem changing the data of an RGB to an RGBA image.
> The following code works fine until i end the programm. The the delete[]
> operator of the image crashes.
> What's wrong?
> Thanks for help!
>
> Christian
>
>
> class CTextureInfo
> {
> public:
> osg::Image* m_pImage;
It should work better if you say m_pImage = new osg::Image; here.
Martin
>
> void MakeTranslucent() {
> if(pixFrmt == GL_RGB) {
> int nWidth = m_pImage->s();
> int nHeight = m_pImage->t();
> int nDepth = m_pImage->r();
> pDataRGBA = new BYTE [nWidth * nHeight * 4];
> pDataRGB = (BYTE*)m_pImage->data();
>
> // ... make translucent....
>
> m_pImage->setImage(m_pImage->s(), m_pImage->t(), m_pImage->r(),
> GL_RGBA,
> GL_RGBA, GL_UNSIGNED_BYTE, pDataRGBA,
> osg::Image::USE_NEW_DELETE);
> }
> }
> }
>
> --
> Christian Hoffmann
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
--
Rafael Gaitán Linares
Instituto de Automática e Informática Industrial http://www.ai2.upv.es
Ciudad Politécnica de la Innovación
Universidad Politécnica de Valencia
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/