Hi Robert,

>> I am not sure if this is a bug, but in my opinion Image::allocateImage
>> should not change internalTextureFormat or at least Image::readPixels
should
>> record and restore internalFromat after calling allocateImage.

>I don't follow, are we talking about the the format in osg::Image or
>the texture?

Sorry for being imprecise. All the time I was talking about
osg::Image::_internalTextureFormat member.

I may submit a fix but I am not sure what is desired course of action.
Should I remove the line changing it from Image::allocateImage or rather
modify Image::readPixels to preserve it from modification when
Image::allocateImage is called ? See the bits of code that could be
affected, below.


osg::Image::allocateImage is called from Image::readPixels, Line 608
[...]
void Image::readPixels(int x,int y,int width,int height,
                       GLenum format,GLenum type)
{
    allocateImage(width,height,1,format,type);

    glPixelStorei(GL_PACK_ALIGNMENT,_packing);

    glReadPixels(x,y,width,height,format,type,_data);
}
[...]

osg::Image::_internalTextureFormat modified in:
Image.cpp, Image::allocateImage( int s,int t,int r,  GLenum format,GLenum
type, int packing), Line 556
[...]
    if (_data)
    {
        _s = s;
        _t = t;
        _r = r;
        _pixelFormat = format;
        _dataType = type;
        _packing = packing;
        _internalTextureFormat = format;
    }
[...]


Image::_internalTextureFormat is used (through getInternalTextureFormat
accessor method) to select Renderbuffer format:
FrameBufferObject.cpp,
FrameBufferAttachment::FrameBufferAttachment(Camera::Attachment&
attachment), Line 365:
[...]
    osg::Image* image = attachment._image.get();
    if (image)
    {
        if (image->s()>0 && image->t()>0)
        {
            GLenum format = attachment._image->getInternalTextureFormat();
            if (format == 0)
                format = attachment._internalFormat;
            _ximpl = new Pimpl(Pimpl::RENDERBUFFER);
            _ximpl->renderbufferTarget = new osg::RenderBuffer(image->s(),
image->t(), format);
[...]


Cheers,

Wojtek



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

Reply via email to