Re: [osg-users] Help Rendering and Reading Floating Point Textures
Brian, JP, The osgmultiplerendertargets example uses (by default) GL_FLOAT_RGBA32_NV, rather than either GL_RGBA32F_ARB, or even GL_RGBA16F_ARB. Could this be a card issue? I would be interested to know whether this example works for you if you change to GL_RGBA32F_ARB or GL_RGBA16F_ARB. I admit, I haven't tried it myself yet - and now intend to - but certainly in my own app (on ATI), I have had issues with GL_RGBA16F_ARB and GL_FLOAT in the past. Things might be better now. David ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help Rendering and Reading Floating Point Textures
Hi David, David Spilling wrote: Brian, JP, The osgmultiplerendertargets example uses (by default) GL_FLOAT_RGBA32_NV, rather than either GL_RGBA32F_ARB, or even GL_RGBA16F_ARB. Could this be a card issue? Yes, if I remember correctly, at the time I made the example I was fiddling with various settings. On the card I tested, the GL_FLOAT_RGBA32_NV was faster than GL_RGBA32F_ARB. There is no real reason to not use the ARB formats. I'll submit a modified example with the NV options commented out and documented. I would be interested to know whether this example works for you if you change to GL_RGBA32F_ARB or GL_RGBA16F_ARB. I admit, I haven't tried it myself yet - and now intend to - but certainly in my own app (on ATI), I have had issues with GL_RGBA16F_ARB and GL_FLOAT in the past. Things might be better now. I know GL_RGBA32F_ARB and GL_FLOAT work fine, we use it all the time on NVidia 8-series and up. I've just tested GL_RGBA16F_ARB with GL_FLOAT and it works fine after I replaced all e-12 and e12 with e-3 and e3. This is on GeForce 7400Go. jp David ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Help Rendering and Reading Floating Point Textures
Folks, I'm having trouble figuring out how to render floating point values to a texture and then reading them back from the card for use in my app. I can get byte values to work fine. Any help would be appreciated. Thanks, Brian Here's a summary of what I'm doing: texture setup osg::TextureRectangle* texture = new osg::TextureRectangle; texture-setTextureSize(tex_width, tex_height); texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); texture-setInternalFormat(GL_RGBA16F_ARB); texture-setSourceFormat(GL_RGBA); texture-setSourceType(GL_FLOAT);; rtt camera setup camera-attach(osg::Camera::COLOR_BUFFER, texture); camera-setRenderOrder(osg::Camera::PRE_RENDER); camera-setRenderTargetImplementation(osg::Camera::PIXEL_BUFFER); //camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); camera callback setup osg::Image* image = new osg::Image; image-allocateImage(tex_width, tex_height, 1, GL_RGBA, GL_FLOAT); camera-setPostDrawCallback(new MyCameraPostDrawCallback(image));; camera callback const osg::Viewport * vp = camera.getViewport(); _image-readPixels((int)vp-x(), (int)vp-y(), (int)vp-width(),;; (int)vp-height(), GL_RGBA, GL_FLOAT); osgDB::writeImageFile(*_image,imagexxx.png); or write raw data and read from another app; std::ofstream fout(imagexxx.raw,std::ios::binary); fout.write((char *)_image-data(),_image-getImageSizeInBytes()); fout.close(); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help Rendering and Reading Floating Point Textures
Brian, For some odd reason, a source type of GL_UNSIGNED_BYTE rather than _FLOAT seems to work for me for a internal format of GL_RGBA16F_ARB, so you might want to give that a go. David ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help Rendering and Reading Floating Point Textures
Hi, have a look at the osgmultiplerendertargets example, specifically the options --hdr and --image. I'd recommend using FBO and gl_FragData in shaders and COLOR_BUFFER0 and upwards attachments. jp Brian R Hill wrote: Folks, I'm having trouble figuring out how to render floating point values to a texture and then reading them back from the card for use in my app. I can get byte values to work fine. Any help would be appreciated. Thanks, Brian Here's a summary of what I'm doing: texture setup osg::TextureRectangle* texture = new osg::TextureRectangle; texture-setTextureSize(tex_width, tex_height); texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); texture-setInternalFormat(GL_RGBA16F_ARB); texture-setSourceFormat(GL_RGBA); texture-setSourceType(GL_FLOAT);; rtt camera setup camera-attach(osg::Camera::COLOR_BUFFER, texture); camera-setRenderOrder(osg::Camera::PRE_RENDER); camera-setRenderTargetImplementation(osg::Camera::PIXEL_BUFFER); //camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); camera callback setup osg::Image* image = new osg::Image; image-allocateImage(tex_width, tex_height, 1, GL_RGBA, GL_FLOAT); camera-setPostDrawCallback(new MyCameraPostDrawCallback(image));; camera callback const osg::Viewport * vp = camera.getViewport(); _image-readPixels((int)vp-x(), (int)vp-y(), (int)vp-width(),;; (int)vp-height(), GL_RGBA, GL_FLOAT); osgDB::writeImageFile(*_image,imagexxx.png); or write raw data and read from another app; std::ofstream fout(imagexxx.raw,std::ios::binary); fout.write((char *)_image-data(),_image-getImageSizeInBytes()); fout.close(); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org