Re: [osg-users] Saving a Texture3D to an Image
Hi Trystan, Have a look at : Image::readImageFromCurrentTexture(..) You'd need to call this from the graphics thread that has you've have render to the texture from - for instance using a Camera Post or FinalDrawCallback. After this readImage you could do the writeImageFile as well to ensure that the correct ordering is maintained. Calling writeImageFile() after the viewer.frame() will only work in SingleThreaded and CullDrawThreadPerContext threading models as the other threading models have the graphics thread still running after the return form viewer.frame(). Robert. On 12 November 2011 07:52, Trystan Larey-Williams trys...@trystan.org wrote: Hi, I've been banging my head against how to save a 3D texture out to a dds file for some time now. I've read posts that suggest simply attaching the texture's image to the buffer rather than the texture itself. I've done that for 2D textures with no problem. However, I don't see how that will work in this case; given the setup below. Code: ... camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); camera-setImplicitBufferAttachmentMask(osg::Camera::IMPLICIT_COLOR_BUFFER_ATTACHMENT, osg::Camera::IMPLICIT_COLOR_BUFFER_ATTACHMENT ); camera-attach(osg::Camera::COLOR_BUFFER0, tex1, 0, osg::Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER); camera-attach(osg::Camera::COLOR_BUFFER1, tex2, 0, osg::Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER); viewer.frame(); ... So, after I render the frame I want to be able to say Code: osgDB::writeImageFile( *tex1-getImage(), foo.dds ) But, of course, this doesn't work since the image isn't updated when the texture changes. Is there a strait forward way to get the texture data back to an image that I'm missing? Thank you! Cheers, Trystan[/code][/list] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43837#43837 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Quad buffered stereo; System requirements
Hi Helen, On 10/26/2011 02:30 PM, Helen Korotkova wrote: Hi, I need concrete names and types of monitors, glasses and cards to work with quad buffered stereo technology. I know that it can be ATI FireGL or Nvidia Quadro cards. But I whant know names of monitors which will work with them. I saw some information on nvidia site in 3d-vision-pro-requirements theme. Careful here. Nvidia's 3D Vision and quadbuffer stereo are two unrelated technologies. Thus the requirements posted for 3D Vision are not the same as for regular frame sequential stereo, such as the one produced by a Quadro or some FireGL card. Strictly speaking, anything that is certified to work with 3D Vision with work with an Nvidia Quadro. It will probably not work with a FireGL card, because the infrared/radio emitter for the 3D Vision glasses needs firmware uploaded and that comes only with the Nvidia drivers. But it is not enough - only Mitsubishi HDTV. Can it be Panasonic TX-PR42UT30 for example ? Moreover I cant find out about types of HDTV which will work for ATI with quad buffered stereo technology. And how must I choose glasses - for card or for monitor ? Can anyone help ? It depends on what you want. If you are going to use 3D Vision with a Quadro, then *you must* buy equipment that is certified to work with it. Otherwise the driver will not enable stereo. Ridiculous, but that is how Nvidia has designed it. If you are going to use plain old quadbuffer, you can use anything that can synchronize via the VESA mini-DIN plug at the back of the card. You would typically plug in something like an emitter for the CrystalEyes shutter glasses there. There are no strict requirements for the screen, but typically you will want something that can do at least 120Hz vertical refresh (most LCD TVs are way too slow for it, also LCD-based projectors are not good - go DLP). Alternatively, it is supposedly possible to send the frame-sequential stereo over a HDMI or DisplayPort plug, which may be better compatible with a TV. Then you use whichever glasses are designed to work with your TV/projector. Regards, Jan ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Saving a Texture3D to an Image
Hi Robert, Thanks for the reply! That seems to work only if I don't need to set other texture states. For instance, the following fails (2D texture in this case but I need to do similar with 3D). If I comment out the sampler texture attribute, the image is written successfully. With it commented in, image-valid() is false . Code: ... camera-setFinalDrawCallback( new Capture(output.tiff) ); geode-getOrCreateStateSet()-setTextureAttributeAndModes(1, sampler, osg::StateAttribute::ON); geode-getOrCreateStateSet()-addUniform( new osg::Uniform(sampler, 1) ); camera-attach(osg::Camera::COLOR_BUFFER0, outputTexture); geode-getOrCreateStateSet()-setAttributeAndModes( prog, osg::StateAttribute::ON ); viewer.frame(); geode-getOrCreateStateSet()-removeAttribute( prog ); Capture is implemented as follows Code: class Capture : public osg::Camera::DrawCallback { public: Capture( const std::string imagename ) : m_imageName(imagename) {} virtual void operator () (osg::RenderInfo renderInfo) const { osg::ref_ptrosg::Image image = new osg::Image; image-readImageFromCurrentTexture(renderInfo.getContextID(), true); osgDB::writeImageFile(*image, m_imageName); } private: std::string m_imageName; }; So, I'm guessing this approach doesn't work with multiple texture units? Maybe there's a way to force a particular unit active in the callback? Cheers, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43841#43841 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Shader and attributes binding
Hi, I'm writing some shaders to use with OSG and some use extra vertex attribute (such as tangent for a bump shader) I think the OpenGL way of vertex attribute binding is : - compile and link the shader program - get the attribute location by calling glGetAttribLocationARB(program, attributeName) - bind the data buffer to this location So, this way, you always use a free attribute location In OSG, it seems that I have to do : - compile and link the shader program - bind the data buffer to a chosen location - set the attribute location by calling program-addBindAttribLocation(attributeName, location) What is the correct way to do this ? How can I be sure to not overwrite an attribute location in OSG (for example, attribute locations 0, 2, 3, and 8 are often reserved for vertex, normals, colors, and texture coordinates by video drivers) ? Thank you! Cheers, Aurelien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43842#43842 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Finding whether a geode was culled
Hi everyone, I'm trying to figure out whether back face culling is culling my geode or not. I only have a single geometry drawable in the geode. The geode is getting culled out properly when it is not facing the camera, but I can't figure out how to tell that it was culled using the following code: Code: class CullCallback : public osg::NodeCallback { virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { traverse(geode, nv); osgUtil::CullVisitor* cullVisitor = dynamic_castosgUtil::CullVisitor *(nv); bool wasCulled = cullVisitor-isCulled(*geode); printf(Was my geode culled? %d\n, wasCulled); } }; I've dug around all over the forums and still can't seem to figure this out. Any help would be greatly appreciated. Thanks for the help! -- Christian -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43843#43843 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org