Hi Urich,

Le 03/02/2012 05:41, Ulrich Hertlein a écrit :
what errors/issues/non-results are you seeing?  Black?  Reversed colors?  
Crashes?

The BGR become RGB without conversion, so the image is almost good, unless the color component that are swapped between red and blue.

(As I understand it you want to use the Bitmap directly as an image (not save 
it and read
it back) so I'm not sure where the plugin fits into the picture.)
It was just to see how OSG manage this issue.
First of all you don't need to do 'allocateImage' *AND* 'setImage'.  
'allocateImage'
allocates memory internally to osg::Image that can then be filled but I assume 
you already
have a buffer that it should use, so 'setImage' would be enough.
Yes, I'll remove the allocateImage call if it is not necessary, it was working well so I didn't change this piece of code...

osg::Image::setImage is designed to allow the user to specify a buffer that 
osg::Image
then uses (and manages, depending on the AllocationMode).  When you're passing 
a buffer
allocated by somebody else you may want to use AllocationMode::NO_DELETE, so 
that
osg::Image does not delete/free it.
Yes, thanks to this precision but I prefer the image to delete the content of the buffer in my implementation.

Regarding the RGB vs BGR you only want to change the 'pixelFormat' parameter, 
not the
'internalTextureFormat'.

I would naively expect that either
        _image->setImage(width, height, 1, GL_RGB,
                GL_RGB, GL_UNSIGNED_BYTE, data, osg::Image::NO_DELETE);
or
        _image->setImage(width, height, 1, GL_RGB,
                GL_BGR, GL_UNSIGNED_BYTE, data, osg::Image::NO_DELETE);
would do the trick.
I'll try this but I don't think it would be so easy... even if it would be very interesting !

Thanks a lot for your help, I'll continue to analyze this.

Regards,
Vincent.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to