[osg-users] About QT example!
Hi everyone In QTOSG example,When i modify the thread model to osgViewer::Viewer::DrawThreadPerContext); I get a runtime error! class ViewerQT : public osgViewer::Viewer, public AdapterWidget { public: ViewerQT(QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WindowFlags f = 0): AdapterWidget( parent, name, shareWidget, f ) { getCamera()->setViewport(new osg::Viewport(0,0,width(),height())); getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast(width())/static_cast(height()), 1.0f, 1.0f); getCamera()->setGraphicsContext(getGraphicsWindow()); setThreadingModel(osgViewer::Viewer::SingleThreaded); //setThreadingModel(osgViewer::Viewer::DrawThreadPerContext); //here i modify addEventHandler(new osgGA::StateSetManipulator ); connect(&_timer, SIGNAL(timeout()), this, SLOT(updateGL())); _timer.start(10); } virtual void paintGL() { frame(); } protected: QTimer _timer; }; Thanks YangXiao. ___ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Depth buffer data is not clamp to [0.0,1.0].
Thanks ulrich I paste this code from others,and not check! --- 09年4月2日,周四, Ulrich Hertlein 写道: 发件人: Ulrich Hertlein 主题: Re: [osg-users] Depth buffer data is not clamp to [0.0,1.0]. 收件人: "OpenSceneGraph Users" 日期: 2009年4月2日,周四,下午5:14 Hi YangXiao, On 2/4/09 3:22 PM, YangXiao wrote: > z = float ( (depthBuffer->data())[i*4] ); Could it be your cast is wrong? You're only reading every fourth byte and casting that to float, which explains why you're only seeing 0-255. Try "z = ((float*) depthBuffer->data())[i];" instead. /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Depth buffer data is not clamp to [0.0,1.0].
Hi everyone: Here is My code: depthBuffer->allocateImage(width, height, 1,GL_DEPTH_COMPONENT,GL_FLOAT); viewer.getCamera()->setPostDrawCallback( new ScreenShotCallback()); while (!viewer.done()) { viewer.getCamera()->attach(osg::Camera::DEPTH_BUFFER, depthBuffer); viewer.frame(); } and in ScreenShotCallback Operator void operator() (const osg::Camera &camera) const { FILE * fp; fp = fopen(file_name, "w"); float z ; char tmp[15]; for(int i = 0;idata())[i*4] ); memset(tmp,'\0',sizeof(tmp)); sprintf(tmp,"%f ",z); fprintf(fp, "%s", tmp); if(!(i%width)) fprintf(fp, "\r\n"); } fclose(fp); } But all data is clamp to [0,255] .How can i get real native z-buffer data? Best regard. YangXiao ___ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg example, what's prerender implement? and How can i get Depth Buffer value?
Hi Everyone: In osg example, what's prerender implement? and How can i get Depth Buffer value and write to a image file? Thanks YangXiao. ___ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] About game source!
Hi Everyone: Is someone know about a opensource game code(about navy) developed use osg? Thanks YangXiao. ___ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to compile OSG with Dev-C++ and 3rdParty source in Cmake!
Thanks Luigi and Wang Rui. I'll download 3rdParty source.I now use eclipse(Qt + Dev-C++), I'll integate OSG and 3rdParty with in eclipse. YangXiao. --- 08年11月28日,周五, Luigi Calori <[EMAIL PROTECTED]> 写道: 发件人: Luigi Calori <[EMAIL PROTECTED]> 主题: Re: [osg-users] How to compile OSG with Dev-C++ and 3rdParty source in Cmake! 收件人: "OpenSceneGraph Users" 日期: 2008,1128,周五,6:19下午 I' m currently using CMake to build 3rdParty dependencies with VC7.1, if you want to see if it is working for mingw, get either http://3d.cineca.it/storage/packages/3rdPartySrc.zip ot http://3d.cineca.it/storage/packages/3rdPartySrc_packed.zip The latter require you unpack in place the original source zip. Hope it helps Luigi Wang Rui ha scritto: > Hi YangXiao > Maybe you should try to build required 3rd dependence with mingw > (which is the default compiler of Dev-Cpp) first, and then build OSG > with CMake. > > Wang Rui > 2008/11/28 YangXiao <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> > > Hi Everyone: > I already setup QT and Dev-C++ on my computer and integrate in > Eclipse,But when i compile osg and 3rdParty ,I found only a Visual > c++ 8 sp1 binary lib. > How to compile OSG with Dev-C++ and 3rdParty source in Cmake? > Someone can give me advices! > Best regards. > YangXiao > > > > 好玩贺卡等你发,邮箱贺卡全新上线! > <http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/> > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > <mailto: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 ___ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to compile OSG with Dev-C++ and 3rdParty source in Cmake!
Hi Everyone: I already setup QT and Dev-C++ on my computer and integrate in Eclipse,But when i compile osg and 3rdParty ,I found only a Visual c++ 8 sp1 binary lib. How to compile OSG with Dev-C++ and 3rdParty source in Cmake? Someone can give me advices! Best regards. YangXiao ___ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to achieve blend function?
Hi everyone: How to achieve blend funtion in osg. I means by alpha(0.0~1.0) value to set my geometry color, I use follows code geometry->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON); osg::BlendFunc *fn = new osg::BlendFunc(); fn->setFunction(osg::BlendFunc::SRC_ALPHA,osg::BlendFunc::ONE_MINUS_SRC_ALPHA); geometry->getOrCreateStateSet()->setAttributeAndModes(fn, osg::StateAttribute::ON); Best regards YangXiao ___ 雅虎邮箱,您的终生邮箱! http://cn.mail.yahoo.com/___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 回复: Re: 回复: Re: 回复: Re: osgDB::readNodeFile question.
Thanks Wang Rui I check color array size equal to vertex array size. I means can i update Drawable color array in DrawableUpdateCallback? Wang Rui <[EMAIL PROTECTED]> 写道: Hi YangXiao, I think you should enough elements (equals to the size of the vertex array) in the color array if using BIND_PER_VERTEX. Wang Rui 2008/11/9 YangXiao <[EMAIL PROTECTED]> Thanks Robert Now i error is in my DrawableUpdateCallback void DrawableUpdateCallback::update(osg::NodeVisitor* nv, osg::Drawable* drawable) { osg::Geometry* polyGeom = dynamic_cast(drawable); colors->push_back(osg::Vec4(1,0,0,1)); . polyGeom->setColorArray(colors.get()); polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL); } This is ok. But when i use { colors->push_back(osg::Vec4(1,0,0,1)); polyGeom->setColorArray(colors.get()); polyGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); } There is runtime error.That is when i computer my new colors per vertex, I can not bind these new color array to my Drawable in DrawableUpdateCallback Best Regards. ___ 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: 回复: Re: osgDB:: readNodeFile question.
Thanks Robert Now i error is in my DrawableUpdateCallback void DrawableUpdateCallback::update(osg::NodeVisitor* nv, osg::Drawable* drawable) { osg::Geometry* polyGeom = dynamic_cast(drawable); colors->push_back(osg::Vec4(1,0,0,1)); . polyGeom->setColorArray(colors.get()); polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL); } This is ok. But when i use { colors->push_back(osg::Vec4(1,0,0,1)); polyGeom->setColorArray(colors.get()); polyGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); } There is runtime error.That is when i computer my new colors per vertex, I can not bind these new color array to my Drawable in DrawableUpdateCallback Best Regards. Robert Osfield <[EMAIL PROTECTED]> 写道: 2008/11/9 YangXiao : > Thanks Robert. > I confirm model_geode a not NULL,When i convert my model.osg-->model.IVE > return viewer->run() is OK. Why? Why? If you can't answer it with all the code in front there is almostly no way I can answer it without ANY of your code infront of me. Am I omnipresent? No, I am human being. My last email indicated that your original email had too little info, and you follow up email totally lack any of the code that is causing. Please think about reading the replies. Untill you provide sufficient information I will not provide any further replies as it's pointless. Robert. ___ 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: osgDB::readNodeFil e question.
this is my model.osg file head. Geode { nodeMask 0x cullingActive TRUE num_drawables 1 Geometry { useDisplayList TRUE useVertexBufferObjects FALSE PrimitiveSets 1 { DrawArrays TRIANGLES 0 844805 } VertexArray UniqueID Vec3Array_0 Vec3Array 140803 { ... } VertexIndices UIntArray 844806 { } Robert Osfield <[EMAIL PROTECTED]> 写道: Hi YangXiao, This is basic debugging... is model_geode a NULL?? Also why the word geode in the ptr, readNodeFile returns Node* not Geode*. Most scene graphs will not have a Geode at the top of the scene graph. Since you don't supply the offending code we can't really guess at what mistakes you've actually made. Robert. 2008/11/9 YangXiao : > Hi everyone > I write a test.osg file and use osgviewer test.osg .It's OK. > But When i osgDB::readNodeFile read a *.osg file and -> > viewer->setSceneData(model_geode); > return viewer->run(); > It's a runtime error Below. > > Best Regards. > YangXiao > > > > > > 雅虎邮箱,您的终生邮箱! > ___ > 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: osgDB::readNodeFil e question.
Thanks Robert. I confirm model_geode a not NULL,When i convert my model.osg-->model.IVE return viewer->run() is OK. Why? Robert Osfield <[EMAIL PROTECTED]> 写道: Hi YangXiao, This is basic debugging... is model_geode a NULL?? Also why the word geode in the ptr, readNodeFile returns Node* not Geode*. Most scene graphs will not have a Geode at the top of the scene graph. Since you don't supply the offending code we can't really guess at what mistakes you've actually made. Robert. 2008/11/9 YangXiao : > Hi everyone > I write a test.osg file and use osgviewer test.osg .It's OK. > But When i osgDB::readNodeFile read a *.osg file and -> > viewer->setSceneData(model_geode); > return viewer->run(); > It's a runtime error Below. > > Best Regards. > YangXiao > > > > > > 雅虎邮箱,您的终生邮箱! > ___ > 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] osgDB::readNodeFile question.
Hi everyone I write a test.osg file and use osgviewer test.osg .It's OK. But When i osgDB::readNodeFile read a *.osg file and -> viewer->setSceneData(model_geode); return viewer->run(); It's a runtime error Below. Best Regards. YangXiao - 雅虎邮箱,您的终生邮箱!<>___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 回复: Re: How to bind a osgG A::TrackballManipulator to a scene node!
Thanks Robert . I means to bind a osgGA::TrackballManipulator only to a scene node, and others scene node i use PickHandler(). Can I achieve this function? YangXiao. Robert Osfield <[EMAIL PROTECTED]> 写道: Hi YangXia, 2008/11/8 YangXiao : > Hi everyone : > How to bind a osgGA::TrackballManipulator to a scene node! Could you explain a bit more about what you are trying to achieve as on its own the above sentence doesn't really provide enough info to know what you are after, and there are range of different ways one could interpret it. Robert. ___ 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 bind a osgGA::TrackballManipulator to a scene node!
Hi everyone : How to bind a osgGA::TrackballManipulator to a scene node! Best Regards. YangXiao! - 雅虎邮箱,您的终生邮箱!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] addEventHandler with osg and wxWidget2.8.8
Hi Everyone: When i use below Canvas calss with osg and wxWidget2.8.8 I found my viewer can not addEventHandler(new PickHandler()); Why? Best regards. #ifndef _CANVAS_H #define _CANVAS_H #include #include class Canvas : public wxGLCanvas { public: Canvas(osgViewer::CompositeViewer* viewer, wxWindow* parent, wxWindowID id = wxID_ANY, int* attribList = 0, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style=0, const wxString& name=L"GLCanvas", const wxPalette& palette = wxNullPalette); ~Canvas(); class View : public osgViewer::View { public: View(); void requestRedraw(); void requestContinuousUpdate(bool needed=true); void requestWarpPointer(float x,float y); private: void setCanvas(Canvas* _canvas); friend class Canvas; Canvas* _canvas; }; void setView(View* view); void updateWhenIdle(bool update); void setUpdateWhenIdleOverride(bool status); void OnPaint(wxPaintEvent& event); void OnEraseBackground(wxEraseEvent& event); void OnIdle(wxIdleEvent& event); void OnSize(wxSizeEvent& event); void OnMouse(wxMouseEvent &event); void OnMouseCaptureLost(wxMouseCaptureLostEvent& event); void OnKey(wxKeyEvent& event); void OnShow(wxShowEvent& event); private: osg::ref_ptr _viewer; osg::ref_ptr _view; class GraphicsContext : public osgViewer::GraphicsWindow { protected: virtual ~GraphicsContext(); public: GraphicsContext(Canvas* canvas); void detachFromCanvas(); bool valid() const; bool realizeImplementation(); bool isRealizedImplementation() const; void closeImplementation(); bool makeCurrentImplementation(); bool makeContextCurrentImplementation(osg::GraphicsContext *context); bool releaseContextImplementation(); void bindPBufferToTextureImplementation(GLenum buffer); void swapBuffersImplementation(); wxGLContext* getWxContext(); unsigned int getGlContext(); private: wxGLContext* _wxContext; Canvas* _canvas; static unsigned int _s_glContexts; unsigned int _glContext; }; osg::ref_ptr _context; bool _renderingActive; int _mouseButtonCaptured; bool _updateWhenIdle; bool _updateWhenIdleOverride; DECLARE_EVENT_TABLE(); }; #endif //_CANVAS_H - 雅虎邮箱,您的终生邮箱!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] I use eclipse IDE with QT4.4.3
Hi I use eclipse IDE with QT4.4.3, Can I integrate with OSG(I compile osg use vc2005 sp1) with eclipse IDE and QT4.4.3, Best Regards YangXiao. - 雅虎邮箱,您的终生邮箱!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 回复: Re: 回复: Re: blink q uestion!
tch; //root->addChild(new osg::Node()); viewer.setSceneData(root.get());//设置场景根节点 关闭自动计算远近裁减面 //viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); 设置裁减区域 double clip_width = rect.right - rect.left; double clip_height = rect.bottom - rect.top; //viewer.getCamera()->setProjectionMatrixAsFrustum(-clip_width/2,clip_width/2,-clip_height/2,clip_height/2,1,100); viewer.getCamera()->setProjectionMatrixAsOrtho(-clip_width/2,clip_width/2,-clip_height/2,clip_height/2,-100,100); //添加事件响应处理 // create a tracball manipulator to move the camera around in response to keyboard/mouse events //viewer.setCameraManipulator( new osgGA::TrackballManipulator ); //osg::ref_ptr statesetManipulator = new osgGA::StateSetManipulator(viewer.getCamera()->getStateSet()); //viewer.addEventHandler(statesetManipulator.get()); viewer.addEventHandler(new DPES_OpenGL::PickHandler()); //viewer.addEventHandler(new osgGA::StateSetManipulator ); viewer.setKeyEventSetsDone(0); //viewer.setThreadingModel(osgViewer::ViewerBase::SingleThreaded); //viewer.realize(); //viewer.getCamera()->setProjectionMatrixAsPerspective(60,1,1,100); // 设置视点让模型处于近裁减面 //osg::Vec3 eye,center,up; //viewer.getCamera()->getViewMatrixAsLookAt(eye,center,up); viewer.getCamera()->setViewMatrixAsLookAt(osg::Vec3(0,0,radius+1),osg::Vec3(0,0,radius),up); //int a = viewer.getThreadingModel(); //root->setUpdateCallback(new /*osg::Switch *switchNode = new osg::Switch; switchNode->addChild(root); switchNode->setAllChildrenOff(); */ MSG msg; root->setUpdateCallback(new rootCallback(hWndPaint,&viewer) ); while(!viewer.done()) { if (PeekMessage(&msg,NULL,0,0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if(!viewer.getSceneData()) break; viewer.frame(); } g_var.threadcount --; //卸载钩子释放动态库 ProcUnHook = (UnHook) GetProcAddress(hInstLib,"UnHook"); if (ProcUnHook != NULL) { ProcUnHook(); } FreeLibrary(hInstLib); return 0; //over: // g_var.threadcount --; // GdiplusShutdown(gdiplusToken); // CoUninitialize(); // return 0; } Best regards. YangXiao. Wang Rui <[EMAIL PROTECTED]> 写道: Hi, I suggest do these in a update callback, or set the threading model to SingleThreaded (but not efficiently), because it very dangerous add/remove children in the main loop when multi-thread rendering. You are so lucy not to crash here. :) Wang Rui Thanks Wang Rui in PaintThreadProc I do { root->addchild(); or root->removeChild(); . } YangXiao. ___ 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: blink question!
Thanks Wang Rui in PaintThreadProc I do { root->addchild(); or root->removeChild(); . } YangXiao. Wang Rui <[EMAIL PROTECTED]> 写道: Hi YangXiao, What have been done in your PaintThreadProc()? Have you created a new widget on top of the OSG viewer window and tried to update it? If you want to do so, you'd better get the handle of viewer window first, otherwise your widget will surely blink. Wang Rui 2008/10/27 YangXiao <[EMAIL PROTECTED]> Hi everyone: When i update my scene in PaintThreadProc() function, I found my windows to blink ( to twinkle). Why ? while(!viewer.done()) { if (PeekMessage(&msg,NULL,0,0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if (PaintThreadProc(hWndPaint,root.get(),viewer) == -1) { viewer.setQuitEventSetsDone(true); break; } viewer.frame(); } Best regards. YangXiao. - 雅虎邮箱,您的终生邮箱! ___ 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] blink question!
Hi everyone: When i update my scene in PaintThreadProc() function, I found my windows to blink ( to twinkle). Why ? while(!viewer.done()) { if (PeekMessage(&msg,NULL,0,0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if (PaintThreadProc(hWndPaint,root.get(),viewer) == -1) { viewer.setQuitEventSetsDone(true); break; } viewer.frame(); } Best regards. YangXiao. - 雅虎邮箱,您的终生邮箱!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] submit render question.
Hi all: How osg submit all scene graph geode to render simultaneously. Best regards. YangXiao. __ 赶快注册雅虎超大容量免费邮箱? http://cn.mail.yahoo.com___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 回复: 回复: How to Map a image on osg::Cylinder?
Sorry . I have solved this problem! YangXiao <[EMAIL PROTECTED]> 写道:sorry i find a example osgshape have this function,But how to exclude Cylinder top and bottom plane when map image on it? Thanks . YangXiao. YangXiao <[EMAIL PROTECTED]> 写道: Hi: Everyone How to Map a image on osg::Cylinder? Best regards. YangXiao. - 雅虎邮箱,您的终生邮箱!___ 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 Map a image o n osg::Cylinder?
sorry i find a example osgshape have this function,But how to exclude Cylinder top and bottom plane when map image on it? Thanks . YangXiao. YangXiao <[EMAIL PROTECTED]> 写道: Hi: Everyone How to Map a image on osg::Cylinder? Best regards. YangXiao. - 雅虎邮箱,您的终生邮箱!___ 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 Map a image on osg::Cylinder?
Hi: Everyone How to Map a image on osg::Cylinder? Best regards. YangXiao. - 雅虎邮箱,您的终生邮箱!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] wxWidgets2.8.8 viewport qoestion!
Hi: When i use viewer->getCamera()->setViewport(0,0,1024,768); But when i void PickHandler::pick(const osgGA::GUIEventAdapter& ea, osgViewer::Viewer* viewer) { .. osg::Viewport* viewport = viewer->getCamera()->getViewport(); Here I found viewport size is not (1024,768); } How to set fixed viewerport in wxWidgets2.8.8. Best regards! YangXiao. - 雅虎邮箱,您的终生邮箱!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] release edition question!
Hi When i run my project exe int vs2005,that's ok, But when i run outer it's not correct! I function is render a scale a graphics boudary_width and graphics .. osg::Group * createGraph(osg::Vec3Array* points,osg::Vec4Array* graph_color,osg::Vec4Array* boudary_color,int boudary_width,std::string _name) { osg::Group* trans = new osg::Group; osg::MatrixTransform* trans_scale = new osg::MatrixTransform; osg::Geode * graph = new osg::Geode; graph->setName(_name + "inter"); osg::Geode * graph_scale = new osg::Geode; graph_scale->setName(_name + "outer"); //得到所有点的x,y轴的包围盒 float x_min=0,x_max=0,y_min=0,y_max=0; x_min = x_max = points->operator [](0).x(); y_min = y_max = points->operator [](0).y(); for (int i=1;isize();++i) { if ((points->operator [](i).x())operator [](i).x(); if ((points->operator [](i).x())>x_max) x_max = points->operator [](i).x(); if ((points->operator [](i).y())operator [](i).y(); if ((points->operator [](i).y())>y_max) y_max = points->operator [](i).y(); } //中心点 double x_mid = (x_min+x_max)/2; double y_mid = (y_min+y_max)/2; //得到要伸缩的比例 double x_scale = 1+2*boudary_width/(x_max-x_min); double y_scale = 1+2*boudary_width/(y_max-y_min); //设置变换矩阵 osg::Matrix matrix_scale; osg::Matrix matrix_trans; osg::Matrix matrix_trans1; matrix_scale.makeScale(osg::Vec3(x_scale,y_scale,1)); matrix_trans.makeTranslate(-x_mid,-y_mid,0); matrix_trans1.makeTranslate(x_mid,y_mid,0); //生成几何节点 osg::Geode* graph = new osg::Geode(); { //生成新的几何节点 osg::Geometry* geometry = new osg::Geometry(); //geometry->setName("geometry" ); osg::Geometry* geometry_scale = new osg::Geometry(); //geometry_scale->setName("geometry_scale"); //设置节点的顶点 geometry->setVertexArray(points); geometry_scale->setVertexArray(points); // 设置几何面的颜色 geometry->setColorArray(graph_color); geometry->setColorBinding(osg::Geometry::BIND_OVERALL); geometry_scale->setColorArray(boudary_color); geometry_scale->setColorBinding(osg::Geometry::BIND_OVERALL); // 添加绘制的几何 geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,points->size())); geometry_scale->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,points->size())); // Setup blending geometry->getOrCreateStateSet()->setMode(GL_BLEND, osg::StateAttribute::ON); osg::BlendFunc *fn = new osg::BlendFunc(); fn->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA); geometry->getOrCreateStateSet()->setAttributeAndModes(fn, osg::StateAttribute::ON); geometry_scale->getOrCreateStateSet()->setAttributeAndModes(fn, osg::StateAttribute::ON); //设置透明属性 --透明开关打开 geometry->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); geometry_scale->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); //添加到节点 graph_scale->addDrawable(geometry_scale); trans_scale->addChild(graph_scale); osg::Matrix t = matrix_trans*matrix_scale*matrix_trans1; trans_scale->setMatrix(t); graph->addDrawable(geometry); trans->addChild(graph); trans->addChild(trans_scale); } return trans; } Best regards. YangXiao. - 雅虎邮箱,您的终生邮箱!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] ply or off model format
Hi Can osg plugin read .ply or off model format? Thanks. YangXiao. - 雅虎邮箱,您的终生邮箱!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgmovie a.avi -l osgdb_qt.dll
Hi, I use osgdb_qt.dll play video files, but I find must install QuickTime. If not install QuickTime,which dlls need? Thanks! YangXiao! - 雅虎邮箱,您的终生邮箱!___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 回复: freetype problem
Hi forest37 : If you download 3dpart is vc2005 sp1 ,you must compile your osg2.6 source and 3dpart lib by vc2005 sp1. forest37 <[EMAIL PROTECTED]> 写道: 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 - 想免费升级vip邮箱吗?快来参加喝汇源游网易活动吧!___ 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: ���澶� �?Re: About viewer.addEventHandler(new PickHandler( ))?
Thanks! Jean-Sebastien I write originally code as you descripe.But case(osgGA::GUIEventAdapter::PUSH): { // ... do what you want here I modify my scene node example , node->removechild(1); node->addchild(new node); return false; } // Mouse button release case(osgGA::GUIEventAdapter::RELEASE): { // ... do what you want here node->removechild(1); node->addchild(new node); return false; } But this code sometimes success,sometimes fail! I means code run sequence: 1: PickHandler's pick() code; 2: draw scene code; or they run parallel? Thanks again. Jean-Sébastien Guay <[EMAIL PROTECTED]> 写道: Hello YangXiao, > 2. I have another question, when viewer.frame() which thread > listening windows message(example mouse clicked,keyboard down ,up etc) > ,and when > i update my scene node in updatecallback,How threads guarantee sequence? To avoid threading problems I suggest you use an EventHandler to do this. For example: class MyEventHandler : public osgGA::GUIEventHandler { public: MyEventHandler() {} ~MyEventHandler() {} bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) { switch(ea.getEventType()) { // Mouse button press case(osgGA::GUIEventAdapter::PUSH): { // ... do what you want here return false; } // Mouse button release case(osgGA::GUIEventAdapter::RELEASE): { // ... do what you want here return false; } default: return false; } } }; Then add this handler to the viewer: viewer.addEventHandler(new MyEventHandler); See the osgpick example for an example of a mouse event handler, and the osgkeyboard example for a keyboard event handler - of course you can combine both if you want (the same handle() method can be used for mouse and keyboard events). See the docs for the return values of ea.getEventType(). I suggest you read the OSG Quick Start Guide (free from http://www.osgbooks.com/) and then go around the reference docs (http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/) and the many included examples in the OSG source tree to get a feel for things. These are pretty basic questions that you could answer yourself by reading a bit (not that we don't want to answer them, but you'll wait longer for an answer). J-S -- __ Jean-Sebastien Guay [EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.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: About viewer.addEv entHandler(new PickHandler())?
Thanks Jean-Sébastien Guay 1. I already update my user info. 2. I have another question, when viewer.frame() which thread listening windows message(example mouse clicked,keyboard down ,up etc) ,and when i update my scene node in updatecallback,How threads guarantee sequence? for example : mouse PUSH { mynode->setUpdateCallback(new mycallback() ); } mouse RELEASE { mynode->setUpdateCallback(new mycallback() ); } and all threads execute sequence synchronize with above code? Thanks. Jean-Sébastien Guay <[EMAIL PROTECTED]> 写道: Hi ???, First of all, a little mailing list etiquette: 1. could you please sign your posts, it's polite to let others know how to address you. 2. When asking a new question, you should start a new thread (start a new message and not reply to another message). Now, to your question. > scene->setUpdateCallback(new RotateCallBack()); > > My question is when next mouse PUSH , > scene->setUpdateCallback(new RotateCallBack()) call again and > new a RotateCallBack object. > But can last time RotateCallBack object is auto-delete? You think there may be a memory leak? Look at the code for osg::Node (header and cpp file). osg::Node::setUpdateCallback(NodeCallback* nc) does some checking, but in the end, does this: // set the app callback itself. _updateCallback = nc; and _updateCallback is declared thus: ref_ptr _updateCallback; So it's a ref_ptr. Reference pointers manage the reference count of the pointed objects, and if that count goes to 0, the object deletes itself. So when setUpdateCallback() assigns a new callback to _updateCallback, the old one's ref count decreases by 1, and the new one's ref count increases by 1. If the old one's ref count comes to 0, it will delete itself. See osg::Referenced and osg::ref_ptr for details. As a general tip, I find that generating the doxygen documentation for the OSG source tree with INLINE_SOURCES = YES helps a lot when learning about how OSG does things. It gives you a nice way to browse the doxygen, and then go down to the actual code directly, with cross-references everywhere. Hope this helps, J-S -- __ Jean-Sebastien Guay [EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.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