[osg-users] Rend to Texture Once
Hi, I want to render a ploygon to texture,I won't change this polygon unless the polygon data changes. what can I do to render the texture only once, instead of rendering every frame? Cheers GuiYe___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to set the shadow color of pssm?
Hi, I'm using osgShadow::ParallelSplitShadowMap Shadow Technique,but I can not find function to set shadow color ? Could you tell me what should i do ? Cheers___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Earth using VPB
Hi, Who can tell me how to make a earth with terrain(DEM) and Satellite-Image using VPB as Google Earth? Sorry for my poor English. Thank you ! Good Luck! Cheers GuiYe___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] About vpbmaster problem
Thank you very much for your reply! Yes,I want to do a smooth elevation transition from area with DEM to area without DEM. About this possibility: a) modify your DEM sources to a image format, and at the border of your DEM region blend the gray values smoothly into the null value Can you give me more information?The dem.tif is some of ASTER 30m Data.How I should do ? Thank you ! Cheers, GuiYe At 2011-05-17 14:21:40,Torben Dannhauer tor...@dannhauer.info wrote: Hi GuiYe, do you want a smooth elevation transition from area with DEM to area without DEM? Then you have several possibilities: a) modify your DEM sources to a image format, and at the border of your DEM region blend the gray values smoothly into the null value b) modify your viewer to perform runtime elevation modifikation to create a smooth transition c) Modify osgdem to create the transition. Thank you! Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39446#39446 ___ 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] About vpbmaster problem
Thank you! How about strm 90m DEM? Do you make terrain in earth as I do? Cheers, GuiYe At 2011-05-17 17:35:48,Torben Dannhauer tor...@dannhauer.info wrote: Hi, You use ASTER data? Am I right that ASTER is public available? I played 2 years ago with the ASTER data as it was initially released. It has great resolution, but it had also lots of artefacts. Do you use raw or somehow corrected ASTER data? - As you can see, I'm on the never ending quest for public available DEM and texture data :) Well, in the DEM raster data, some value represents zero meters elevation. To achieve a smooth transition, you should blend at the border of your source images from your original value to that null value. In a geotiff, this would be a blending of the grey value (which represents the elevation). You can perform this blending in a graphical software like gimp. Your blending zone has to be a frame at the border of your DEM region. You have to blend from the original elevation value to the 0 meters elevation value -for example with a alpha value ramp (inside your blending zone 100% elevation and 0% 0-meters-color, at the outer border of your DEM-Data 0% elevation and 100% 0-meters-color) Sorry for that bad explanation.. :) Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39454#39454 ___ 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
[osg-users] Gecko Plugins
Hello! Who can tell me how to compile the plugins of gecko!I download xulrunner-1.9.en-US.win32.sdk.zip,but it can't compile right: llembeddedbrowser.cpp f:\web\llmozlib2\llembeddedbrowser.cpp(227) : error C2039: 'Create' : is not a member of 'nsIAppShell' f:\web\xulrunner-1.9.1.4.en-us.win32.sdk\xulrunner-sdk\include\widget\nsiappshell.h(29) : see declaration of 'nsIAppShell' f:\web\llmozlib2\llembeddedbrowser.cpp(228) : error C2039: 'Spinup' : is not a member of 'nsIAppShell' f:\web\xulrunner-1.9.1.4.en-us.win32.sdk\xulrunner-sdk\include\widget\nsiappshell.h(29) : see declaration of 'nsIAppShell' f:\web\llmozlib2\llembeddedbrowser.cpp(374) : error C2059: syntax error : ',' f:\web\llmozlib2\llembeddedbrowser.cpp(374) : error C3861: 'NS_STATIC_CAST': identifier not found llembeddedbrowserwindow.cpp f:\web\llmozlib2\llembeddedbrowserwindow.cpp(64) : fatal error C1083: Cannot open include file: 'nsICaret.h': No such file or directory What should I do? Thank you ! ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] About virtual file system problem!
Hello,everyone! In following tutorial,I see how to implement a mechanism for reading osg resources -- such as images, osg and ive files, fonts, etc. -- from a virtual file system. http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/VFS I finish the code according to that tutorial--ReaderPhysFS.cpp!It can be compile and run right(having two files:osgdb_physfsd.dll,osgdb_physfs.dll).But when I read file,it is wrong!!The cessna.osg is the model of OSGData. Can you tell me why??Thank you! osgDB::Registry::instance()-addFileExtensionAlias(physfs,physfs); osg::Group* root = new osg::Group(); std::string fileName = cessna.osg; osg::Node* node = osgDB::readNodeFile(fileName + .physfs); ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgTerrain
Hello,robert! Can you provide some examples about how to use the library of osgTerrain except osgTerrain! The library is so complex that I don't know how to use it to render terrain data! Can you provide some documents about the library! On the other hand , I hope that the example of osgTerrain with its' own data to show the screenshot!Can you give me the data to run the example? Thank you! Good Luck! ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] The Bug of osgparticleeffects??
Yes ,I konw it .But when I do this,it's wrong.Can you tell me why? class PHandler : public osgGA::GUIEventHandler { public: PHandler() {} bool handle(const osgGA::GUIEventAdapter ea,osgGA::GUIActionAdapter aa) { osgViewer::Viewer* viewer = dynamic_castosgViewer::Viewer*(aa); osg::Group* group = dynamic_castosg::Group*(viewer-getSceneData()) ; group-setDataVariance(osg::Object::DYNAMIC) ; osgParticle::ExplosionEffect* ee =dynamic_castosgParticle::ExplosionEffect*(group-getChild(1)) ; switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::PUSH): { if(ee-areAllParticlesDead()) { group-removeChild(1) ; } } return false; default: return false; } } }___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] The Bug of osgparticleeffects?? (Tomlinson, Gordon)
These are all my code.Can you help me rewrite the code??I want to remove the particle effects when the particle effects disappear.But now it does't work fine. Thank you!Good Lucky! #include osgViewer/Viewer #include osgViewer/ViewerEventHandlers #include osg/DeleteHandler #include osg/Group #include osg/Geode #include osg/ShapeDrawable #include osg/Texture2D #include osg/PositionAttitudeTransform #include osg/MatrixTransform #include osg/io_utils #include osgUtil/Optimizer #include osgUtil/IntersectVisitor #include osgDB/ReadFile #include osgText/Text #include osgParticle/ExplosionEffect #include osgParticle/ExplosionDebrisEffect #include osgParticle/SmokeEffect #include osgParticle/SmokeTrailEffect #include osgParticle/FireEffect #include terrain_coords.h //the file you can find in the example of osghangglide. osg::Vec3 wind(1.0f,0.0f,0.0f); osg::AnimationPath* createAnimationPath(const osg::Vec3 center,float radius,double looptime) { osg::AnimationPath* animationPath = new osg::AnimationPath; animationPath-setLoopMode(osg::AnimationPath::LOOP); int numSamples = 40; float yaw = 0.0f; float yaw_delta = 2.0f*osg::PI/((float)numSamples-1.0f); float roll = osg::inDegrees(30.0f); double time=0.0f; double time_delta = looptime/(double)numSamples; for(int i=0;inumSamples;++i) { osg::Vec3 position(center+osg::Vec3(sinf(yaw)*radius,cosf(yaw)*radius,0.0f)); osg::Quat rotation(osg::Quat(roll,osg::Vec3(0.0,1.0,0.0))*osg::Quat(-(yaw+osg::inDegrees(90.0f)),osg::Vec3(0.0,0.0,1.0))); animationPath-insert(time,osg::AnimationPath::ControlPoint(position,rotation)); yaw += yaw_delta; time += time_delta; } return animationPath; } osg::Node* createMovingModel(const osg::Vec3 center, float radius) { float animationLength = 10.0f; osg::AnimationPath* animationPath = createAnimationPath(center,radius,animationLength); osg::Group* model = new osg::Group; osg::Node* glider = osgDB::readNodeFile(glider.osg); if (glider) { const osg::BoundingSphere bs = glider-getBound(); float size = radius/bs.radius()*0.15f; osg::MatrixTransform* positioned = new osg::MatrixTransform; positioned-setDataVariance(osg::Object::STATIC); positioned-setMatrix(osg::Matrix::translate(-bs.center())* osg::Matrix::scale(size,size,size)* osg::Matrix::rotate(osg::inDegrees(-90.0f),0.0f,0.0f,1.0f)); positioned-addChild(glider); osg::PositionAttitudeTransform* xform = new osg::PositionAttitudeTransform; xform-setDataVariance(osg::Object::DYNAMIC); xform-getOrCreateStateSet()-setMode(GL_NORMALIZE, osg::StateAttribute::ON); xform-setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0,0.5)); xform-addChild(positioned); model-addChild(xform); } osg::Node* cessna = osgDB::readNodeFile(cessna.osg); if (cessna) { const osg::BoundingSphere bs = cessna-getBound(); float size = radius/bs.radius()*0.15f; osg::MatrixTransform* positioned = new osg::MatrixTransform; positioned-getOrCreateStateSet()-setMode(GL_NORMALIZE, osg::StateAttribute::ON); positioned-setDataVariance(osg::Object::STATIC); positioned-setMatrix(osg::Matrix::translate(-bs.center())* osg::Matrix::scale(size,size,size)* osg::Matrix::rotate(osg::inDegrees(180.0f),0.0f,0.0f,1.0f)); positioned-addChild(cessna); osg::MatrixTransform* xform = new osg::MatrixTransform; xform-setDataVariance(osg::Object::DYNAMIC); xform-setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0f,1.0)); xform-addChild(positioned); model-addChild(xform); } return model; } osg::Vec3 computeTerrainIntersection(osg::Node* subgraph,float x,float y) { osgUtil::IntersectVisitor iv; osg::ref_ptrosg::LineSegment segDown = new osg::LineSegment; const osg::BoundingSphere bs = subgraph-getBound(); float zMax = bs.center().z()+bs.radius(); float zMin = bs.center().z()-bs.radius(); segDown-set(osg::Vec3(x,y,zMin),osg::Vec3(x,y,zMax)); iv.addLineSegment(segDown.get()); subgraph-accept(iv); if (iv.hits()) { osgUtil::IntersectVisitor::HitList hitList = iv.getHitList(segDown.get()); if (!hitList.empty()) { osg::Vec3 ip = hitList.front().getWorldIntersectPoint(); return ip; } } return osg::Vec3(x,y,0.0f); } void build_world(osg::Group *root) { osg::Geode* terrainGeode = new osg::Geode; { osg::StateSet* stateset = new osg::StateSet(); osg::Image* image = osgDB::readImageFile(Images/lz.rgb); if (image) { osg::Texture2D* texture = new osg::Texture2D; texture-setImage(image); stateset-setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); } terrainGeode-setStateSet( stateset ); float size = 1000; // 10km; float scale = size/39.0f; // 10km; float z_scale = scale*3.0f; osg::HeightField* grid = new osg::HeightField; grid-allocate(38,39); grid-setXInterval(scale); grid-setYInterval(scale); for(unsigned int r=0;r39;++r) { for(unsigned int c=0;c38;++c) {
[osg-users] The Bug of osgparticleeffects??
Hello. I tested the example of osgparticleeffects yesterday.I find a problem:When we create particle effects to the scene and the particle effects disappeared,the memory don't release.If we add many particle effects,the memory will increase all the time until the end of the program.Who can tell me how to release the memory when the particle effects disappeared?Is it the bug of ParticleSystem??? Thank you!!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] The Bug of osgparticleeffects?? (Tomlinson, Gordon)
No,I don't know how to remove the particle effects from the scene.Can you give me some code to do this? Thank you~___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] About Image
Hello,Robert. Yes,you are right. But I don't know how to rewrite the program.Can you tell me how to do this??Can you give me a new example Thank you I guess at what you meant. Is it that you want to do an offscreen render of your scene at higher resolution that the frame buffer, and then write this to disk. If this is the question your are answering then the answer is to use a pbuffer or FBO to create the desired size of image, render to this, then copy the image and write it to disk. The osgscreencapture example has an example of using a pbuffer to do offscreen rendering. Robert. 2008/8/29 GuiYe Hello~~ I want to ask a question about how to write(osgDB::writeImageFile()) a capture_screen_image that I hope it's size bigger than the window size into the disk.For example,my window size is 1280*1024,but the size of image is 2560*1024.I use scaleImage(),but it doesn't work. Can you tell me what should I do?Thank you~ ___ 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] About Image~~
Hello~~ I want to ask a question about how to write(osgDB::writeImageFile()) a capture_screen_image that I hope it's size bigger than the window size into the disk.For example,my window size is 1280*1024,but the size of image is 2560*1024.I use scaleImage(),but it doesn't work. Can you tell me what should I do?Thank you~___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Add A Window
Hello,Robert. Thanks for your reversion.I'm so happy that I can add a new window in realtime.But there is a new problem :how to destroy the new window.I find that stopThreading can't destroy the window.Thanks. Waiting for you good news. // // #include osgDB/ReadFile #include osgUtil/Optimizer #include osgViewer/Viewer #include osgGA/MatrixManipulator #include osgGA/TrackballManipulator #include osgGA/StateSetManipulator #include iostream #include osg/Node #include osg/Geode #include osg/Geometry #include osgViewer/Viewer class MyWindowHandler:public osgGA::GUIEventHandler { public: MyWindowHandler(): OneOrTwo(false) {} ~MyWindowHandler(){} bool handle(const osgGA::GUIEventAdapter ea, osgGA::GUIActionAdapter aa) { osgViewer::Viewer* viewer = dynamic_castosgViewer::Viewer*(aa) ; switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYDOWN): { if(ea.getKey()==osgGA::GUIEventAdapter::KEY_F1) { OneOrTwo = !OneOrTwo ; viewer-stopThreading(); if(OneOrTwo) { int xoffset = 40; int yoffset = 40; viewer-stopThreading() ; viewer-startThreading() ; //{ // osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; // traits-x = xoffset + 0; // traits-y = yoffset + 0; // traits-width = 600; // traits-height = 480; // traits-windowDecoration = true; // traits-doubleBuffer = true; // traits-sharedContext = 0; // osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); // osg::ref_ptrosg::Camera camera = new osg::Camera; // camera-setGraphicsContext(gc.get()); // camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); // GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT; // camera-setDrawBuffer(buffer); // camera-setReadBuffer(buffer); // viewer-addSlave(camera.get(), osg::Matrixd::translate(1.0,0.0,0.0), osg::Matrixd()); //} { osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = xoffset + 600; traits-y = yoffset + 0; traits-width = 600; traits-height = 480; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(gc.get()); camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT; camera-setDrawBuffer(buffer); camera-setReadBuffer(buffer); viewer-addSlave(camera.get(), osg::Matrixd::translate(-1.0,0.0,0.0), osg::Matrixd()); } //viewer-setSceneData(osgDB::readNodeFile(cow.osg)); viewer-realize() ; } return true ; } return false ; } break ; default: return false ; } } public: bool OneOrTwo ; }; int main( int argc, char **argv ) { osg::ArgumentParser arguments(argc,argv); osg::ref_ptrosg::Node loadedModel = osgDB::readNodeFiles(arguments); if (!loadedModel) loadedModel = osgDB::readNodeFile(cow.osg); if (!loadedModel) { std::cout arguments.getApplicationName() : No data loaded std::endl; return 1; } osgViewer::Viewer viewer; int xoffset = 40; int yoffset = 40; //viewer.stopThreading() ; //viewer.startThreading() ; viewer.addEventHandler(new MyWindowHandler()) ; { osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = xoffset + 0; traits-y = yoffset + 0; traits-width = 600; traits-height = 480; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(gc.get()); camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT; camera-setDrawBuffer(buffer); camera-setReadBuffer(buffer); viewer.addSlave(camera.get(), osg::Matrixd::translate(1.0,0.0,0.0), osg::Matrixd()); } viewer.setSceneData(loadedModel.get()); viewer.realize(); //} return viewer.run(); } Hi GuiYe, At present the addSlave doesn't automatically tell the viewer to realize windows, reset up threading and rendering support, which is why you code isn't working. What you need to do in you event handling is to call viewer.stopThreading() first, create you new window/associated view/camera then realize the new window and then call startTheading(). Robert
[osg-users] Add A Window
Hello,I want to add a new window in real time.But the below code doesn't work.Who can tell me why??I face it many days but... Waiting for your good news~~ // // #include osgDB/ReadFile #include osgUtil/Optimizer #include osgViewer/Viewer #include osgGA/MatrixManipulator #include osgGA/TrackballManipulator #include osgGA/StateSetManipulator #include iostream #include osg/Node #include osg/Geode #include osg/Geometry #include osgViewer/Viewer class MyWindowHandler:public osgGA::GUIEventHandler { public: MyWindowHandler(): OneOrTwo(true) {} ~MyWindowHandler(){} bool handle(const osgGA::GUIEventAdapter ea, osgGA::GUIActionAdapter aa) { osgViewer::Viewer* viewer = dynamic_castosgViewer::Viewer*(aa) ; switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYDOWN): { if(ea.getKey()==0xFF52) { OneOrTwo = !OneOrTwo; } if(OneOrTwo) { // right window + right slave camera osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = 600; traits-y = 0; traits-width = 600; traits-height = 480; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(gc.get()); camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT; camera-setDrawBuffer(buffer); camera-setReadBuffer(buffer); // add this slave camera to the viewer, with a shift right of the projection matrix viewer-addSlave(camera.get(), osg::Matrixd::translate(-1.0,0.0,0.0), osg::Matrixd()); return true ; } return false ; } break ; default: return false ; } } public: bool OneOrTwo ; }; int main( int argc, char **argv ) { osg::ArgumentParser arguments(argc,argv); // read the scene from the list of file specified commandline args. osg::ref_ptrosg::Node loadedModel = osgDB::readNodeFiles(arguments); // if not loaded assume no arguments passed in, try use default mode instead. if (!loadedModel) loadedModel = osgDB::readNodeFile(cow.osg); // if no model has been successfully loaded report failure. if (!loadedModel) { std::cout arguments.getApplicationName() : No data loaded std::endl; return 1; } // construct the viewer. osgViewer::Viewer viewer; int xoffset = 40; int yoffset = 40; // left window + left slave camera { osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = xoffset + 0; traits-y = yoffset + 0; traits-width = 600; traits-height = 480; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(gc.get()); camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT; camera-setDrawBuffer(buffer); camera-setReadBuffer(buffer); // add this slave camera to the viewer, with a shift left of the projection matrix viewer.addSlave(camera.get(), osg::Matrixd::translate(1.0,0.0,0.0), osg::Matrixd()); } right window + right slave camera //{ //osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; //traits-x = xoffset + 600; //traits-y = yoffset + 0; //traits-width = 600; //traits-height = 480; //traits-windowDecoration = true; //traits-doubleBuffer = true; //traits-sharedContext = 0; //osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); //osg::ref_ptrosg::Camera camera = new osg::Camera; //camera-setGraphicsContext(gc.get()); //camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); //GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT; //camera-setDrawBuffer(buffer); //camera-setReadBuffer(buffer); //// add this slave camera to the viewer, with a shift right of the projection matrix //viewer.addSlave(camera.get(), osg::Matrixd::translate(-1.0,0.0,0.0), osg::Matrixd()); //} osgUtil::Optimizer optimizer; optimizer.optimize(loadedModel.get()); viewer.addEventHandler(new MyWindowHandler()) ; // set the scene to render viewer.setSceneData(loadedModel.get()); return viewer.run(); } ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Add A Window
Hello,Robert. Thanks for your reversion.I'm so happy that I can add a new window in realtime.But there is a new problem :how to destroy the new window.I find that stopThreading can't destroy the window.Thanks. Waiting for you good news. // // #include osgDB/ReadFile #include osgUtil/Optimizer #include osgViewer/Viewer #include osgGA/MatrixManipulator #include osgGA/TrackballManipulator #include osgGA/StateSetManipulator #include iostream #include osg/Node #include osg/Geode #include osg/Geometry #include osgViewer/Viewer class MyWindowHandler:public osgGA::GUIEventHandler { public: MyWindowHandler(): OneOrTwo(false) {} ~MyWindowHandler(){} bool handle(const osgGA::GUIEventAdapter ea, osgGA::GUIActionAdapter aa) { osgViewer::Viewer* viewer = dynamic_castosgViewer::Viewer*(aa) ; switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYDOWN): { if(ea.getKey()==osgGA::GUIEventAdapter::KEY_F1) { OneOrTwo = !OneOrTwo ; viewer-stopThreading(); if(OneOrTwo) { int xoffset = 40; int yoffset = 40; viewer-stopThreading() ; viewer-startThreading() ; //{ // osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; // traits-x = xoffset + 0; // traits-y = yoffset + 0; // traits-width = 600; // traits-height = 480; // traits-windowDecoration = true; // traits-doubleBuffer = true; // traits-sharedContext = 0; // osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); // osg::ref_ptrosg::Camera camera = new osg::Camera; // camera-setGraphicsContext(gc.get()); // camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); // GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT; // camera-setDrawBuffer(buffer); // camera-setReadBuffer(buffer); // viewer-addSlave(camera.get(), osg::Matrixd::translate(1.0,0.0,0.0), osg::Matrixd()); //} { osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = xoffset + 600; traits-y = yoffset + 0; traits-width = 600; traits-height = 480; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(gc.get()); camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT; camera-setDrawBuffer(buffer); camera-setReadBuffer(buffer); viewer-addSlave(camera.get(), osg::Matrixd::translate(-1.0,0.0,0.0), osg::Matrixd()); } //viewer-setSceneData(osgDB::readNodeFile(cow.osg)); viewer-realize() ; } return true ; } return false ; } break ; default: return false ; } } public: bool OneOrTwo ; }; int main( int argc, char **argv ) { osg::ArgumentParser arguments(argc,argv); osg::ref_ptrosg::Node loadedModel = osgDB::readNodeFiles(arguments); if (!loadedModel) loadedModel = osgDB::readNodeFile(cow.osg); if (!loadedModel) { std::cout arguments.getApplicationName() : No data loaded std::endl; return 1; } osgViewer::Viewer viewer; int xoffset = 40; int yoffset = 40; //viewer.stopThreading() ; //viewer.startThreading() ; viewer.addEventHandler(new MyWindowHandler()) ; { osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = xoffset + 0; traits-y = yoffset + 0; traits-width = 600; traits-height = 480; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(gc.get()); camera-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); GLenum buffer = traits-doubleBuffer ? GL_BACK : GL_FRONT; camera-setDrawBuffer(buffer); camera-setReadBuffer(buffer); viewer.addSlave(camera.get(), osg::Matrixd::translate(1.0,0.0,0.0), osg::Matrixd()); } viewer.setSceneData(loadedModel.get()); viewer.realize(); //} return viewer.run(); } Hi GuiYe, At present the addSlave doesn't automatically tell the viewer to realize windows, reset up threading and rendering support, which is why you code isn't working. What you need to do in you event handling is to call viewer.stopThreading() first, create you new window/associated view/camera then realize the new window and then call startTheading(). Robert. ___ osg
[osg-users] vpb
Hello.I have some question about the svn of VPB. vpbinfo is only used for getting the number of processors?And the vpbextrusion is use for putting two or more terrain models together? When I use vpbheightfieldmapping,I can't find it's data.I also want to know what the vpbheightfieldmapping is used for? std::string modelFile(/home/ledocc/Work/VPB/data/lines.shp); std::string heightFieldFile(/home/ledocc/Work/VPB/data/dtm_200m.tif.gdal); Thanks!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] VPB
Hello ~ I am a new to OSG.Now I'm using OSGDEM,I want to ask to question: the different between --LOD and --PagedLOD when using osgdem the different between --compressed and --RGBA-compressed when using osgdem When the VPB1.0 realse?Thank you~___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] The 3rdParty_Win32binaries_2005_05_10.zip
Hello ,Robert~ The 3rdParty_Win32binaries_2005_05_10.zip should update.If it does not updat, many peopel can't compile OSG2.4!And in China,the svn is so slowly! Thank you!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] About VirtualPlanetBuilder0.9.4~ ~~~
Hello,robert! Today I download VirtualPlanetBuilder0.9.4's source code.When I compile the source code in OpenSceneGraph2.2 , there are many errors.Can you tell me what I can do to solve the problems? On the other hand, I want to ask how to use the VirtualPlanetBuilder0.9.4,it just like VirtualPlanetBuilder0.9.1? Where can I get a detailed document about the user guider of VirtualPlanetBuilder0.9.4? Thank you~~~ Version.cpp ThreadPool.cpp ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\ThreadPool.cpp(147) : error C2039: 'getNumOperationsInQueue' : is not a member of 'osg::OperationQueue' C:\Program Files\OSG2.2.0_vc80\include\osg/OperationThread(97) : see declaration of 'osg::OperationQueue' ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\ThreadPool.cpp(147) : fatal error C1903: unable to recover from previous error(s); stopping compilation TaskManager.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier Task.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier System.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier SpatialProperties.cpp SourceData.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier Source.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2039: 'Vec3dArray' : is not a member of 'osg' ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2065: 'Vec3dArray' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2065: 'vec3darray' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2039: 'Vec3dArray' : is not a member of 'osg' ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2061: syntax error : identifier 'Vec3dArray' ShapeFilePlacer.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\ShapeFilePlacer.cpp(25) : fatal error C1083: Cannot open include file: 'osgUtil/ConvertVec': No such file or directory PropertyFile.cpp ObjectPlacer.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier MachinePool.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier HeightFieldMapper.cpp ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\HeightFieldMapper.cpp(22) : fatal error C1083: Cannot open include file: 'osgUtil/OperationArrayFunctor': No such file or directory GeospatialDataset.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier FileUtils.cpp FileDetails.cpp FileCache.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier ExtrudeVisitor.cpp ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\ExtrudeVisitor.cpp(8) : fatal error C1083: Cannot open include file: 'osgUtil/EdgeCollector': No such file or directory Destination.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier Date.cpp Generating Code... Compiling... DataSet.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(184) : warning C4018: '' : signed/unsigned mismatch ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(462) : warning C4018: '' : signed/unsigned mismatch ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(555) : warning C4018: '' : signed/unsigned mismatch ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(662) : warning C4018: '' : signed/unsigned mismatch ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(1969) : error C2039: 'getMinLevel' : is not a member of 'osgTerrain::Layer' C:\Program Files\OSG2.2.0_vc80\include\osgTerrain/Layer(26) : see declaration of 'osgTerrain::Layer' ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(1970) : error C2039: 'getMaxLevel' : is not a member of 'osgTerrain::Layer' C:\Program Files\OSG2.2.0_vc80\include\osgTerrain/Layer(26) : see declaration of 'osgTerrain::Layer'
[osg-users] About VirtualPlanetBuilder0.9.4~ ~~~
Hello,robert! Today I download VirtualPlanetBuilder0.9.4's source code.When I compile the source code in OpenSceneGraph2.2 , there are many errors.Can you tell me what I can do to solve the problems? On the other hand, I want to ask how to use the VirtualPlanetBuilder0.9.4,it just like VirtualPlanetBuilder0.9.1? Where can I get a detailed document about the user guider of VirtualPlanetBuilder0.9.4? Thank you~~~ Version.cpp ThreadPool.cpp ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\ThreadPool.cpp(147) : error C2039: 'getNumOperationsInQueue' : is not a member of 'osg::OperationQueue' C:\Program Files\OSG2.2.0_vc80\include\osg/OperationThread(97) : see declaration of 'osg::OperationQueue' ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\ThreadPool.cpp(147) : fatal error C1903: unable to recover from previous error(s); stopping compilation TaskManager.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier Task.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier System.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier SpatialProperties.cpp SourceData.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier Source.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2039: 'Vec3dArray' : is not a member of 'osg' ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2065: 'Vec3dArray' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2065: 'vec3darray' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2039: 'Vec3dArray' : is not a member of 'osg' ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\Source.cpp(676) : error C2061: syntax error : identifier 'Vec3dArray' ShapeFilePlacer.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\ShapeFilePlacer.cpp(25) : fatal error C1083: Cannot open include file: 'osgUtil/ConvertVec': No such file or directory PropertyFile.cpp ObjectPlacer.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier MachinePool.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier HeightFieldMapper.cpp ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\HeightFieldMapper.cpp(22) : fatal error C1083: Cannot open include file: 'osgUtil/OperationArrayFunctor': No such file or directory GeospatialDataset.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier FileUtils.cpp FileDetails.cpp FileCache.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier ExtrudeVisitor.cpp ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\ExtrudeVisitor.cpp(8) : fatal error C1083: Cannot open include file: 'osgUtil/EdgeCollector': No such file or directory Destination.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier Date.cpp Generating Code... Compiling... DataSet.cpp G:\OpenSceneGraph\OSGDEM2.2\0.9.4\VirtualPlanetBuilder\include\vpb/Source(53) : error C2065: 'MAXIMUM_NUMBER_OF_LEVELS' : undeclared identifier ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(184) : warning C4018: '' : signed/unsigned mismatch ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(462) : warning C4018: '' : signed/unsigned mismatch ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(555) : warning C4018: '' : signed/unsigned mismatch ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(662) : warning C4018: '' : signed/unsigned mismatch ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(1969) : error C2039: 'getMinLevel' : is not a member of 'osgTerrain::Layer' C:\Program Files\OSG2.2.0_vc80\include\osgTerrain/Layer(26) : see declaration of 'osgTerrain::Layer' ..\..\..\0.9.4\VirtualPlanetBuilder\src\vpb\DataSet.cpp(1970) : error C2039: 'getMaxLevel' : is not a member of 'osgTerrain::Layer' C:\Program Files\OSG2.2.0_vc80\include\osgTerrain/Layer(26) : see declaration of 'osgTerrain::Layer'
Re: [osg-users] About VirtualPlanetBuilder0.9.4~ ~~~
Hello, robert! Thanks for your reversion. The documents that you refer to is : To build under Windows please follow the guidelines for building the OpenSceneGraph VisualStudio guidelines. To generate database see osgdem user guide page http://www.openscenegraph.org/projects/osg/wiki/Support/UserGuides/osgdem. ?? Thank you~ Hi GuiYe, As mentioned on the front page of the virtualplanetbuilder.osgforger.org you'll need to use OSG-2.3.x to compile VPB-0.9.4. As for docs, the front page has links to all the docs currently available for VPB. Robert. 2008/1/22 GuiYe [EMAIL PROTECTED]: Hello,robert! Today I download VirtualPlanetBuilder0.9.4's source code.When I compile the source code in OpenSceneGraph2.2 , there are many errors.Can you tell me what I can do to solve the problems? On the other hand, I want to ask how to use the VirtualPlanetBuilder0.9.4,it just like VirtualPlanetBuilder0.9.1? Where can I get a detailed document about the user guider of VirtualPlanetBuilder0.9.4? Thank you~~~ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Some Code
Hello~~ I once wrote some in OpenSceneGraph1.2.Now I use OpenSceneGraph2.2,I want to rewrite it.But I can't find some functions to replace some code: osgProducer::Viewer::SceneHandlerList::iterator sh_it = viewer.getSceneHandlerList().begin(); osgProducer::OsgSceneHandler* sh =sh_it-get(); Who can give me some code to replace all above code in OpenSceneGraph2.2?? Thank you~~ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Some Code
Hello,robert! I want to use the code: osgProducer::Viewer::SceneHandlerList::iterator sh_it = viewer.getSceneHandlerList().begin(); osgProducer::OsgSceneHandler* sh =sh_it-get(); to load the nodes from the commandline arguments. What should I do ? Thank you~~~ Hi GuiYei, The osgViewer doesn't have an OsgSceneHandler and their isn't an equivalent. Perhaps you could provide a bit of information about what you were doing with the OsgSceneHandler then we might be able to suggest how to replace this code. Robert. 2008/1/16 GuiYe [EMAIL PROTECTED]: Hello~~ I once wrote some in OpenSceneGraph1.2.Now I use OpenSceneGraph2.2,I want to rewrite it.But I can't find some functions to replace some code: osgProducer::Viewer::SceneHandlerList::iterator sh_it = viewer.getSceneHandlerList().begin(); osgProducer::OsgSceneHandler* sh =sh_it-get(); Who can give me some code to replace all above code in OpenSceneGraph2.2?? Thank you~~ 又过年了,千万别忘了把你的爱带回家 为爱珍选,唯有金典 ___ 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 又过年了,千万别忘了把你的爱带回家 为爱珍选,唯有金典___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Some Code
(waterRoot); osg::CameraNode* relectionsCam = ocean-createReflectionsMap(waterSurfaceGroup,loadedModel.get(),0); osg::CameraNode* refractionsCam = ocean-createRefractionsMap(waterSurfaceGroup,loadedModel.get(),1); ocean-m_WaterPlane-setCameraNodes(relectionsCam,refractionsCam); waterGroup-addChild(waterSurfaceGroup); waterGroup-addChild(relectionsCam); waterGroup-addChild(refractionsCam); //Shader osg::ref_ptrosg::Program program = new osg::Program; osg::ref_ptrosg::Shader vertShader = new osg::Shader(osg::Shader::VERTEX); osg::ref_ptrosg::Shader fragShader= new osg::Shader(osg::Shader::FRAGMENT); vertShader-loadShaderSourceFromFile(envmap.vert); fragShader-loadShaderSourceFromFile(envmap.frag); program-addShader( vertShader.get() ); program-addShader( fragShader.get() ); waterSurfaceGroup-getOrCreateStateSet()-setAttributeAndModes(program.get(), osg::StateAttribute::ON); waterSurfaceGroup-getOrCreateStateSet()-addUniform(new osg::Uniform(Reflection, 0)); waterSurfaceGroup-getOrCreateStateSet()-addUniform(new osg::Uniform(Refraction, 1)); ocean-m_WaterPlane-addUniforms(waterSurfaceGroup); ocean-dirtyBound(); osg::BoundingBox bb; osg::Vec3d minBB,maxBB; minBB = loadedModel.get()-getBound().center() - osg::Vec3d(1.,1.,0)*loadedModel.get()-getBound().radius(); maxBB = loadedModel.get()-getBound().center() + osg::Vec3d(1.,1.,0)*loadedModel.get()-getBound().radius(); bb.set(minBB,maxBB); ocean-updateBoundingBox(bb); waterGroup-setUpdateCallback(new Ocean::OceanNodeUpdateCallback(ocean)); osg::Group* root = new osg::Group; root-addChild(waterGroup); // model root-addChild(loadedModel.get()); { osg::Geode* geode = new osg::Geode; osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(0,0,0),osg::Vec3(256.0,0.0,0.0),osg::Vec3(0.0,256.0,0.0)); geom-getOrCreateStateSet()-setTextureAttributeAndModes(0,ocean-m_textureReflections,osg::StateAttribute::ON); geode-addDrawable(geom); osg::CameraNode* camera = new osg::CameraNode; camera-setProjectionMatrix(osg::Matrix::ortho2D(0,512,0,512)); camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera-setViewMatrix(osg::Matrix::identity()); camera-setViewport(50,600-1*102,512,512); camera-setClearMask(GL_DEPTH_BUFFER_BIT); camera-setRenderOrder(osg::CameraNode::POST_RENDER); camera-addChild(geode); root-addChild(camera); } { osg::Geode* geode = new osg::Geode; osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(0,0,0),osg::Vec3(256.0,0.0,0.0),osg::Vec3(0.0,256.0,0.0)); geom-getOrCreateStateSet()-setTextureAttributeAndModes(0,ocean-m_textureRefractions,osg::StateAttribute::ON); geode-addDrawable(geom); osg::CameraNode* camera = new osg::CameraNode; camera-setProjectionMatrix(osg::Matrix::ortho2D(0,512,0,512)); camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF); camera-setViewMatrix(osg::Matrix::identity()); camera-setViewport(50,600-2*260,512,512); camera-setClearMask(GL_DEPTH_BUFFER_BIT); camera-setRenderOrder(osg::CameraNode::POST_RENDER); camera-addChild(geode); root-addChild(camera); } // pass the loaded scene graph to the viewer. viewer.setSceneData(root); //double ne,fa; //ne = 1.0; //fa = 15000.0; //sh-getSceneView()-setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR); //sh-getSceneView()-setProjectionMatrixAsPerspective(45,1.0,ne,fa); while( !viewer.done() ) { // wait for all cull and draw threads to complete. viewer.sync(); // update the scene by traversing it with the the update visitor which will // call all node update callbacks and animations. viewer.update(); // fire off the cull and draw traversals of the scene. viewer.frame(); } // wait for all cull and draw threads to complete. viewer.sync(); // run a clean up frame to delete all OpenGL objects. viewer.cleanup_frame(); // wait for all the clean up frame to complete. viewer.sync(); return 0; } osgProducer::Viewer::SceneHandlerList::iterator sh_it = viewer.getSceneHandlerList().begin(); osgProducer::OsgSceneHandler* sh =sh_it-get(); 在2008-01-16,GuiYe [EMAIL PROTECTED] 写道: Hello,robert! I want to use the code: osgProducer::Viewer::SceneHandlerList::iterator sh_it = viewer.getSceneHandlerList().begin(); osgProducer::OsgSceneHandler* sh =sh_it-get(); to load the nodes from the commandline arguments. What should I do ? Thank you~~~ Hi GuiYei, The osgViewer doesn't have an OsgSceneHandler and their isn't an equivalent. Perhaps you could provide a bit of information about what you were doing with the OsgSceneHandler then we might be able to suggest how to replace this code. Robert. 2008/1/16 GuiYe [EMAIL PROTECTED]: Hello~~ I once wrote some in OpenSceneGraph1.2.Now I use OpenSceneGraph2.2,I want to rewrite it.But I can't find some functions to replace some code
[osg-users] About virtualplanetbuilder
Hello,I want to ask two questions: 1. Where I can get the last version of virtualplanetbuilder? I found that the URL: svn checkout http://www.openscenegraph.org/svn/VirtualPlanetBuilder/tags/VirtualPlanetBuilder-0.9.1 VirtualPlanetBuilder svn checkout http://www.openscenegraph.org/svn/VirtualPlanetBuilder/trunk VirtualPlanetBuilder can't be useful.At the same time , I want to know the last version of virtualplanetbuilder is 0.93? 2. Where I can get the information about how to use the virtualplanetbuilder? And I don't know that the meaning of much parameters in virtualplanetbuilder.Who can tell me in detail? Thank you !___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] About virtualplanetbuilder (Robert Osfield)
Hello,Rebert! Thanking for your answering! When can I use the virtualplanetbuilder 0.93 in windows? I hope that you can give us a detailed document about how to use the virtualplanetbuilder 0.93 when the virtualplanetbuilder 0,93 is release.Waiting for your good news! Thanks!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] A parameter in VirtualPlanetBuilder-0.9.1
Hello, I want to ask a question about a parameter in VirtualPlanetBuilder-0.9.1: CODE: arguments.getApplicationUsage()-addCommandLineOption(--layer layer_num,Specify the layer that the next source Texture will contribute to..); Who can tell me the meaning of the parameter and how to use this parameter? Thank you !___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] VirtualPlanetBuilder0.91
Hello, I want ask the question about a function in VirtualPlanetBuilder0.91.The function is : void setGeoTransformFromRange(double xMin, double xMax, double yMin, double yMax) { _geoTransform.makeIdentity(); _geoTransform(0,0) = xMax-xMin; _geoTransform(3,0) = xMin;_geoTransform(1,1) = yMax-yMin; _geoTransform(3,1) = yMin; }I want to know how dose the function work.Thank you___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org