[osg-users] HOW TO disable cameraManipulator?
hi , friends. when i edit some geometries in the scene. i want to disable the cameraManipulator, someone tell me how to ? wh_xiexing___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg support gocad file format?
hi friends: osg support gocad file format? or is there a plugin like DB_gocad ? ___ 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] problem of rendering overlaped models.
hi friends: i have 2 models to render, some part of which are overlaped . so the result is some kind of weird. how can i resolve this probem? do i need to split the model and align them? or set different render details for the 2 models? Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how pick the nearest point in a cloud point?
hi friends: m y question is that i want to select a point of the scene as the rotation center of the trackball manipulator . i know how to pick objects , but the scene is showing a point cloud , how to select the litttle point in the scene among the point cloud? is there a method to pick the nearest point from the mouse point in the 3d scene? your sincere Shawl.___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to use several texture one time?
i have a mesh and want to project several photo on the mesh . code is here: osg::Switch *layer = new osg::Switch; osg::Geode* leaf = 0; if (!hasTexture){ leaf = createLeaf(points, numOfVert, tris,header.np); layer->addChild(leaf); }else{ osg::Group *group = new osg::Group; for (unsigned int gr = 0; gr < header.ngr; gr++){ /*for every group , load the different texture*/ osg::Texture2D* texture = 0L; osg::ref_ptr image; if(osgDB::isAbsolutePath(groups[gr].texmap)){ image = osgDB::readImageFile(std::string(groups[gr].texmap)); }else{ std::string absoluteFile = osgDB::getFilePath(fileName) + std::string("/") + std::string(groups[gr].texmap); image = osgDB::readImageFile(absoluteFile); } texture = new osg::Texture2D; texture->setImage( image.get() ); if (texture->getImage()!=0L){ group->getOrCreateStateSet()->setTextureAttributeAndModes(gr,texture ); //set texture units group->getOrCreateStateSet()->setTextureAttribute(gr, new osg::TexEnv(osg::TexEnv::DECAL)); } /*create group leaf*/ leaf = createLeaf(points, tris_t, groups[gr].poly_begin, groups[gr].poly_end, gr); group->addChild(leaf); } layer->addChild(group); } the problem is that just one texture unit works . in case : for (unsigned int gr = 0; gr < header.ngr; gr++){ unit 0 works for (unsigned int gr = 1; gr < 2; gr++){ unit 1 works then , how can i show the whole mesh with texture? thanks in advance Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] how to turn on the quad buffered feature.
thanks , it works indeed Shawl From: Alistair Baxter Date: 2012-11-05 17:26 To: OpenSceneGraph Users Subject: Re: [osg-users] how to turn on the quad buffered feature. You need to ensure your OpenGL context is created with Quad-buffers enabled �C the DisplaySettings call just turns on their use if they’re there, it doesn’t create them. You’ll need to set the quadBufferStereo flag in the GraphicsContext traits before you create it, or if you’re using Qt as I am, call setStereo(true) on the QGLFormat object passed to the GLWidget constructor. From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of wh_xiexing Sent: 05 November 2012 06:50 To: osg-users Subject: [osg-users] how to turn on the quad buffered feature. i want to use the stereo feature of osg. osg::DisplaySettings::instance()->setStereoMode(mode); osg::DisplaySettings::instance()->setEyeSeparation(0.01*value); where mode is osg::DisplaySettings::QUAD_BUFFER . but it doesn't work. my graphic card is the most recent quadro k4000M. do i need to set something in the nvidia panel ? thank you very much Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to turn on the quad buffered feature.
i want to use the stereo feature of osg. osg::DisplaySettings::instance()->setStereoMode(mode); osg::DisplaySettings::instance()->setEyeSeparation(0.01*value); where mode is osg::DisplaySettings::QUAD_BUFFER . but it doesn't work. my graphic card is the most recent quadro k4000M. do i need to set something in the nvidia panel ? thank you very much Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to save kdtree into file
hi friends: i want to save the kdtree into an extern file so that it can prevent building it every time i open a model file? can it be possible? Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to build a fixed size object
hi friends sometimes we need fixed size object like annotation and control point , i know that using hud camera can make an object fixed size . has any better away to do that? Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 回复: adding empty group to the scenview tree will cause problem?
add an empty group to the root . the mode looks like without normal . when removed the empty group . the light and other geometries appeared have someone met this situation? Shawl 发件人: wh_xiexing 发送时间: 2012-11-01 17:23 收件人: osg-users 主题: [osg-users] adding empty group to the scenview tree will cause problem? hi friends: adding empty group to the scene view tree will make the light and normal lose it's effect? i do this in order to add geometries to the group later on. Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] adding empty group to the scenview tree will cause problem?
hi friends: adding empty group to the scene view tree will make the light and normal lose it's effect? i do this in order to add geometries to the group later on. Shawl From: Robert Osfield Date: 2012-10-22 23:48 To: OpenSceneGraph Users Subject: Re: [osg-users] slave camera render to texture. Hi Peterakos, You seem to be having more problems than you should for what is usually a straight forward task. Rather than try to understand what you've done wrong in your program I think it would be best for you to have a look at the osg examples that are relevant - for example have a look at osgprerender, osgprerenercubemap and osgdistortion. Robert. On 14 October 2012 21:50, Peterakos wrote: > Hello. > > My task is to have 2 cameras being exactly the same. > The first one will render to my window and the second one to texture. > > First i tried to create a camera as child to scene data and add the same > model as child. > So i used the following code: > > Viewer viewer; > Camera* camera = new Camera(*viewer.getCamera(), CopyOp::DEEP_COPY_ALL); > ref_ptr image = new Image(); > image->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE); > camera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); > camera->attach(Camera::BufferComponent(Camera::COLOR_BUFFER0), image.get()); > camera->setPostDrawCallback(new MyCameraPostDrawCallback(image.get())); > > The post callback will writes image to file. > I couldnt make it work and i have no idea why. All i see in the texture is > an empty scene. > What more should i do ? > > After that i decided to use slave camera. I noticed that i had to use 2 > different graphics context. > But the problem is that i dont want the second window to appear. > What configuration should i pass to the second context to not appear any > window ? > I assume is something based on WindowingSystemInterface but i couldnt find > what exactly. > > Thank you for your time. > > > > ___ > 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] 回复: Re: how to change project matrix temporarily?;
i implant this method into osg . code is following: class ocsSurfaceShape : public osg::Drawable{ public: ocsSurfaceShape(){}; ocsSurfaceShape( const ocsSurfaceShape& copy, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY ) : osg::Drawable(copy, copyop) { } void pushProjectionOffest(double offset) const ; void popProjectionOffest() const; }; void ocs::ocsSurfaceShape::pushProjectionOffest ( double offset ) const { float* pm = new float[16]; glGetFloatv(GL_PROJECTION_MATRIX, pm); pm[10] *= offset != 0 ? offset : 0.99; // TODO: See Lengyel 2 ed. Section 9.1.2 to compute optimal offset glPushAttrib(GL_TRANSFORM_BIT); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadMatrixf(pm); } void ocs::ocsSurfaceShape::popProjectionOffest() const { glMatrixMode(GL_PROJECTION); glPopMatrix(); glPopAttrib(); } //sub class of surface Shape class lineDrawable : public ocsSurfaceShape{ public: lineDrawable(); lineDrawable(ocs::ocsLine& line); lineDrawable( const lineDrawable& copy, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY ) : ocsSurfaceShape(copy, copyop) { _line = copy._line; } META_Object( osg, lineDrawable); virtual BoundingBox computeBound() const; virtual void drawImplementation( RenderInfo& renderInfo ) const; private: mutable ocs::ocsLine _line; }; void ocs::lineDrawable::drawImplementation( RenderInfo& renderInfo ) const { std::vector list = _line.getTesselatePoints(); ocsAttributes& attr = _line.getAttribute(); float color[4]; attr.getColor(color); osg::GLBeginEndAdapter& gl = renderInfo.getState()->getGLBeginEndAdapter(); gl.Color4f(color[0],color[1],color[2],color[3]); pushProjectionOffest(0.95);//change the project matrix here gl.Begin(GL_LINE_STRIP); for (unsigned int u = 0; u < list.size(); u++){ gl.Vertex3f(list[u].x(),list[u].y(),list[u].z()); } gl.End(); popProjectionOffest();//restore it } does it the best way? it's wierd that sometims the line is disappeared. other question is the GL API glPushAttrib(GL_TRANSFORM_BIT); in pushProjectionOffest is identical to calling osg::GLBeginEndAdapter& gl 's method ? Shawl 发件人: wh_xiexing 发送时间: 2012-10-29 16:50 收件人: osg-users 主题: Re: [osg-users] how to change project matrix temporarily?; hi Robert osifield i am writing an editor which can add polylines and polygons on the mesh model(mountains model). the lines and polygons must follow the terrain . so i tessellate the polylines into many parts . because the mesh is irregular , unlike the GIS . some part of the line segment is above the terrain . other other is under the terrain .so i want to put the surface shapes (polylines polygons ) near to the camera . worldwind give a method as the following code show.but i don't know how to do that in the OSG. Shawl From: Robert Osfield Date: 2012-10-29 16:30 To: OpenSceneGraph Users Subject: Re: [osg-users] how to change project matrix temporarily?; Hi Shawl, Could you explain for what purpose you need to temporarily modify the projection matrix, this has a huge baring on how you will want to go about it. The OSG has an osg::Projection node that allows you to override the project matrix for the subgraph that you attach below the Projection Node, and the osg::Camera node that allows you to modify the projection and view matrices, and there there is slave Camera's at the viewer level, and finally cull callbacks that you can use to modify the modelview and projection matrices along with many other things. As you see there are plenty of options, which to recommend I can't say as you haven't yet given the context of the problem you are trying to solve. Robert. On 29 October 2012 00:21, wh_xiexing wrote: > i want to implement the same effect of the following code using open scene > graph. can it be possiable? > > public void pushProjectionOffest(Double offset) > { > // Modify the projection transform to shift the depth values > slightly toward the camera in order to > // ensure the lines are selected during depth buffering. > GL gl = this.getGL(); > > float[] pm = new float[16]; > gl.glGetFloatv(GL.GL_PROJECTION_MATRIX, pm, 0); > pm[10] *= offset != null ? offset : 0.99; // TODO: See Lengyel 2 ed. > Section 9.1.2 to compute optimal offset > > gl.glPushAttrib(GL.GL_TRANSFORM_BIT); > gl.glMatrixMode(GL.GL_PROJECTION); > gl.glPushMatrix(); > gl.glLoadMatrixf(pm, 0); > } > > public void popProjectionOffest() > { > GL gl = this.getGL(); > > gl.glMatrixMode(GL.GL_PROJECTION); > gl.glPopMatrix(); > gl.glPopAttrib(); > } &g
Re: [osg-users] how to change project matrix temporarily?;
hi Robert osifield i am writing an editor which can add polylines and polygons on the mesh model(mountains model). the lines and polygons must follow the terrain . so i tessellate the polylines into many parts . because the mesh is irregular , unlike the GIS . some part of the line segment is above the terrain . other other is under the terrain .so i want to put the surface shapes (polylines polygons ) near to the camera . worldwind give a method as the following code show.but i don't know how to do that in the OSG. Shawl From: Robert Osfield Date: 2012-10-29 16:30 To: OpenSceneGraph Users Subject: Re: [osg-users] how to change project matrix temporarily?; Hi Shawl, Could you explain for what purpose you need to temporarily modify the projection matrix, this has a huge baring on how you will want to go about it. The OSG has an osg::Projection node that allows you to override the project matrix for the subgraph that you attach below the Projection Node, and the osg::Camera node that allows you to modify the projection and view matrices, and there there is slave Camera's at the viewer level, and finally cull callbacks that you can use to modify the modelview and projection matrices along with many other things. As you see there are plenty of options, which to recommend I can't say as you haven't yet given the context of the problem you are trying to solve. Robert. On 29 October 2012 00:21, wh_xiexing wrote: > i want to implement the same effect of the following code using open scene > graph. can it be possiable? > > public void pushProjectionOffest(Double offset) > { > // Modify the projection transform to shift the depth values > slightly toward the camera in order to > // ensure the lines are selected during depth buffering. > GL gl = this.getGL(); > > float[] pm = new float[16]; > gl.glGetFloatv(GL.GL_PROJECTION_MATRIX, pm, 0); > pm[10] *= offset != null ? offset : 0.99; // TODO: See Lengyel 2 ed. > Section 9.1.2 to compute optimal offset > > gl.glPushAttrib(GL.GL_TRANSFORM_BIT); > gl.glMatrixMode(GL.GL_PROJECTION); > gl.glPushMatrix(); > gl.glLoadMatrixf(pm, 0); > } > > public void popProjectionOffest() > { > GL gl = this.getGL(); > > gl.glMatrixMode(GL.GL_PROJECTION); > gl.glPopMatrix(); > gl.glPopAttrib(); > } > > > Shawl > > ___ > 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] how to change project matrix temporarily?;
i want to implement the same effect of the following code using open scene graph. can it be possiable? public void pushProjectionOffest(Double offset) { // Modify the projection transform to shift the depth values slightly toward the camera in order to // ensure the lines are selected during depth buffering. GL gl = this.getGL(); float[] pm = new float[16]; gl.glGetFloatv(GL.GL_PROJECTION_MATRIX, pm, 0); pm[10] *= offset != null ? offset : 0.99; // TODO: See Lengyel 2 ed. Section 9.1.2 to compute optimal offset gl.glPushAttrib(GL.GL_TRANSFORM_BIT); gl.glMatrixMode(GL.GL_PROJECTION); gl.glPushMatrix(); gl.glLoadMatrixf(pm, 0); } public void popProjectionOffest() { GL gl = this.getGL(); gl.glMatrixMode(GL.GL_PROJECTION); gl.glPopMatrix(); gl.glPopAttrib(); } Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] building kdtree
osg users : building kdtree makes it a long time to open a model file, could i build kdtree in a background thread? if i can , how to do that ?___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] speed up the loading
i have hundreds of millions of points to render.i think the Geometry 's setVertexArray (Vec3Array) is time consuming . for every point , it must construct a Vec3 class, and put it into the array. so i want to modified it to setVertexArray (float*) , so that i can read a block of data from the disk and provide it to osg. to do so. the first thing is i must figure out how the osg interact with opengl. unfortunately i see a lot of arraydispatcher which is complecated . can someone tell me how can i do ? Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how does osg call opengl's api
hi friends. i look through the code ,but can't find the places where the osg call opengl's api . like glDrawArray . could someone tell me how the osg interact with the opengl? Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] about the cull mechanism in osg
dear friends: i am newbie . my question is , i have a group which contains a lot a gode. in order to speed the rendering . i don't know whether i need to write a cull callback . or do nothing and let the osg system do the culling work instead . does osg automatically traverse the group and cull the node which lay out the frustum ??? Shawl ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to pick a cluster of points
Dear friends . i want to create an editor tool that can select a cluster of points one time in order to remove the selected points . osg provide the functions to do that job? or i need to code from scratch? thank you for your help Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to use unique color to pick object?
Dear friends: in openGL programming . there is a method to pick the object from the scene.rendering the scene in the back buffer, every object with an unique color . than , rendering second time in a normal way. when the user move mouse in the screen . read the pixel value under the mouse point . then find the color in an prepared hashmap. comparing the color , we can known which object is selected. i am wondering whether the osg can archieve the same goal ? because i want to implement an edit function with osg . i have a mountain model composite of hundreds of thousands of triangles . and my goal is putting high resolution digital image on the model, and fusion the image and model into a model with texture . now , the problem i face is that using the mouse to find the same points in the model and in the digital image. can some one give me an advice. Shawl___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] HUD disappeared
thank you , Robert. you solved my problem. wh_xiexing From: Robert Osfield Date: 2012-08-23 18:53 To: OpenSceneGraph Users Subject: Re: [osg-users] HUD disappeared Hi wh? xiexin? Which human name would you like to be addressed as? There isn't any way we'll be able to pinpoint the problem you are seeing from just this code extract, there are simply too many unknowns about the rest of your application to pass judgement. The best I can do is provide a general comment. For on HUD compass I would recommend using a viewer slave Camera rather than a Camera in the main scene graph - this keeps the various components of the application behaviour nice and separate both conceptually and implementation wise. It might even solve the bug you are seeing as for all we know it might simply be that you are replacing the main scene graph with your new model and discarding the compass subgraph. Robert. On 20 August 2012 03:17, wh_xiexing wrote: > i create a compass on the screen, but when i open an model , the HUD Compass > disappeared . following is my code. > > can some one tell me how to resolve this problem? > > //create hud camera > theCameraNode = new osg::Camera; > theCameraNode->setReferenceFrame(osg::Transform::ABSOLUTE_RF); > theCameraNode->setProjectionMatrix(osg::Matrix::ortho2D(-1,1,-1,1)); > theCameraNode->setViewMatrix(osg::Matrix::identity()); > theCameraNode->setViewport(0,0,200,200); > theCameraNode->setClearMask(GL_DEPTH_BUFFER_BIT); > theCameraNode->setRenderOrder(osg::CameraNode::POST_RENDER); > theCompass = new ocsCompass; // compass node > theCameraNode->addChild(theCompass); > addChild(theCameraNode); > > > wh_xiexing > > ___ > 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] how to be notified that the viewport is changed?
dear friends: when the user resize the applicatioin's window, how do i know the viewport of the camera is changed? wh_xiexing___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] HUD disappeared
i create a compass on the screen, but when i open an model , the HUD Compass disappeared . following is my code. can some one tell me how to resolve this problem? //create hud camera theCameraNode = new osg::Camera; theCameraNode->setReferenceFrame(osg::Transform::ABSOLUTE_RF); theCameraNode->setProjectionMatrix(osg::Matrix::ortho2D(-1,1,-1,1)); theCameraNode->setViewMatrix(osg::Matrix::identity()); theCameraNode->setViewport(0,0,200,200); theCameraNode->setClearMask(GL_DEPTH_BUFFER_BIT); theCameraNode->setRenderOrder(osg::CameraNode::POST_RENDER); theCompass = new ocsCompass; // compass node theCameraNode->addChild(theCompass); addChild(theCameraNode); wh_xiexing___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to edit geometries on the scene?
i am newbie of OSG. i used worldwind to represent the globe. now migrate to OSG , i wondered how to draw lines , polygons , and add some mesurement function in my software, can someone give me an idea?___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to add progress bar to readerwriter?
HI. I implement a readerwriter plugin to read .las file which contains tremendous amount of points . so i want to use progressbar to tell the user how much points i have read . anybody can tell me how to do? thank you___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org