Re: [osg-users] Caching images
Hi, I know Thank you! Cheers, simon -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48589#48589 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to create osg::Texture2D from osg::Vec3Array...?
Hi, The normal method given in many examples to create a Texture2D, is using a Image file. Code: osg::ref_ptrosg::Texture2D texture = new osg::Texture2D; osg::ref_ptrosg::Image image = osgDB::readImageFile(Images/lz.rgb ); texture-setImage( image.get() ); Instead, I have a osg::Vect4Array in which I have color information (rgba). How can I use this Vec4Array to create Texture2D? Thank you! Cheers, Kedar -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48585#48585 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] ECEF Oriented Compass Implementation
Hi, I have an ECEF terrain and I want to implement a compass node to show the true north to the user. I tried the code below but at some angles it does not work correctly. When the camera is vertical (birds eye view) to the terrain, it works perfect but if you rotate the camera (elevation or roll) it does not show the correct value. thanks, class Compass : public osg::Camera { public: Compass(void) { } Compass( const Compass copy, osg::CopyOp copyop = osg::CopyOp::SHALLOW_COPY ): osg::Camera(copy, copyop), _plateTransform(copy._plateTransform), _needleTransform(copy._needleTransform), _mainCamera(copy._mainCamera), m_bIsFirst(false) { } Compass::~Compass(void) { } META_Node( osg, Compass ); void setPlate( osg::MatrixTransform* plate ) { _plateTransform = plate; } void setNeedle( osg::MatrixTransform* needle ) { _needleTransform = needle; } void setMainCamera( osg::Camera* camera ) { _mainCamera = camera; } virtual void traverse( osg::NodeVisitor nv ) { if ( _mainCamera.valid() nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR ) { osg::Matrix matrix = _mainCamera-getViewMatrix(); matrix.setTrans( osg::Vec3() ); osg::Vec3 northVec = osg::Z_AXIS * matrix; northVec.z()= 0.0; northVec.normalize(); osg::Vec3 axis = osg::Y_AXIS ^ northVec; float angle = atan2(axis.length(), osg::Y_AXIS*northVec); axis.normalize(); if ( _plateTransform.valid() ) { _plateTransform-setMatrix( osg::Matrix::rotate(angle, axis) ); } _plateTransform-accept( nv ); _needleTransform-accept( nv ); osg::Camera::traverse( nv ); } } osg::MatrixTransform* createCompassPlate( const std::string image, float radius, float height) { osg::Vec3 center(-radius, -radius, height); osg::ref_ptrosg::Geode geode = new osg::Geode; geode-addDrawable(createTexturedQuadGeometry(center, osg::Vec3(radius*2.0f,0.0f,0.0f), osg::Vec3(0.0f,radius*2.0f,0.0f)) ); osg::ref_ptrosg::Texture2D texture = new osg::Texture2D; texture-setImage(osgDB::readImageFile(image)); osg::ref_ptrosg::MatrixTransform part =new osg::MatrixTransform(); part-getOrCreateStateSet()-setTextureAttributeAndModes(0, texture.get() ); part-getOrCreateStateSet()-setRenderingHint(osg::StateSet::TRANSPARENT_BIN ); part-addChild(geode.get()); return part.release(); } osg::MatrixTransform* createCompassNeedle( const std::string image, float radius, float height) { osg::Vec3 center(-radius/4, -radius, height); osg::ref_ptrosg::Geode geode = new osg::Geode; geode-addDrawable(createTexturedQuadGeometry(center, osg::Vec3(radius/2,0.0f,0.0f), osg::Vec3(0.0f,radius*2,0.0f)) ); osg::ref_ptrosg::Texture2D texture = new osg::Texture2D; texture-setImage(osgDB::readImageFile(image)); osg::ref_ptrosg::MatrixTransform part =new osg::MatrixTransform(); part-getOrCreateStateSet()-setTextureAttributeAndModes(0, texture.get() ); part-getOrCreateStateSet()-setRenderingHint(osg::StateSet::TRANSPARENT_BIN ); part-addChild(geode.get()); return part.release(); } protected: osg::ref_ptrosg::MatrixTransform _plateTransform; osg::ref_ptrosg::MatrixTransform _needleTransform; osg::observer_ptrosg::Camera _mainCamera; bool m_bIsFirst; }; -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48579#48579 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] More than 8 lights
Hi, I am building a deferred rendering system in open scene graph and all work well, except for one part. There can be many more lights than the default of 8 and this causes OSG to post many warnings. gDebugger for instance halts on glEnable(GL_LIGHTX) as the X goes beyond 7. I tried turning of the lights by setting View-setLight(NULL); I also tried removing the entire lightsource from the scene as it is only used for obtainin the properties exported from 3DS max. Still no luck. So, my question is, how can i get rid of the FFP lights? Regards, Bk- -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48533#48533 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Android: Problem with static intialization in osgViewer/Scene.cpp (from r13031)
Robert, It's working on my GLES 2 app as well. Thanks, James -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48599#48599 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] The problem of loading a model in osg
Hi, I'am just beginner of osg. We I test the code of loading a model and dislay it in the screen. I have met a problem. My code is #include #include int main(int argc,char** argv) { osgViewer::Viewer viewer; osg::Node* Node_Reader=NULL; Node_Reader=osgDB::readNodeFile(C:\\Program Files\\OpenSceneGraph\\data\\clock.org); viewer.setSceneData(Node_Reader); return viewer.run(); } There is no problem of compilation, but the program is lanched, it is blocked in the phrase osgDB::readNodeFile. The information of error is like this: Unhandled exception at 0x7c812afb in OSG_Rugby.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012f5c4.. The enviroment is :windows 7+VS2008+osg 2.99 Thank you! Cheers, simon -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48590#48590 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Parallel Rendering Problems using NVidia GPU cards in Windows
On 26. Jun 2012, at 8:57, GeeKer Wang wrote: In fact, Windows NVidia driver will try to send OpenGL cammands to all GPU when SLI model disabled. NVidia drivers =256.0 send the commands to the most powerful GPU and then blit the result to the display GPU. You can override the GPU on a per-application base in the control panel, afaik. On Linux this is a non-issue, as you address the GPUs through X screens. Cheers, Stefan. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Parallel Rendering Problems using NVidia GPU cards in Windows
how about 2 same GPUs? 在 2012-6-29,21:18,Stefan Eilemann eilem...@gmail.com 写道: On 26. Jun 2012, at 8:57, GeeKer Wang wrote: In fact, Windows NVidia driver will try to send OpenGL cammands to all GPU when SLI model disabled. NVidia drivers =256.0 send the commands to the most powerful GPU and then blit the result to the display GPU. You can override the GPU on a per-application base in the control panel, afaik. On Linux this is a non-issue, as you address the GPUs through X screens. Cheers, Stefan. ___ 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