Re: [osg-users] Capping holes made by clipping?
[Image: http://img265.imageshack.us/img265/922/capping.png ] This is the problem im having, as my window is scrolled, this funny looking chrome block sticking through my window in this example is being clipped at the window top, but it's leaving a hole, i really need to fix this. Any ideas? Thanks. PaulG -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12800#12800 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Texture always facing screen?
Hi, How can i get a texture to be displayed always facing the screen? the width of the texture has to be the width of the screen, same for height. and the corner of the texture always start at screen coords 0,0 osg::StateSet* stateset = new osg::StateSet(); osg::Image* image = osgDB::readImageFile(Images/panelForeground.png); if (image) { image-setPixelFormat(GL_BGRA); osg::Texture2D* texture = new osg::Texture2D; texture-setImage(image); texture-setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::REPEAT); texture-setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::REPEAT); stateset-setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); stateset-setMode(GL_LIGHTING,osg::StateAttribute::ON); stateset-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON); foregroundGeometry-setStateSet( stateset ); } ... Thank you! Cheers, PaulG -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12801#12801 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
I have a second idea to get my desired effect, but i would much prefer single-sided clipPlanes. If anyone know of other ways too then please do post. [Image: http://img507.imageshack.us/img507/8462/idea.png ] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12802#12802 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Texture always facing screen?
Hi Paul, If I understand the problem correctly you can use a screen aligned quad with a post render camera that has an orthographic projection. i.e. osg::Geometry* quadGeometry = osg::createTexturedQuadGeometry( osg::Vec3(0.0, 0.0, -1.0), osg::Vec3(screenWidth,0.0,0.0), osg::Vec3(0.0,screenHeight,0.0), texSize.x(),texSize.y() ); Bind texture to the quadGeometry Then use the following camera: osg::Camera* camera = new osg::Camera; camera-setClearMask(GL_DEPTH_BUFFER_BIT); camera-setClearColor( osg::Vec4(0.f, 0.f, 0.f, 1.0) ); camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF_INHERIT_VIEWPOINT); camera-setProjectionMatrixAsOrtho( 0.f, screenWidth, 0.f, screenHeight, 1.0, 500.f ); camera-setViewMatrix(osg::Matrix::identity()); camera-setViewport( 0, 0, _screenDims.x(), _screenDims.y() ); camera-setRenderOrder( osg::Camera::POST_RENDER ); camera-addChild(quadGeometry); root-addChild(camera); Using that the texture will always be infront of the camera and facing the screen. Regards, Kim. From: osg-users-boun...@lists.openscenegraph.org on behalf of Paul Griffiths Sent: Sat 23/05/2009 08:42 To: osg-users@lists.openscenegraph.org Subject: [osg-users] Texture always facing screen? Hi, How can i get a texture to be displayed always facing the screen? the width of the texture has to be the width of the screen, same for height. and the corner of the texture always start at screen coords 0,0 osg::StateSet* stateset = new osg::StateSet(); osg::Image* image = osgDB::readImageFile(Images/panelForeground.png); if (image) { image-setPixelFormat(GL_BGRA); osg::Texture2D* texture = new osg::Texture2D; texture-setImage(image); texture-setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::REPEAT); texture-setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::REPEAT); stateset-setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); stateset-setMode(GL_LIGHTING,osg::StateAttribute::ON); stateset-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON); foregroundGeometry-setStateSet( stateset ); } ... Thank you! Cheers, PaulG -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12801#12801 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org winmail.dat* To view the terms under which this email is distributed, please go to http://www.hull.ac.uk/legal/email_disclaimer.html *___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Texture always facing screen?
No, im after a texture that can be applied to a plane, this texture is the size of the osg window and it always faces you(the window). Take these screenshots below: I capture the screen and apply it to a plane, whenever the plane moves, the texture coords do not, the texture coords are always screen coords 0,0 I hope you understand what im after. [Image: http://img507.imageshack.us/img507/8462/idea.png ] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12805#12805 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Referencing loaded models
Hi, This might be a total beginners question, but I didn't find any sufficient information in the forum nor in the documentation. Let's assume I have a scene composed of some models, let's say a trees/houses which are the same model. If I want to load the model once and use it multiple times (with different transform/state) what is the best way to handle this. The naive way would be to load the model for each instance and add it to the scene graph. But there must be some way to share the node. What I had in mind is to load the model exactly once and sort of clone it in a way that the geometry/textures are still shared and only referenced multiple times. As I understand DRAW_INSTANCED, it performs something like this on GPU side. But what I want is more like a logical structure. I'm sort of lost. If I naively take a loaded model and just add it to the scene-graph with different transform nodes as parent it is still displayed only once :-( something like: osg::Node* loadedModel = osgDB::load(); osg::Node* rootNode = new osg::Group; // create some transforms for different instances osg::Transform* instance_1 = new osg::PositudeAttitudeTransfrom ... set some position to instance_1 osg::Transform* instance_2 = new osg::PositudeAttitudeTransfrom ... set some position to instance_2 osg::Transform* instance_3 = new osg::PositudeAttitudeTransfrom ... set some position to instance_3 //now attach the instances to the graph rootNode.addChild(instance_1); rootNode.addChild(instance_2); rootNode.addChild(instance_3); Shouldn't that work? cheers Sebastian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
I does this: const static osg::ref_ptr osg::Node staticNode = osgDB::readNodeFile(Shapes/Shape.osg); then for each required instance: const static osg::ref_ptr osg::Node nodeCopy = (osg::Node*)staticNode-clone(osg::CopyOp::DEEP_COPY_NODES); -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12808#12808 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Texture always facing screen?
Ok, I think I get you. You could achieve that by using a texgen node to compute a set of projected texture coordinates for the plane and then map the texture onto it. osgReflection would be a good place to look for that. You'd want a similar approach but instead of using the prerender stage to create the texture, use your full screen one, and get rid of the axis flip it uses. Kim. From: osg-users-boun...@lists.openscenegraph.org on behalf of Paul Griffiths Sent: Sat 23/05/2009 14:41 To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Texture always facing screen? Heres an easyer way to show what im after [Image: http://img196.imageshack.us/img196/9836/textureo.png ] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12806#12806 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org winmail.dat* To view the terms under which this email is distributed, please go to http://www.hull.ac.uk/legal/email_disclaimer.html *___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
Hi Paul, but isn't this just cloning? With other words: is there something that is shared between the nodes? Plus, i would favour something not involving static data ;-) cheers Sebastian I does this: const static osg::ref_ptr osg::Node staticNode = osgDB::readNodeFile(Shapes/Shape.osg); then for each required instance: const static osg::ref_ptr osg::Node nodeCopy = (osg::Node*)staticNode-clone(osg::CopyOp::DEEP_COPY_NODES); -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12808#12808 ___ 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] Texture always facing screen?
Dont worry people, the reason i needed this wont work, my idea has a flaw, what if the contents of 2 windows overlap, ill get the contents of one window inside the other :( If anyone knows how to create single-sided clipPlanes which only clip when viewed from one side and when viewed from the other side do not clip then do post, its what I need. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12811#12811 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
Is the only way i worked out that works, though i belive there is a tutorial in the turorial section. Got to ask though, whats wrong with using static? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12812#12812 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
Hi Sebastian, Unless you explicitly ask the osg to clone your model's geometry it will share the geometry by default. It simply stores a pointer to the loaded model's vertices etc. So the below code should work for you. You can also set osgDB to cache the model in memory so that if you ever call osgDB::load() with the same path and filename it will just return a pointer to the cached model rather than reloading it. osg::Group* rootNode = new osg::Group; osg::Node* loadedModel = osgDB::load(); osg::PositudeAttitudeTransfrom* instance_1 = new osg::PositudeAttitudeTransfrom instance_1-setPosition( 10.f, 0.0, 0.0); instance_1-addChild(loadedModel); osg::PositudeAttitudeTransfrom* instance_2 = new osg::PositudeAttitudeTransfrom instance_2-setPosition( 20.f, 0.0, 0.0); instance_2-addChild(loadedModel); osg::PositudeAttitudeTransfrom* instance_3 = new osg::PositudeAttitudeTransfrom instance_3-setPosition( 30.f, 0.0, 0.0); instance_3-addChild(loadedModel); //now attach the instances to the graph rootNode-addChild(instance_1); rootNode-addChild(instance_2); rootNode-addChild(instance_3); viewer.setSceneData(rootNode); Regards, Kim. From: osg-users-boun...@lists.openscenegraph.org on behalf of Sebastian Messerschmidt Sent: Sat 23/05/2009 14:42 To: OpenSceneGraph Users Subject: [osg-users] Referencing loaded models Hi, This might be a total beginners question, but I didn't find any sufficient information in the forum nor in the documentation. Let's assume I have a scene composed of some models, let's say a trees/houses which are the same model. If I want to load the model once and use it multiple times (with different transform/state) what is the best way to handle this. The naive way would be to load the model for each instance and add it to the scene graph. But there must be some way to share the node. What I had in mind is to load the model exactly once and sort of clone it in a way that the geometry/textures are still shared and only referenced multiple times. As I understand DRAW_INSTANCED, it performs something like this on GPU side. But what I want is more like a logical structure. I'm sort of lost. If I naively take a loaded model and just add it to the scene-graph with different transform nodes as parent it is still displayed only once :-( something like: osg::Node* loadedModel = osgDB::load(); osg::Node* rootNode = new osg::Group; // create some transforms for different instances osg::Transform* instance_1 = new osg::PositudeAttitudeTransfrom ... set some position to instance_1 osg::Transform* instance_2 = new osg::PositudeAttitudeTransfrom ... set some position to instance_2 osg::Transform* instance_3 = new osg::PositudeAttitudeTransfrom ... set some position to instance_3 //now attach the instances to the graph rootNode.addChild(instance_1); rootNode.addChild(instance_2); rootNode.addChild(instance_3); Shouldn't that work? cheers Sebastian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org winmail.dat* To view the terms under which this email is distributed, please go to http://www.hull.ac.uk/legal/email_disclaimer.html *___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
The reason i chose static is so the model is loaded only once when the first class instance is created. You could however create this node non-static but you must make sure you load it only once, like put it in another class and referance to it or something. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12813#12813 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
Kim C Bale wrote: Hi Sebastian, Unless you explicitly ask the osg to clone your model's geometry it will share the geometry by default. It simply stores a pointer to the loaded model's vertices etc. So the below code should work for you. You can also set osgDB to cache the model in memory so that if you ever call osgDB::load() with the same path and filename it will just return a pointer to the cached model rather than reloading it. osg::Group* rootNode = new osg::Group; osg::Node* loadedModel = osgDB::load(); osg::PositudeAttitudeTransfrom* instance_1 = new osg::PositudeAttitudeTransfrom instance_1-setPosition( 10.f, 0.0, 0.0); instance_1-addChild(loadedModel); osg::PositudeAttitudeTransfrom* instance_2 = new osg::PositudeAttitudeTransfrom instance_2-setPosition( 20.f, 0.0, 0.0); instance_2-addChild(loadedModel); osg::PositudeAttitudeTransfrom* instance_3 = new osg::PositudeAttitudeTransfrom instance_3-setPosition( 30.f, 0.0, 0.0); instance_3-addChild(loadedModel); //now attach the instances to the graph rootNode-addChild(instance_1); rootNode-addChild(instance_2); rootNode-addChild(instance_3); viewer.setSceneData(rootNode); Regards, Kim. That works fine unless your pickick with the mouse. Is you select any of the nodes it always selects the first node :( So i had to make a clone for each instance. Guess it depense if your picking... -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12815#12815 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
Could you not check the name of parent node to identify the instance of the child? I might be wrong I haven't used the picking functionality for a while. K. From: osg-users-boun...@lists.openscenegraph.org on behalf of Paul Griffiths Sent: Sat 23/05/2009 15:39 To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Referencing loaded models Kim C Bale wrote: Hi Sebastian, Unless you explicitly ask the osg to clone your model's geometry it will share the geometry by default. It simply stores a pointer to the loaded model's vertices etc. So the below code should work for you. You can also set osgDB to cache the model in memory so that if you ever call osgDB::load() with the same path and filename it will just return a pointer to the cached model rather than reloading it. osg::Group* rootNode = new osg::Group; osg::Node* loadedModel = osgDB::load(); osg::PositudeAttitudeTransfrom* instance_1 = new osg::PositudeAttitudeTransfrom instance_1-setPosition( 10.f, 0.0, 0.0); instance_1-addChild(loadedModel); osg::PositudeAttitudeTransfrom* instance_2 = new osg::PositudeAttitudeTransfrom instance_2-setPosition( 20.f, 0.0, 0.0); instance_2-addChild(loadedModel); osg::PositudeAttitudeTransfrom* instance_3 = new osg::PositudeAttitudeTransfrom instance_3-setPosition( 30.f, 0.0, 0.0); instance_3-addChild(loadedModel); //now attach the instances to the graph rootNode-addChild(instance_1); rootNode-addChild(instance_2); rootNode-addChild(instance_3); viewer.setSceneData(rootNode); Regards, Kim. That works fine unless your pickick with the mouse. Is you select any of the nodes it always selects the first node :( So i had to make a clone for each instance. Guess it depense if your picking... -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12815#12815 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org winmail.dat* To view the terms under which this email is distributed, please go to http://www.hull.ac.uk/legal/email_disclaimer.html *___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
My second idea of how to create my effect has a flaw, if the rear contents of 2 scrollpanels overlap then ill get the contents of the scrollpanels inside each other. If anyone knows how to create single-sided clipPlanes which only clip when viewed from one side and when viewed from the other side do not clip then do post, its what I need. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12816#12816 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
Kim C Bale wrote: Could you not check the name of parent node to identify the instance of the child? I might be wrong I haven't used the picking functionality for a while. K. Tried that but it always gives the parent node of the first instance. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12818#12818 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
Thanks Kim and Paul, My problem seems to be elsewhere. Me stupid hasn't tried his own minimal example. In my application I sort of wrap certain scene elements (like models) for an more abstract interface to loaded entities (as the models geometrical/graphical representation is only one aspect). So I reckon, there must be something wrong with my logic, rather than with the sharing principle. And yes, as far as picking is a concern, one could always put some top node (like the transform is in my case) above the reference. At least there are two lessons learned for me: 1. double check you stupid questions on behalf on a simple example, as I didn't ;-) 2. ask questions to assure yourself ;-) cheers thanks Sebastian Could you not check the name of parent node to identify the instance of the child? I might be wrong I haven't used the picking functionality for a while. K. From: osg-users-boun...@lists.openscenegraph.org on behalf of Paul Griffiths Sent: Sat 23/05/2009 15:39 To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Referencing loaded models Kim C Bale wrote: Hi Sebastian, Unless you explicitly ask the osg to clone your model's geometry it will share the geometry by default. It simply stores a pointer to the loaded model's vertices etc. So the below code should work for you. You can also set osgDB to cache the model in memory so that if you ever call osgDB::load() with the same path and filename it will just return a pointer to the cached model rather than reloading it. osg::Group* rootNode = new osg::Group; osg::Node* loadedModel = osgDB::load(); osg::PositudeAttitudeTransfrom* instance_1 = new osg::PositudeAttitudeTransfrom instance_1-setPosition( 10.f, 0.0, 0.0); instance_1-addChild(loadedModel); osg::PositudeAttitudeTransfrom* instance_2 = new osg::PositudeAttitudeTransfrom instance_2-setPosition( 20.f, 0.0, 0.0); instance_2-addChild(loadedModel); osg::PositudeAttitudeTransfrom* instance_3 = new osg::PositudeAttitudeTransfrom instance_3-setPosition( 30.f, 0.0, 0.0); instance_3-addChild(loadedModel); //now attach the instances to the graph rootNode-addChild(instance_1); rootNode-addChild(instance_2); rootNode-addChild(instance_3); viewer.setSceneData(rootNode); Regards, Kim. That works fine unless your pickick with the mouse. Is you select any of the nodes it always selects the first node :( So i had to make a clone for each instance. Guess it depense if your picking... -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12815#12815 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org * To view the terms under which this email is distributed, please go to http://www.hull.ac.uk/legal/email_disclaimer.html * ___ 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] Referencing loaded models
Then something else is wrong. The nodePath of your hits should be accurate to the specific node that was picked. This is pretty routine stuff as anyone using a scene graph is likely to have nodes scattered in at least dozens of places around their scene graphs. -Paul Paul Griffiths wrote: Kim C Bale wrote: Could you not check the name of parent node to identify the instance of the child? I might be wrong I haven't used the picking functionality for a while. K. Tried that but it always gives the parent node of the first instance. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12818#12818 ___ 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] Referencing loaded models
Hi Paul, Tried that but it always gives the parent node of the first instance. If that's the case, then you're probably using getParent(0) to go up in the graph, instead of using the intersection's node path. Remember, the model can have a whole hierarchy inside too, and the intersection will give you the Geode that was intersected. So you might have to go up a few levels in the node path before getting to the root of the model, and at that point the parent of that (still in the node path) should be the unique transform for the instance that was intersected. You can identify the root of your model in different ways, either with a name, a description, a piece of user data, ... Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
Most state attributes, including ClipPlane, have a 1-to-1 correspondence with OpenGL state, so you can look up what they do: http://www.opengl.org/sdk/docs/man/xhtml/glClipPlane.xml The short answer is that plain vanilla ClipPlane won't do this. However, you could easily attach an UpdateCallback that knows the current view position, and enable/disable the corresponding GL_CLIP_PLANE accordingly. Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com +1 303 859 9466 -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul Griffiths Sent: Friday, May 22, 2009 3:59 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] Single-sided ClipPlane? Hi, Is it possible to set a ClipPlane so it's singe-sided so it only clips when viewed from only one side? and can you select which side? ... Thank you! Cheers, PaulG -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12794#12794 ___ 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] Referencing loaded models
Skylark wrote: If that's the case, then you're probably using getParent(0) to go up in the graph, instead of using the intersection's node path. Yes, i am going osg::Node* node = hitr-nodePath.back(); if (node node-getNumParents() 0) { node = node-getParent(0); ... } now im trying this but its crashing: osg::Node* node; while (!hitr-nodePath.empty() (node = hitr-nodePath.back()) != NULL) { // check the node ... } -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12822#12822 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Capping holes made by clipping?
I couldn't view your screen shot for some reason. I'm assuming you are clipping a model and seeing inside a part of the model that is solid, and you want to render a polygon coincident with the clip plane that only draws where there are these holes. The stencil buffer has been used for CSG tasks like these for some time. The concept is similar to how stencil is used for volumetric shadows; even stencil values mean don't draw and odd stencil values mean it's a hole. The OpenGL red book covers this algorithm in some detail, if I remember correctly. Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com +1 303 859 9466 -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul Griffiths Sent: Friday, May 22, 2009 4:06 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] Capping holes made by clipping? Hi, Im using a clipNode, and when I clip a model, i get a hole, can these be filled? ... Thank you! Cheers, PaulG -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12796#12796 ___ 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] Referencing loaded models
Found the fault, forgot to add hitr-nodePath.pop_back() at the end of each itteration -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12825#12825 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Referencing loaded models
Hi Paul, Yes, i am going osg::Node* node = hitr-nodePath.back(); if (node node-getNumParents() 0) { node = node-getParent(0); ... } Yes, well no wonder you're always getting the same parent... :-) now im trying this but its crashing: What you want to do is walk the path up from the last node in the node path. for (unsigned int i = nodePath.size() - 1; i = 0; --i) { // check the node } or use iterators (you can use rbegin(), rend(), ... - check the STL documentation). And as I said, it might not be the first node up from the one you got in the intersection that will be different, if your model has a multi-level hierarchy you'll need to go up more than that. Know your graph... And you can use osgDB::writeNodeFile(*root, saved_scene.osg); to write the whole scene graph to a file and examine it. It's very useful to know what to expect and how the graph is laid out. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
Paul Martz wrote: Most state attributes, including ClipPlane, have a 1-to-1 correspondence with OpenGL state, so you can look up what they do: http://www.opengl.org/sdk/docs/man/xhtml/glClipPlane.xml The short answer is that plain vanilla ClipPlane won't do this. However, you could easily attach an UpdateCallback that knows the current view position, and enable/disable the corresponding GL_CLIP_PLANE accordingly. Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com +1 303 859 9466 -Original Message- From: [mailto:] On Behalf Of Paul Griffiths Sent: Friday, May 22, 2009 3:59 PM To: Subject: Single-sided ClipPlane? Hi, Is it possible to set a ClipPlane so it's singe-sided so it only clips when viewed from only one side? and can you select which side? ... Thank you! Cheers, PaulG -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12794#12794 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum Good idea, should of though of that. Now im thinking about when it should/shouldnt clip. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12828#12828 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Compute axis aligned bounding box of a given size
Which way would be better, what i have now or what you just suggested? My rule of thumb is; unless you have a compelling reason (ie efficiency), you should always prefer your own solutions. That way if you have to bug fix it or improve it in 1,2,3 years time you might remember what you did. Thank you Simon, your suggestions helped me loads! You're welcome, glad I helped rather than hindered! :) -- http://www.ssTk.co.uk ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help. KeyboardEventHandler and native keyboard layout bug in Linux
Hi! I think I've found the reason of keyboard layout problem in Linux. Executing the debug process, I found where the key code had been lost. The problem was in GraphicsWindowX11::adaptKey function, to be more precise in the following: if (remappedKey 0xff00) { // special keyboard character keySymbol = remappedKey; } else { // normal ascii key keySymbol = keybuf[0]; } if we replace/remove that conditional branch, i.e. use only that: { // special keyboard character keySymbol = remappedKey; } everything works fine :) I couldn't understand the aim of developers, what is that else for, anyway? else { // normal ascii key keySymbol = keybuf[0]; } if remappedKey holds the right value anyway (not only for special keyboard character) Could we send this into OpenSceneGraph Submissions? 2009/5/21 Max Gammer maxgam...@gmail.com: First name - Maxim, last name - Gammer 2009/5/20 Robert Osfield robert.osfi...@gmail.com: Hi ? My previous email I wrote: Hi Gammer? Maximum? Could you sign with your first name please so we know how to address you, thanks. Alas you still didn't sign your name... it's a small thing, but it does make for more congenial communication so please could you sign your post with your first name. 2009/5/20 Maxim Gammer maxgam...@gmail.com: I have looked src/osgViewer/GraphicsWindowX11.cpp and it helped to localise my problem. I printed the debug info with osg::notify in key points of the code and got very interesting results. Here are key points and results: The debugging results do point the adaptKey not coping with the new keyboard layout. I'm afraid I no X11/multi-language experience so can't point to any specific solution here. I'm surprised that others aren't coming across the same issue. Could you try changing your lanaguage to other lanauges such as French/German/Chinese to see what happens in this instance. I guess all might be broken, or perhaps just something specific language support. If it's generally broken then we'll need to look at how to use a different part of X11 to get the keycodes, otherwise we'll need to look at X11 itself why the Russian side is broken. Robert. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Maxim Gammer -- Maxim Gammer ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Unreadable endian error while reading file
Hi All I am getting error while reading a ive file which is generated by osgdem. It throws an error that Error reading file: DataInputStream::DataInputStream(): This file has an unreadable endian type. Do any one know why this error occurs ? Thanks Regards Santosh -- Santosh Gaikwad MTS Design Darshan Solutions Limited www.darshan3d.com http://www.darshan3d.com # +91-99530-99053 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
How do you disable a clipPlane? osg::ClipPlane plane = this-clipNode-getClipPlane(2); -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12833#12833 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
ClipPlane is what's known as positional state in OSG, and the plane equation is a StateAttribute that is in effect for your entire RenderStage. You enable or disable it on a per-node basis just like any other state: node-getOrCreateStateSet()-setMode( GL_CLIP_PLANEn, osg::StateAttribute::ON|OFF ); ...where n is the ClipPlane number. This all seems very familiar. I believe this was discussed just recently in this list; check the archives for the past couple weeks. Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com +1 303 859 9466 -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul Griffiths Sent: Saturday, May 23, 2009 11:02 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Single-sided ClipPlane? How do you disable a clipPlane? osg::ClipPlane plane = this-clipNode-getClipPlane(2); -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12833#12833 ___ 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] Help. KeyboardEventHandler and native keyboard layout bug in Linux
Hi! I think I've found the reason of keyboard layout problem in Linux. Executing the debug process, I found where the key code had been lost. The problem was in GraphicsWindowX11::adaptKey function, to be more precise in the following: if (remappedKey 0xff00) { // special keyboard character keySymbol = remappedKey; } else { // normal ascii key keySymbol = keybuf[0]; } if we replace/remove that conditional branch, i.e. use only that: { // special keyboard character keySymbol = remappedKey; } everything works fine :) I couldn't understand the aim of developers, what is that else for, anyway? else { // normal ascii key keySymbol = keybuf[0]; } if remappedKey holds the right value anyway (not only for special keyboard character) Could we send this into OpenSceneGraph Submissions? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Capping holes made by clipping?
Yes, thats exactly what im after, so it doesnt come standard with osg then? The ability to do this is standard in OSG. :-) Given the choice between a CISC-like bunch of baked in functionality with default behavior that is difficult to modify, and a set of RISC-like flexible tools that allow my app to use it in many ways, I guess I'd choose the latter. That being said, if you think that this functionality is something that people will need in the future, you could take the time to create some kind of custom clip plane hole-filling decorator node, and contribute it back to OSG. Is it hard to impliment? In know little about the inner working of osg mind you. If you are not fluent in OSG, OpenGL, use of stencil, and this algorithm in particular, then it might be challenging for you. If it's something you really need done now, then you should consider a contractor. I'd say a standalone demo could be coded in a few hours by someone familiar with stencil but has never implemented this before, and maybe even faster by someone who is completely fluent in 3D graphics. It's really quite a simple algorithm. (Disclaimer: This is not a formal quote. :-) I'm too busy to take this on right now. :-) It will take a non-zero amount of overhead time for a contractor to spin up on your app. Time estimate will vary depending on your requirements. Etc. Etc.) Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com +1 303 859 9466 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Destruction order for static objects
I have now debugged the problem a bit, and it does indeed manifest itself under both Win32 debug and release builds. The root of the problem is that the static s_renderBinPrototypeList object (osgUtil/RenderBin.cpp line 44) is being created before the static s_ReferencedGlobalMutext object (osg/Referenced.cpp line 82). Static/global objects are destructed in the reverse order of their creation. This causes a problem when destructing s_renderBinPrototypeList, since it depends on the already destructed s_ReferencedGlobalMutext object for its destruction. Suggested fix: Modify Referenced::getGlobalReferencedMutex(), so that it forces s_ReferencedGlobalMutext to be created in advance of s_ReferencedGlobalMutext. -- OpenThreads::Mutex* Referenced::getGlobalReferencedMutex() { // make sure that s_ReferencedGlobalMutext is created in advance, // since s_ReferencedGlobalMutext depend on it for its destruction osg::Referenced::getGlobalReferencedMutex(); static OpenThreads::Mutex s_ReferencedGlobalMutext; return s_ReferencedGlobalMutext; } -- -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12836#12836 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Destruction order for static objects
Oooops Please disregard the suggestion in my previous posting. What I meant to suggest was: -- static RenderBinPrototypeList* renderBinPrototypeList() { osg::Referenced::getGlobalReferencedMutex(); static osg::ref_ptrRenderBinPrototypeList s_renderBinPrototypeList = new RenderBinPrototypeList; return s_renderBinPrototypeList.get(); } -- -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12838#12838 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
Enabling/disabling clipPlanes won't do the job, your looking at the side and into the scroll window at the same time. From what i can work out, clipPlanes slice all the way along the model and remove the outer half, so any clipping applied is going to effect what I see at the front of the scroll window too. Or am I missing something? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12839#12839 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Direction vector to Rotation (Attitude) Quaternion
Hi, the above code doesn't work. After some experiments a found a solution/ I make matrix invert. Неre working code: osg::PositionAttitudeTransform* Transf;// this is transform of my object Transf-setPosition(osg::Vec3(100,200,300)); osg::Quat quad; osg::Matrix matrix; matrix.makeLookAt( Transf-getPosition(), osg::Vec3(10,20,30), osg::Z_AXIS); quad.set(matrix); Transf-setAttitude(quad.inverse()); Thank you! Cheers, Sergey -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12840#12840 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Capping holes made by clipping?
[quote=Paul Martz] If it's something you really need done now, No, im in no real hurry, am 6-12-24-48 months away to be honist. But if you or anyone does impliment such a feature or comes upon such info then please dont forget me. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12841#12841 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dinamic Line Drawing
Hi Allen, On 21/5/09 5:47 PM, Allen Saucier wrote: Has anyone figured out how to draw only the last segment that was added? I've still not figured that out and I've got over 15,000 small line segments in my vertex array ... And from what I can tell: ... just causes the ALL the vertices to be redrawn. Is there a more efficient way? I'd like to draw only the last line, which would be the line segment between the last vertex and the new last vertex just added. OpenGL/OpenSceneGraph always redraws the entire geometry each frame. There is no such thing as 'existing' (already drawn) geometry. Does anyone know if there is a way to do that? Thx! :) There isn't. (Well, if your camera doesn't move and the rest of the scene is completely static, you could store the frame and depth buffer of the last frame, load that every time and only draw what has changed. But in your case that's probably not worth the trouble.) Instead, try to make it as simple as possible for OSG to discard geometry. For example you could batch line segments together (say everything in a 100m radius) so that OSG can cull that Drawable if it's outside the view frustum. Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] readShaderFile doesn't use findDataFile
Snicker. The osg library can't have a dependency on osgDB. Duh! Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com http://www.skew-matrix.com/ +1 303 859 9466 _ From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Paul Martz Sent: Saturday, May 23, 2009 2:49 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] readShaderFile doesn't use findDataFile Hi Robert and others -- Is there a reason why the osg::Shader static method readShaderFile() doesn't use osgDB::findDataFile to locate the specified file? This seems like an accidental omission of functionality. If so, I'd be glad to submit a patch. But I wanted to check first to see if there was some logic behind the code being the way it is (app must call findDataFile first, then pass in the result). Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com http://www.skew-matrix.com/ +1 303 859 9466 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
2009/5/23 Paul Griffiths gaffe...@gmail.com: Enabling/disabling clipPlanes won't do the job, your looking at the side and into the scroll window at the same time. From what i can work out, clipPlanes slice all the way along the model and remove the outer half, so any clipping applied is going to effect what I see at the front of the scroll window too. Or am I missing something? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12839#12839 Is this what you are after? http://www.sstk.co.uk/portalRendering/portal.php -- http://www.ssTk.co.uk ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] texture and material of geode
Hi, I run into problem when I assigned both material and texture to a geode. If I have just either material(ambient, diffuse, etc) or texture, it worked fine. However, if I have both of them, the geo looks black. Is there thing I need to do to blend the texture and the material? Thank you! Cheers, Rabbi -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12849#12849 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
Simon Hammett wrote: 2009/5/23 Paul Griffiths : Enabling/disabling clipPlanes won't do the job, your looking at the side and into the scroll window at the same time. From what i can work out, clipPlanes slice all the way along the model and remove the outer half, so any clipping applied is going to effect what I see at the front of the scroll window too. Or am I missing something? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12839#12839 Is this what you are after? http://www.sstk.co.uk/portalRendering/portal.php -- http://www.ssTk.co.uk ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum Yes, that is what im trying to achieve. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=12851#12851 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Single-sided ClipPlane?
http://www.sstk.co.uk/portalRendering/portal.php Unless I'm missing something, couldn't you do this in OSG using an Occluder (for host-side culling) and the stencil buffer (to control screen rendering)? Paul Martz Skew Matrix Software LLC http://www.skew-matrix.com +1 303 859 9466 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org