Hi, Martin

If you use _sumImg->allocateImage(1, 1, 1, GL_RGBA, GL_FLOAT);
you will get 4 channel * float 32 bit per channel.

If you want GL_LUMINANCE16 you should use GL_UNSIGNED_SHORT, and you may need 
to attach proper rendertarget attachment to camera with same pixel format

Cheers,
Sergey.

12.08.2011, 11:54, ""Martin Großer"" <[email protected]>:
> Hello Guys,
>
> I am a little bit dissatisfied. I want to render into an Image. I need the 
> pixel data on the cpu memory. That is the reason why I don't use a texture as 
> target. Anyway I need a higher precision than 8 bit. So I tried to render 
> into an 16 Bit luminance image. Then I got an OpenGL error:
>
> Warning: detected OpenGL error 'invalid enumerant' after RenderBin::draw(,)
>
> I tried other internal formats (i.e. GL_RGBA16F_ARB and GL_RGBA32F_ARB), but 
> I got the same message.
>
> Here is partial code from me:
>
>   // init image
>   _sumImg = new ::osg::Image;
>   _sumImg->allocateImage(1, 1, 1, GL_LUMINANCE16, GL_FLOAT);
>
>   //...
>
>   // init pre render camera
>   _preCam = new ::osg::Camera;
>   _preCam->setViewport(0,0,1,1);
>   _preCam->setProjectionMatrixAsOrtho2D(0,0.1,0,0.1);
>   _preCam->setClearColor(::osg::Vec4(0,0,0,1));
>   _preCam->setReferenceFrame(::osg::Transform::ABSOLUTE_RF);
>   _preCam->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
>   _preCam->setRenderTargetImplementation(::osg::Camera::FRAME_BUFFER_OBJECT);
>   _preCam->attach(::osg::Camera::COLOR_BUFFER0, _sumImg);
>   _preCam->setRenderOrder(::osg::Camera::PRE_RENDER);
>
>   // get the pixel color at location (0,0)
>   ::osg::Vec4 c = _sumImg->getColor(0,0);
>
> Thanks
>
> Martin
>
> --
> NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
> Jetzt informieren: http://www.gmx.net/de/go/freephone
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to