[osg-users] Problem reading unclamped float values and non-standard internal formats PBO

Omar Álvarez omar.alvarez at cinfo.es
Mon Oct 14 07:19:56 PDT 2019


I am trying to render to texture and read the results with an osg::Image.
When I use standard internal formats like GL_RGB it works ok. The problem
appears when I try to for example use GL_FLOAT with GL_RGB16, etc.

When I get my image back the internal format is not what I want (the one
that I set up in the texture) and I see errors like:

error pixelFormat = 805b
ContextData::incrementContextIDUsageCount(0) to 2
Warning: detected OpenGL error 'invalid value' at after
stateset.compileGLObjects in GLObjectsVisitor::apply(osg::StateSet&

Here is my PBO setup code:

osg::Camera::RenderTargetImplementation renderTargetImplementation
= renderTargetImplementation = osg::Camera::PIXEL_BUFFER;

    // viewport set in configure() method
    _camera->setClearColor(osg::Vec4(0., 1., 1., 1.));
    _camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    _camera->setViewport(new osg::Viewport(0,0,viewport_size.x(),
osg::ClampColor(GL_FALSE, GL_FALSE, GL_FALSE),
    osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE |

// Render to texture
    _texture = new osg::Texture2D();
    _texture->setTextureSize(viewport_size.x(), viewport_size.y());

    // attach the texture and use it as the color buffer.
    _camera->attach(osg::Camera::COLOR_BUFFER, _texture);

I am also having trouble with clamped values, when it does work, values are
clamped in the range [0,1] although I have disabled clamping.

Anyone knows how to setup a PBO to read unclamped values in non-standard
formats (GL_RGBUI16, GL_RGB16F...)?

Is this supported in OSG?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20191014/1be2b750/attachment.html>

More information about the osg-users mailing list