[osg-users] problem with setNumMultiSamples()
hi all, when I use setNumMultiSamples(16),It is ok on my computer.But when the program is executed on some other computers.If the computer doesn't support mulsampling with 16,The display window will expanded to full screen(This is not I want). If I want the best antialiasing effect on every machine,how should I set the multisamples num? Thanks for any hint best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to get video card's maximum sampling rate?
hi all, I have a problem with antialiasing. when I set the sampling rate with 16 ,the window in which I draw the three-dimension scene will expand to full screen if the video cards don't support the sampling rate. So I have to get every machine's maximum sampling rate,how can I achieve this? Thanks in advance. best regards. forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with GPU draw time
hi Robert , Thanks for your help. I didn't describe my problem clearly.I want wo konw something about OSG thread model.Take the single thread model for enstance,the time of one frame is the sum of event,update,cull and draw .Does it include the GPU draw time?(I am not sure,but I think it doesn't).So ,if the first frame's draw() function is finished,the second frame's event() function will be executed immediately no matter the GPU finishes all the OpenGL commands(am I right?).And if the GPU draw time is longer than the frame time,maybe the first frame's opengl commands haven't been finished ,the second frame's opengl commands will come.Will that happen? best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] problem with GPU draw time
hi all, I am confused about the GPU draw time,I mean if the GPU draw time is longer than the UPDATE+CULL+DRAW(dispatch) time,what will happen?Is there any code control this? best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] antialiasing with mfc
hi all, I use codes like this to antialiase : osg::DisplaySettings* ds = osg::DisplaySettings::instance(); ds-setNumMultiSamples(16); mViewer-setDisplaySettings(ds); It works well in console program(full screen).when I add the codes to the osgviewrMFC program,it doesn't work well.why? thanks for any hint. best regards forest___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] crash at delete mViewer
hi all, There is a class cOSG in example osgviewerMFC,i find that a sentence Sleep(1000); is added to the function cOSG::~cOSG().Maybe it's used to avoid crash at delete mViewer.But Sometimes I still get a crash at delete mViewer.Is it because of the thread is not stoped? How can i slove the problem? Thanks for advance. forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] updateCalculatedNearFar problem
hi robert, Thanks for your advice. I know people are busy,so i concentrate the code.Sometimes problems are hard to describe in native language much less a foreign language.I will try to describle problems in english instead of codes. Thank you again. Best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] updateCalculatedNearFar problem
hi all, It seems that there is a problem with CullVisitor::updateCalculatedNearFar,I have the code like this: osgViewer::Viewer viewer; class MCallBack : public osg::NodeCallback { public: virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { osg::PositionAttitudeTransform *pat = dynamic_castosg::PositionAttitudeTransform *(node); if( pat != NULL ) { osg::Camera *camera=viewer.getCamera(); osg::Matrixd pMatrix = camera-getViewMatrix(); pat -setAttitude(pMatrix.getRotate()); } } }; osg::Node* fun() { osg::Geode* geode=new osg::Geode; geode-addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0,0,0),0.1))); osg::MatrixTransform *mt=new osg::MatrixTransform ; Matrix matrix; matrix.setTrans(osg::Vec3(1,0,0)); mt-setMatrix(matrix); mt-addChild(geode); osg::PositionAttitudeTransform * tran = new osg::PositionAttitudeTransform; tran-setReferenceFrame(osg::Transform::ABSOLUTE_RF); tran-setPosition(osg::Vec3(5,5,0)); tran-addChild(mt); tran-setUpdateCallback(new MCallBack()); osg::Projection* ProjectionMatrix = new osg::Projection; ProjectionMatrix-setMatrix(osg::Matrix::ortho2D(0,10,0,10)); ProjectionMatrix-addChild(tran); return ProjectionMatrix; } int _tmain(int argc, _TCHAR* argv[]) { osg::Node* mRoot =fun(); viewer.setSceneData(mRoot); return viewer.run(); } when i rotate the scene,the scene is culled not exactly. Is there a bug with osg or something wrong with my code? thanks for any advice. best regards forest___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] what can we do with osgPPU?
hi Paul and art Thanks for your reply. I have googled it,but I couldn't understand that well,so I asked here. with art's help ,Now I know what I can do with osgPPU. Anyway ,thank you all. best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to know a node whether in the viewport?
hi all, I set a animationpath to a node,how can i know whether the node is moved outside of the viewport? what i want to do is this:when the node is moved outside of the viewport ,I will change the camera's position to make sure the node is seen all the time.So,what should i do? thanks for any suggestion best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] mouse move problem
hi all, I added a pickhandler to vivewer,when something is picked ,I showed a dialog.The problem is when the dialog is closed,the osg scene moved with mouse move.I must click left mouse button to stop it.You know,normally when we move our mouse ,the osg scene will not move.So,how to fix this? thank you! best wishes forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to get model scale?
hi all, When the secne is zoomed in or out ,I want to get the zoom scale.I do it like this: osg::Camera* camera= viewer.getCamera(); osg::Matrix vm=camera-getViewMatrix(); osg::Vec3 scale=vm.getScale(); the result is that scale always equals to (1,1,1).What does this mean and how can I get the reall scale of the scene? thanks best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to make a node fixed in screen position
hi all, I want to draw axes in screen position,the axes can't be scaled or transformed ,but which can be rotated with other scene.I do it like this,but the billboard (texts: 'X','Y','Z') doesn't work,what should I do to make the billboard work well?“axes.osg” is downloaded from the osg homepage. osgViewer::Viewer viewer; class orbit : public osg::NodeCallback { public: orbit() {} virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { osg::PositionAttitudeTransform *pat = dynamic_castosg::PositionAttitudeTransform *(node); if( tx != NULL ) { osg::Camera *camera=viewer.getCamera(); osg::Matrixd pMatrix = camera-getViewMatrix(); pat-setAttitude(pMatrix.getRotate()); } } }; osg::Group* fun() { osg::Group *group=new osg::Group(); osg::Node *axis=osgDB::readNodeFile(data\\axes.osg); osg::PositionAttitudeTransform * tran = new osg::PositionAttitudeTransform; tran-addChild(axis); tran-setPosition(osg::Vec3(5,5,0)); tran-setUpdateCallback(new orbit()); osg::MatrixTransform* ModelViewMatrix = new osg::MatrixTransform; ModelViewMatrix-setMatrix(osg::Matrix::identity()); ModelViewMatrix-setReferenceFrame(osg::Transform::ABSOLUTE_RF); ModelViewMatrix-addChild(tran); osg::Projection* ProjectionMatrix = new osg::Projection; ProjectionMatrix-setMatrix(osg::Matrix::ortho2D(0,10,0,10)); ProjectionMatrix-addChild(ModelViewMatrix); group-addChild(ProjectionMatrix); return group; } int _tmain(int argc, _TCHAR* argv[]) { osg::Group *mRoot =fun(); viewer.setSceneData(mRoot); return viewer.run(); } best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to draw an axis like 3dsmax's ?
hi all, Now I want to draw axes like 3dsmax's. I load the node axes.osg. I use setReferenceFrame(osg::Transform::ABSOLUTE_RF) ,which make the axes could not be rotated, transformed or scaled.But I want the axes only can be rotated ,can not be transformed or scaled. what should I do? thanks! best regards! forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to use CoordinateSystemNode?
hi all, Now I have two files, earth.osga and city.ive . The first file use GEOGCS WGS 84 CoordinateSystem and the second file use PROJCS UTM Zone CoordinateSystem ,I add them both into the scene.But i only can see the scene of the first file,that is the earth.No matter how i zoomed in and out ,I still can't find the scene of the second file which is a city . what I want to do is to show the earth and city like google earth,what should i do? thanks for any hint. best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to draw line use pixel
hi all, Is there an easy way to draw line use pixel just like osgText::setCharacterSizeMode(SCREEN_COORDS)? thanks for any hint best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] freetype problem
hi all I build osg-2.6.0 and the latest 3rdparty ,when i run the example osgtext,the program could not find plugin to read objects from file. When i debugged the program,i found that the function LoadLibrary() failed to load freetype.dll. but i can find the dll file follow the file path. As a result ,I can't change the text's font,what should i do to slove the problem? thanks for any help! best regards forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg pick problem
hi,all when i use the function computeIntersections to pick a drawable in the scene,it's Ok when i use osg::ShapeDrawable to build the scene。but the computeIntersections doesn't work when i use self drawing, I derive a class from osg::Drawable,and overwrite the function computeBound() and drawImplementation(). why doesn't it work? thanks for any hint forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to use StateSetManipulator in mfc?
hi all, when i use StateSetManipulator in mfc like this: mViewer-addEventHandler( new osgGA::StateSetManipulator(mViewer-getCamera()-getOrCreateStateSet()) ); It's ok when the program runs,but when the program is closed ,it encounters an error at void __CLR_OR_THIS_CALL _Container_base::_Orphan_all() in file xutility which is a mfc src file. anyone meets such problem? forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Is programmable pipeline faster than fixed function pipeline ?
hi all, I know programmable pipeline is flexible,but is it faster than fixed function pipeline ? thanks for any hint! forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to convert DDB bitmap to osg::Image?
hello everyone, I want to draw something in memory dc ,then convert the drawing to osg::Image. I tried it like this: CDC dc; dc.CreateCompatibleDC(NULL); CBitmap bitmap; bitmap.CreateCompatibleBitmap (dc, 100, 100); CBitmap* pOldBitmap=dc.SelectObject(bitmap); dc.FillRect(CRect(0,0,200,200),CBrush(RGB(255,0,0))); BITMAP bmp; bitmap.GetBitmap(bmp); here,the bmp.bmBits is NULL because of DDB. thanks for any advice forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how it the text drawn?
hi everyone, I am puzzled by the method of drawing text. Three is three main sentences in the function Text::drawForegroundText(...) { state.setVertexPointer( 3, GL_FLOAT, 0, (transformedCoords.front())); state.setTexCoordPointer( 0, 2, GL_FLOAT, 0, (glyphquad._texcoords.front())); glDrawArrays(GL_QUADS,0,transformedCoords.size()); } If we have calculated the text's glyph ,why not just draw the text using glDrawArrays? In other words,why we use texture map? thanks for any advice, forest ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] glCallList doesn't work well in drawImplementation
hi all, I want to use opengl display list in Drawable::drawImplementation ,like this: void ShapeDrawableEx::drawImplementation(osg::RenderInfo renderInfo) const { if (globj==0) //ShapeDrawableEx:: mutable GLuint globj; { makeCallList(); } glCallList( globj ); } void ShapeDrawableEx::makeCallList() const { globj=glGenLists(1); if(globj!=0) { glNewList(globj,GL_COMPILE); .. glEndList(); } } If the drawImplementation is first time called,it works well and I can see the drawing. But if I change the Drawable's color,that's to say the drawImplementation is called again,nothing is drawn. I know that the drawImplementation is called between glNewList and glEndList ,so it's a hierarchical display list.But it doesn't work well. Why? thanks forest37 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] CMakeLists FIND_PACKAGE(OpenGL)
hi all, I am a beginner of cmake ,I find that there is a sentence FIND_PACKAGE(OpenGL) int the CMakeLists.txt. But I can't find the corresponding .cmake file in CMakeModules. For example ,I find the FindOpenThreads.cmake file. regards forest___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to speed drawing texts?
hi all, when I use osg to draw texts,I find that the founction osgText::setText() requires 2ms . if I want to draw 5000 texts,I have to wait for 2S at least. what should I do to speed drawing texts? regards forest___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] class information with no extension .h file
hi all, When I use VC++6.0 build the project of OSG,I find that there is no class information within head files in the ClassView panel,I just get class information when the class is declared in cpp files.The reason is that there is no extention .h for the head files. So,what can I do to get all the class information int the ClassView panel ? regards forest___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] VBO
What does fastPath mean? Is it related to VBO? There is a sentence if (_vertexData.indices.valid()) _fastPath = false; in the function Geometry::computeFastPathsUsed() It seems that i can't use fastPath when i use setVertexIndices(); I just want to use Vertex_Buffer_Object,what should i do? thanks! ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org