Re: [osg-users] IntersectVisitor does not recognize Nodes on different Projection
Hi, OK. Thank you. Got it working now. Changed setProjectionMatrixOrtho2D into setProjectionMatrixOrtho. Next problem that i have is that the Buttons in my SceneGraph consist of several geometries and the Button is a Geode but its not recognized as Geode. Only as several Geometries. I dont know how to solve this. After going through the API i found Geode-setNodeMask. Could this help maybe? Ive no idea what a nodemask is though... Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20497#20497 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] IntersectVisitor does not recognize Nodes on different Projection
Hi, Thanks for the tip but i dont see the difference which makes it work and mine not. Ive changed some parts of my code but i in my opinion it should work. Any further help is highly anticipated. Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20374#20374 Attachments: http://forum.openscenegraph.org//files/tgeventhandler_168.hpp http://forum.openscenegraph.org//files/thyrgon_624.cpp ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] IntersectVisitor does not recognize Nodes on different Projection
Hi, I've got a loaded model which is a child of the root. the second child of the root node is a ortho2d projection, which i use for the GUI. Now i've taken the example osgkeyboardmouse from the osg site and my problem is that it only catches intersections with the loaded model. Not with the Goedes which are at the Ortho2D ProjectionMatrix. double w(.05), h(.05); osgUtil::PolytopeIntersector* picker = new osgUtil::PolytopeIntersector( osgUtil::Intersector::PROJECTION, x-w, y-h, x+w, y+h); osgUtil::IntersectionVisitor iv(picker); viewer-getCamera()-accept(iv); this is how i configured the Visitor. I've tried to change the Intersector into a osg::Intersector::WINDOW. ut then absolutely nothing happens anymore. Thanks in advance. Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20283#20283 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Functioncall error
Hi, Here's the code first: class TGTextNode : public osg::Geode { public: TGTextNode(std::string T_Text, int T_Size, int T_Res, int T_PosX, int T_PosY, int T_PosZ); void addOutline(); }; TGTextNode::TGTextNode(std::string T_Text, int T_Size, int T_Res, int T_PosX, int T_PosY, int T_PosZ) { osg::ref_ptrosgText::Text textobj = new osgText::Text; textobj-setAlignment(osgText::Text::CENTER_CENTER); textobj-setCharacterSize(T_Size); textobj-setFont(bewilder.ttf); textobj-setFontResolution(T_Res, T_Res); textobj-setPosition(osg::Vec3(T_PosX, T_PosY, T_PosZ)); textobj-setColor(osg::Vec4(100, 50, 0, 1)); textobj-setAxisAlignment(osgText::Text::SCREEN); textobj-setText(T_Text); //textobj-setBackdropType(osgText::Text::OUTLINE); //textobj-setBackdropColor(osg::Vec4(1,.1,.1,1)); textobj-setDataVariance(osg::Object::DYNAMIC); this-addDrawable(textobj.get()); } void TGTextNode::addOutline() { textobj-setBackdropType(osgText::Text::OUTLINE); textobj-setBackdropColor(osg::Vec4(1,.1,.1,1)); } The point is that textobj in Function addOutline is an unknown member for the compiler. My first thought was that i need an copyconstructor. I tried to implement one but with no success. Can you help me. I know that this is maybe a bit noobish, but im really stuck here. Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19710#19710 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] std::vector instances from osg::geode derived class error
Hi, Thanks for your help. I'm a bit further now and everything works fine. That is what i did std::vectorosg::ref_ptrTGWidgetElement ElementUpper; std::vectorosg::ref_ptrTGWidgetElement ElementLower; for(i=count_width; i0; i--, elementindex_w++) { ElementLower.push_back(new TGWidgetElement(size,size,posXLL, posY, WidgElementSideLower.png)); ElementUpper.push_back(new TGWidgetElement(size,size,posXLL, posYUR, WidgElementSideUpper.png)); posXLL += size; ElementUpper[elementindex_w].get()-setDataVariance(osg::Object::DYNAMIC); ElementLower[elementindex_w].get()-setDataVariance(osg::Object::DYNAMIC); this-addChild(ElementUpper[elementindex_w].get()); this-addChild(ElementLower[elementindex_w].get()); } actually im working on the handler. This problem is solved. Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19671#19671 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] std::vector instances from osg::geode derived class error
Hi, OK, so I cleaned up my code and changed the instaciation to use the ref_ptr. When i start my Program now the Segmentation Fault is gone. Instead this output is shown *** glibc detected *** ./thyrgon: free(): invalid pointer: 0x012677c8 *** === Backtrace: = /lib/libc.so.6[0x7f8a71e7cdd6] /lib/libc.so.6(cfree+0x6c)[0x7f8a71e8170c] /usr/lib/libosg.so.56(_ZN3osg4NodeD2Ev+0x441)[0x7f8a72faa2d1] ./thyrgon[0x40ebc0] /usr/lib/libosg.so.56(_ZN3osg5GroupD2Ev+0xe2)[0x7f8a72f67812] /usr/lib/libosg.so.56(_ZN3osg15MatrixTransformD0Ev+0x17)[0x7f8a72fa4fb7] /usr/lib/libosg.so.56(_ZN3osg5GroupD2Ev+0xe2)[0x7f8a72f67812] /usr/lib/libosg.so.56(_ZN3osg10ProjectionD0Ev+0x17)[0x7f8a72fc6e57] /usr/lib/libosg.so.56(_ZN3osg5GroupD0Ev+0xea)[0x7f8a72f6708a] ./thyrgon[0x40f793] ./thyrgon[0x40f9da] /lib/libc.so.6(__libc_start_main+0xfd)[0x7f8a71e25abd] ./thyrgon[0x408e89] especially the invalid pointer seems to be interesting. Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19571#19571 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] std::vector instances from osg::geode derived class error
Hi, I'm trying to instanciate TGWidgetElement with a std::vector, which derives from osg::geode with a std::vector but it gives following errors. -- Compiler Output: In file included from /usr/include/osg/Group:17, from TGBaseWidget.hpp:11, from TGBaseWidget.cpp:1: /usr/include/osg/Node:60: instantiated from ‘void std::vector_Tp, _Alloc::_M_insert_aux(__gnu_cxx::__normal_iteratortypename std::_Vector_base_Tp, _Alloc::_Tp_alloc_type::pointer, std::vector_Tp, _Alloc , const _Tp) [with _Tp = TGWidgetElement, _Alloc = std::allocatorTGWidgetElement]’ /usr/include/c++/4.4/bits/stl_vector.h:741: instantiated from ‘void std::vector_Tp, _Alloc::push_back(const _Tp) [with _Tp = TGWidgetElement, _Alloc = std::allocatorTGWidgetElement]’ TGBaseWidget.cpp:64: instantiated from here /usr/include/osg/Object:169: error: ‘osg::Object osg::Object::operator=(const osg::Object)’ is private /usr/include/osg/Node:60: error: within this context /usr/include/osg/Geode: In member function ‘osg::Geode osg::Geode::operator=(const osg::Geode)’: In file included from /usr/include/osgDB/SharedStateManager:19, from /usr/include/osgDB/DatabasePager:29, from /usr/include/osgDB/Registry:26, from /usr/include/osgDB/ReadFile:24, from TGWidgetElement.hpp:15, from TGBaseWidget.hpp:12, from TGBaseWidget.cpp:1: /usr/include/osg/Geode:29: instantiated from ‘void std::vector_Tp, _Alloc::_M_insert_aux(__gnu_cxx::__normal_iteratortypename std::_Vector_base_Tp, _Alloc::_Tp_alloc_type::pointer, std::vector_Tp, _Alloc , const _Tp) [with _Tp = TGWidgetElement, _Alloc = std::allocatorTGWidgetElement]’ /usr/include/c++/4.4/bits/stl_vector.h:741: instantiated from ‘void std::vector_Tp, _Alloc::push_back(const _Tp) [with _Tp = TGWidgetElement, _Alloc = std::allocatorTGWidgetElement]’ TGBaseWidget.cpp:64: instantiated from here /usr/include/osg/Geode:29: note: synthesized method ‘osg::Node osg::Node::operator=(const osg::Node)’ first required here TGWidgetElement.hpp: In member function ‘TGWidgetElement TGWidgetElement::operator=(const TGWidgetElement)’: In file included from TGBaseWidget.hpp:12, from TGBaseWidget.cpp:1: TGWidgetElement.hpp:19: instantiated from ‘void std::vector_Tp, _Alloc::_M_insert_aux(__gnu_cxx::__normal_iteratortypename std::_Vector_base_Tp, _Alloc::_Tp_alloc_type::pointer, std::vector_Tp, _Alloc , const _Tp) [with _Tp = TGWidgetElement, _Alloc = std::allocatorTGWidgetElement]’ /usr/include/c++/4.4/bits/stl_vector.h:741: instantiated from ‘void std::vector_Tp, _Alloc::push_back(const _Tp) [with _Tp = TGWidgetElement, _Alloc = std::allocatorTGWidgetElement]’ TGBaseWidget.cpp:64: instantiated from here TGWidgetElement.hpp:19: note: synthesized method ‘osg::Geode osg::Geode::operator=(const osg::Geode)’ first required here /usr/include/c++/4.4/bits/vector.tcc: In member function ‘void std::vector_Tp, _Alloc::_M_insert_aux(__gnu_cxx::__normal_iteratortypename std::_Vector_base_Tp, _Alloc::_Tp_alloc_type::pointer, std::vector_Tp, _Alloc , const _Tp) [with _Tp = TGWidgetElement, _Alloc = std::allocatorTGWidgetElement]’: In file included from /usr/include/c++/4.4/vector:69, from /usr/include/osg/StateAttribute:23, from /usr/include/osg/StateSet:18, from /usr/include/osg/Node:19, from /usr/include/osg/Group:17, from TGBaseWidget.hpp:11, from TGBaseWidget.cpp:1: /usr/include/c++/4.4/bits/vector.tcc:312: note: synthesized method ‘TGWidgetElement TGWidgetElement::operator=(const TGWidgetElement)’ first required here make[2]: *** [build/Release/GNU-Linux-x86/TGBaseWidget.o] Fehler 1 make[2]: Verlasse Verzeichnis '/home/thorsten/NetBeansProjects/thyrgon~subversion/Thyrgon' make[1]: *** [.build-conf] Fehler 2 make[1]: Verlasse Verzeichnis '/home/thorsten/NetBeansProjects/thyrgon~subversion/Thyrgon' make: *** [.build-impl] Fehler 2 --- The Code: int posX = 585; int posY = 370; std::vectorTGWidgetElement ElementLower; for(int i=count_width; i0; i--) { ElementLower.push_back(TGWidgetElement(posX, posY, WidgElementSideLower.png)); posX += 15; posY += 15; //this-addChild(ElementLower[count_width]); } I'm really stuck here. What am i doing wrong??? Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19491#19491 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] std::vector instances from osg::geode derived class error
Hi, Ahhh. Ok that worked. But now i uncommented Code: this-addChild(ElementLower[count_width]); It compiles but gives a Segmentation Fault at startup. Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19496#19496 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] std::vector instances from osg::geode derived class error
Hi, It only gives a segfault if count_width is higher than 1. I've no idea what could be wrong... Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19502#19502 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] std::vector instances from osg::geode derived class error
Hi, Thanks. the difference is the both couts that i did sow both instances now. Afterwards i get a segfault again. Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19505#19505 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Texture is rendered strange
Hi, Well the Fileformat isnt a copypaste error. I just have 2 versions of that file. The texcoords are indeed copypaste errors. Must have been too late :? Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19363#19363 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Texture is rendered strange
Hi, Yes, I changed the 4 zeros to 0,1,2,3 in the array. Working fine now. Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19366#19366 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Texture is rendered strange
Hi, Ive got a Problem. I have a Texture file loaded to a osg::Geometry. It is rendered completely different to what it looks like in the gimp. Why? Here is the code: Code: osg::Geometry* WidgElementGeometry = new osg::Geometry(); osg::Vec3Array* WidgElementVert = new osg::Vec3Array; WidgElementVert-push_back(osg::Vec3(750,550,-1)); WidgElementVert-push_back(osg::Vec3(800,550,-1)); WidgElementVert-push_back(osg::Vec3(800,600,-1)); WidgElementVert-push_back(osg::Vec3(750,600,-1)); osg::DrawElementsUInt* WidgElementInd = new osg::DrawElementsUInt(osg::PrimitiveSet::POLYGON,0); WidgElementInd-push_back(0); WidgElementInd-push_back(1); WidgElementInd-push_back(2); WidgElementInd-push_back(3); osg::Vec2Array* texcoords = new osg::Vec2Array(4); (*texcoords)[0].set(0.0f, 0.0f); (*texcoords)[0].set(1.0f, 0.0f); (*texcoords)[0].set(1.0f, 1.0f); (*texcoords)[0].set(0.0f, 1.0f); WidgElementGeometry-setTexCoordArray(0,texcoords); osg::Texture2D* WidgElementTexture = new osg::Texture2D; WidgElementTexture-setDataVariance(osg::Object::DYNAMIC); osg::Image* WidgElementImage; WidgElementImage = osgDB::readImageFile(WidgElementCorner.tga); WidgElementTexture-setImage(WidgElementImage); osg::Vec3Array* WidgElementNormals = new osg::Vec3Array; WidgElementNormals-push_back(osg::Vec3(0.0f, 0.0f, 1.0f)); WidgElementGeometry-setNormalArray(WidgElementNormals); WidgElementGeometry-setNormalBinding(osg::Geometry::BIND_OVERALL); WidgElementGeometry-addPrimitiveSet(WidgElementInd); WidgElementGeometry-setVertexArray(WidgElementVert); osg::Geode* WidgGeode = new osg::Geode(); WidgGeode-addDrawable(WidgElementGeometry); osg::StateSet* WidgElementStateSet = new osg::StateSet(); WidgGeode-setStateSet(WidgElementStateSet); WidgElementStateSet-setTextureAttributeAndModes(0,WidgElementTexture, osg::StateAttribute::ON); WidgElementStateSet-setMode(GL_BLEND, osg::StateAttribute::ON); WidgElementStateSet-setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); WidgElementStateSet-setRenderingHint(osg::StateSet::TRANSPARENT_BIN); Thank you! Cheers, Thorsten -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=19331#19331 attachment: Bildschirmfoto.pngattachment: WidgElementCorner.png___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org