Re: [osg-users] Camera Problem
Hi, I took this code from OSG Active X Example and this problem happens there as well. So I'm just trying to find a reason why it's happening. This is entire code of on CREATE event: Code: RECT rect; GetWindowRect(rect); // Set window traits and gc _traits = new osg::GraphicsContext::Traits; osg::ref_ptrosg::Referenced windata = new osgViewer::GraphicsWindowWin32::WindowData( GetSafeHwnd() ); _traits-x = 0; _traits-y = 0; _traits-width = rect.right - rect.left; _traits-height = rect.bottom - rect.top; _traits-windowDecoration = false; _traits-doubleBuffer = true; _traits-sharedContext = 0; _traits-setInheritedWindowPixelFormat = true; _traits-inheritedWindowData = windata; try { _gc = osg::GraphicsContext::createGraphicsContext( _traits.get() ); } catch (...) { ::MessageBox(0, L... Exception, LHint, MB_OK); } _gc-setClearColor( osg::Vec4f(1.0f, 1.0f, 1.0f, 1.0f) ); _gc-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Create camera osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(_gc); camera-setViewport( new osg::Viewport(_traits-x, _traits-y, _traits-width, _traits-height) ); camera-setProjectionMatrixAsPerspective( 30.0f, (double)_traits-width/(double)_traits-height, 1.0f, 1.0f ); camera-setClearMask( GL_DEPTH_BUFFER_BIT ); // Create Screen Capture Handler osgViewer::ScreenCaptureHandler::CaptureOperation* captureOperation = new CustomCaptureOperation(_saveScreenshotEvent); _scnsvr = new osgViewer::ScreenCaptureHandler(captureOperation); // Create viewer _viewer = new osgViewer::Viewer; _viewer-setThreadingModel( osgViewer::Viewer::SingleThreaded ); _viewer-setCamera( camera.get() ); _viewer-setCameraManipulator( new osgGA::TrackballManipulator ); // Switch off the end signal of the viewer main loop _viewer-setKeyEventSetsDone(0); // Set root node of the scene _root = new osg::Group; _viewer-setSceneData( _root.get() ); _viewer-realize(); // Create a thread for the simulation loop StartRenderingThread(); MYTRACE_END0; return 0; } So I'm realy running out of ideas what might be the problem. Thank you! Cheers, Danny[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27484#27484 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera Problem
Hi, Does any bosy have any clue? It's realy show stopper for us. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27437#27437 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ScreenShot File name
Hi Jean-Sébastien, Thank you very much we override the operator() and it solves the problem. however I beleive that this problem happens beause of line 545 in operator() filename _filename _ context_id; it will add context_id even if SetPolicy is set as OVERWRITE . I beleive this is bug. Isn't it? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25706#25706 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ScreenShot File name
Hi Jean-Sébastien, Tahnk you very much for your response it was very helpfull, I implemented your advice and it seems to work perfect. Code: osgViewer::ScreenCaptureHandler* _scnsvr; _scnsvr = new osgViewer::ScreenCaptureHandler(new osgViewer::ScreenCaptureHandler::WriteToFile(test,png,osgViewer::ScreenCaptureHandler::WriteToFile::SavePolicy::OVERWRITE)); It works nice in standard OSG application, my issue is the following: I'm using OSG inside of ActiveX control (based on OSGActiveX example) embedded into HTML page. First time when I'm loading it and each time I'm taking snapshot, I'm getting test_0.png and each snapshot overwrites this file. When I'm pressing F5 or reloading page using IE address bar I'm starting to save snapshots as test_1.png and each snaphot overwrite this file. This behavior continues each time I'm reloading page. the counter is being incremented by one to test_2, test_3 etc the only solution for this problem is to close IE and to wait till ActiveX unloads from Memeory. after it the counts start form zero. I have no clue how to resolve it and this is major blocking issue for my project. Could you please help? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25620#25620 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Textures on loaded models are flipped.
Hi Robert You are absolutely right :) Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25422#25422 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] ScreenShot File name
Hi, I'm trying to cupture screenshot with the following code: Code: osgViewer::ScreenCaptureHandler* scnsvr; scnsvr = new osgViewer::ScreenCaptureHandler(); osgViewer::ViewerBase* viewer = _viewer-getViewerBase(); _scnsvr-captureNextFrame(*viewer); I would like to do the following: 1) To disable static counter on the output file name and alway overwrite the last file. 2) Save this file in custom path on hard drive. How can set these option to ScreenCaptureHandler? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25423#25423 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Textures on loaded models are flipped.
Hi, In some cases when I'm loading models with textures (jpeg or tga was tested so far), my textures are flipped horizontally on 180 degrees see attached picture. I can reproduce this problem with my application and with osgviewer as well. What the problem is and how could I solve this issue? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=25309#25309 Attachments: http://forum.openscenegraph.org//files/fliiped_158.png ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph and MultiThreading
Hi, I searched the forum and was enspired by the following Topic: http://www.mail-archive.com/osg-us...@openscenegraph.net/msg08183.html I tried to create separate thread which will run from main function and run LoadNodefile. Code: class MyThread : public OpenThreads::Thread { public: MyThread(osg::Node* node) : _done(false),_node(node) { /* ... */ } virtual ~MyThread() { /* ... */ } virtual void run() { _node = osgDB::readNodeFile(cow.osg); } void stopWorking() { _done = true; join(); } protected: bool _done; osg::Node* _node; }; int main() { osg::Node* node = NULL; osg::Group* root = new osg::Group(); MyThread* myThread = new MyThread(node); myThread-start(); root-addChild(node); osgViewer::Viewer viewer; root-addChild(node); viewer.setSceneData( root ); viewer.addEventHandler(new osgViewer::ThreadingHandler); while( !viewer.done() ) { .. } } The value of node is null. I'm a newbie in Threading Programming, but I need to find a way to work it out. could anybody help? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=24146#24146 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OpenSceneGraph and MultiThreading
Hi, Can anybody help me how can I run osgDB::ReadNodeFile in separate Thread? I'm loading huge 3ds model and I don't want to keep my window frozen till the model is opened. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=24065#24065 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph and MultiThreading
Hi Robert, Thank you for your response, I have my OSG libraries already compiled with curl (http+https) and zip ( plugin which unzips models directly to memory) and I'm downloading zip models from URL. Can I still use Proxynode under these circumstances? I googled internet for any ProxyNode example, but haven't found any usefull links all examples where overkilled and parts of terrain Simulator. Could you point me to any direction where I can find example which will help me to solve this issue? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=24103#24103 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Saving Screenshot
Hi, This is activeX control and inside the contol I have a method which prints screenshot. This is how I do initiate control AND all OSG instances: Code: int ViewerCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (COleControl::OnCreate(lpCreateStruct) == -1) return -1; RECT rect; GetWindowRect(rect); WCHAR str[255]; swprintf(str, L(%d,%d) - (%d,%d), rect.left,rect.top,rect.right,rect.bottom); // Set window traits and gc _traits = new osg::GraphicsContext::Traits; osg::ref_ptrosg::Referenced windata = new osgViewer::GraphicsWindowWin32::WindowData( GetSafeHwnd() ); _traits-x = 0; _traits-y = 0; _traits-width = rect.right - rect.left; _traits-height = rect.bottom - rect.top; _traits-windowDecoration = false; _traits-doubleBuffer = true; _traits-sharedContext = 0; _traits-setInheritedWindowPixelFormat = true; _traits-inheritedWindowData = windata; _gc = osg::GraphicsContext::createGraphicsContext( _traits.get() ); _gc-setClearColor( osg::Vec4f(0.2f, 0.2f, 0.6f, 1.0f) ); _gc-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Create camera osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(_gc); camera-setViewport( new osg::Viewport(_traits-x, _traits-y, _traits-width, _traits-height) ); camera-setProjectionMatrixAsPerspective( 30.0f, (double)_traits-width/(double)_traits-height, 1.0f, 1.0f ); camera-setClearMask( GL_DEPTH_BUFFER_BIT ); // Create viewer _viewer = new osgViewer::Viewer; _viewer-setThreadingModel( osgViewer::Viewer::SingleThreaded ); _viewer-setCamera( camera.get() ); _viewer-setCameraManipulator( new osgGA::TrackballManipulator ); // Set root node of the scene _root = new osg::Group; _viewer-setSceneData( _root.get() ); _viewer-realize(); WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, CRect(01, 1, 50, 50), this, 1000); // Create a thread for the simulation loop _beginthread(RenderThread, 0, _viewer); return 0; } and this is how do I take screenshot: Code: VARIANT_BOOL ViewerCtrl::SaveScreenshot(LPCTSTR name) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CW2A tmpStr(name); osg::ref_ptrosg::Image shot = new osg::Image(); shot-allocateImage(640, 480, 24, GL_RGB, GL_UNSIGNED_BYTE); osg::ref_ptrosg::Camera camera = _viewer-getCamera(); _viewer-frame(); camera-attach(osg::Camera::COLOR_BUFFER, shot.get()); osgDB::writeImageFile(*shot, test.png ); //osgViewer::ScreenCaptureHandler* scrn = new osgViewer::ScreenCaptureHandler(); //osgViewer::ScreenCaptureHandler::WriteToFile* captureOper = new osgViewer::ScreenCaptureHandler::WriteToFile(tmpStr.m_szBuffer, png); //scrn-setCaptureOperation(capt()ureOper); //scrn-captureNextFrame(*_viewer); //_viewer-frame(); return VARIANT_TRUE; } so any clue or suggestion is welcomed. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=23053#23053 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Saving Screenshot
Hi, Does anybody have any clue? how to solve this problem? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=22922#22922 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Saving Screenshot
Hi, I'm playing with OSG activeX example and trying to make screenshot of current scene, but I get black screenshot. the Viewer initiation is the following: Code: _traits = new osg::GraphicsContext::Traits; osg::ref_ptrosg::Referenced windata = new osgViewer::GraphicsWindowWin32::WindowData( GetSafeHwnd() ); _traits-x = 0; _traits-y = 0; _traits-width = rect.right - rect.left; _traits-height = rect.bottom - rect.top; _traits-windowDecoration = false; _traits-doubleBuffer = true; _traits-sharedContext = 0; _traits-setInheritedWindowPixelFormat = true; _traits-inheritedWindowData = windata; _gc = osg::GraphicsContext::createGraphicsContext( _traits.get() ); _gc-setClearColor( osg::Vec4f(0.2f, 0.2f, 0.6f, 1.0f) ); _gc-setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Create camera osg::ref_ptrosg::Camera camera = new osg::Camera; camera-setGraphicsContext(_gc); camera-setViewport( new osg::Viewport(_traits-x, _traits-y, _traits-width, _traits-height) ); camera-setProjectionMatrixAsPerspective( 30.0f, (double)_traits-width/(double)_traits-height, 1.0f, 1.0f ); camera-setClearMask( GL_DEPTH_BUFFER_BIT ); // Create viewer _viewer = new osgViewer::Viewer; _viewer-setThreadingModel( osgViewer::Viewer::SingleThreaded ); _viewer-setCamera( camera.get() ); _viewer-setCameraManipulator( new osgGA::TrackballManipulator ); The part of the code which grabs screenshot is the following: Code: osgViewer::ScreenCaptureHandler* scrn = new osgViewer::ScreenCaptureHandler(); osgViewer::ScreenCaptureHandler::WriteToFile* captureOper = new osgViewer::ScreenCaptureHandler::WriteToFile(tmpStr.m_szBuffer, png); scrn-setCaptureOperation(captureOper); scrn-captureNextFrame(*_viewer); _viewer-frame(); I think I need to take screenshot from GraphicContext instead of viewer, but I have no idea how to do it. Can you please help? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=22850#22850 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] split scene into separate nodes/files.
Hi, Now I know that there might be more then one MatrixTranform on the tree for each node. The problem is solved. Thank you very much for your help. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=22350#22350 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] split scene into separate nodes/files.
Hi, As far as I understand, but the WorldMatrix resides in the MatrixTransform node which is farther of Geode so when I'm getting Geode I'm actually saving its farther (MatrixTransform) The Geode is currGroup-getChild(i) And the farther is CurrGroup which I also tried to save. osgDB::writeNodeFile(*(currGroup),currGroup-getChild(i)-getName()+.ive); Is there any other way to get worldMatrx of the node? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=22288#22288 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] split scene into separate nodes/files.
Hi, I tried the following: Code: node = dynamic_castosg::Node*(currGroup-getChild(i)); osg::NodePathList npl = node-getParentalNodePaths(); if (!npl.empty()) { np = npl.front(); osg::Matrixd localToWorld = osg::computeLocalToWorld(np); grp = new osg::Group(); grp-addChild(node); matrixtransform = new osg::MatrixTransform(); matrix-setMatrix(localToWorld); grp-addChild(matrix); } osgDB::writeNodeFile(*(grp),currGroup-getChild(i)-getName()+.ive); but the result was the same. What i'm doing wrong? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=22304#22304 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] CURL + SSL
Hi, I solved this problem in order to get it working with SSL the following code should be changed: 1) It's needed to fix the following functions for https support: Code: bool osgDB::containsServerAddress(const std::string filename) std::string osgDB::getServerAddress(const std::string filename) std::string osgDB::getServerFileName(const std::string filename) Currently these functions suport only http requests and the fix there is very easy. 2) There are two ways to handle ssl in curl the secure way and the ugly way. the ugly way means that client will not validate server certificate. This is less prefered method, but http stream is still encrypted, it means that every server certificate will be accepted regardless the fact that it's issued to another machine,domain, etc... If decided to go on this derection then the following line should be added in EasyCurl::EasyCurl() contructor: Code: curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, false); If decided to go on secure way then end user should download server certifiace store it in X.509 Certificate (PEM) format in any place on the machine. in EasyCurl::EasyCurl() constructor following code should be added: Code: curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, true); curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYHOST, 2); curl_easy_setopt(_curl,l_setopt($ch, CURLOPT_CAINFO, certifiacePath); CURLOPT_SSL_VERIFYHOST can be set to the following integer values: 0: Don’t check the common name (CN) attribute 1: Check that the common name attribute at least exists 2: Check that the common name exists and that it matches the host name of the server. Hope it helps Thank you! Cheers, Danny.[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=21870#21870 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] curl Plugun + OSG
Hi, Thank you it helped the plugin is now installed. It works perfect with .ive files. However, it shows nothing nothing with 3ds file, I'm OK with downloading ive files only, but I'm curious why I can't work with 3DS extentions. Another issue is how to set proxy setting for passing through corporate firewalls? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=21832#21832 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] CURL + SSL
Hi, I have new issue with SSL and CURL, so I have decided to open new thread. I conifured my site with SSL and I'm able to download ive file perfectly from https://servername/1.ive, however, when I'm using Node = osgDB::readNodeFile(https://servernmae/1.ive;); Node is getting NULL. In order to be sure that there is no issue with Certificate (although the certificate was issue by Verisign as 14 day trial) I modified ReaderWriterCURL.cpp by adding curl_easy_setopt(_curl, CURLOPT_SSL_VERIFYPEER, false); in EasyCurl() constructor and recompile entire OpenSceneGrpaph project. The result is still the same. Am I missing something? How can I this feature working? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=21841#21841 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] curl Plugun + OSG
Hi Jean-Sebastien, Thank you for the reply. I've never used CMAKE on windows so this is kind of first try for me. I downloaded libcurl-7.15.1-msvc-win32-ssl-0.9.8a-zlib-1.2.3.zip file. It contains src lib include directory. As far as I understand, I need to add CURL_INCLUDE_DIR refers to libcurl\lib directory and CURL_LIBRAY refers to root of libcurl source directory? Is it correct? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=21787#21787 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] curl Plugun + OSG
Hi, In previous post robert told me that in order to load file from URL I need to compile against libcurl plugin. Does it mean that I need to recompile OSG with this plugin or do I need to add reference to Visual Studio of these libs? Could anybody clarify and help me with this issue? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=21733#21733 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 3D Max lights
Hi, I created scene in 3D studio max and set up appropriate light. When I'm loading this 3DS in the OSG I don't have these lights enabled. I tried to turn on the lights on these specific node however it did not solved the problem. I tried the following: cessnaNode = osgDB::readNodeFile(C:\\Lights.3DS); osg::StateSet *state = cessnaNode-getOrCreateStateSet(); state-setMode( GL_LIGHTING, osg::StateAttribute::PROTECTED | osg::StateAttribute::ON ); How can I enable original lights from 3D studio Max? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=21705#21705 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 2.9.6 version
Hi, I saw the following announcement in OSG 2.9.6: Http support in present3D to allow online presentations to by browsed directly. Could any body explain what this option will do? * New osgQtbrowser example that integrates QWebKit with the OSG to provide an embedded 3d web browser. I was not able to run this example. does any body have at least screenshot of what this example is doing? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=21637#21637 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Load file from URL link
Hi, Is there any way to read node file using osgDB::readNodeFile method from URL? For example http://localhost/1.3DS Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=21590#21590 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Animated Models
Ulrich Hertlein wrote: On 4/12/09 3:14 AM, Danny Lesnik wrote: And the second question: Can OSG view animated gifs as model textures? I haven't personally used this but the code is there so it should work. You probably have to start the animation manually. To do that you need to find the respective image, dynamic_cast it to an ImageStream and (if successful) call play() on that object. /ulrich ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum Hi Ulrich, How can I find this respective image? Best regards, Danny. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20931#20931 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Animated Models
Hi, How can I create animations within OSG models (similar to cessnafire.osg sample scene).? for example, how this file was created? And the second question: Can OSG view animated gifs as model textures? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20851#20851 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg::AnimationPathCallback Volocity
Hi, Is there any way to use Velocity while moving object by ControlPoint and time? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=18363#18363 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSGAnimationPath.
Hi, rPath-insert(16.0f , c0 ); The code waits for 16 seconds nd it was the problem. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16918#16918 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSGAnimationPath.
Hi, When I change rPath-setLoopMode(osg::AnimationPath::NO_LOOPING); with rPath-setLoopMode(osg::AnimationPath::LOOP) or SWING. This code works perfect. I just wonder what might be the problem. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16856#16856 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSGAnimationPath.
Hi Cedric, This is sample code that reproduces this problem: #include osgViewer/Viewer #include osg/animationpath #include osg/matrixtransform #include osg/ShapeDrawable #include osg/PositionAttitudeTransform #include osg/Node #include osgDB/ReadFile #include osgGA/TrackballManipulator #include osg/AnimationPath class MoveObjectForward : public osg::AnimationPathCallback { public: MoveObjectForward::MoveObjectForward() { osg::ref_ptrosg::AnimationPath rPath = new osg::AnimationPath; rPath-setLoopMode(osg::AnimationPath::NO_LOOPING); osg::AnimationPath::ControlPoint c0(osg::Vec3(-10,0,0)); osg::AnimationPath::ControlPoint c1(osg::Vec3(10,0,0)); rPath-insert(16.0f , c0 ); rPath-insert( 20.0f, c1 ); this-setAnimationPath(rPath.get()); } }; osg::Node* tankNode = NULL; int main() { tankNode = osgDB::readNodeFile(c:\\R_Road_Street_G_Sidewalk.3DS); osg::Group* root = new osg::Group(); osg::PositionAttitudeTransform* tankXform = new osg::PositionAttitudeTransform(); tankXform-setName(ddd); root-addChild(tankXform); tankXform-addChild(tankNode); osg::Vec3 tankPosit(-10,0,0); tankXform-setPosition( tankPosit ); tankXform-setUpdateCallback(new MoveObjectForward()); osgViewer::Viewer viewer; viewer.setSceneData( root ); viewer.setCameraManipulator(new osgGA::TrackballManipulator); viewer.realize(); while( !viewer.done() ) { viewer.frame(); } return 0; } Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16863#16863 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSGAnimationPath.
Hi, I have another problem with animationPath. I want to move object from -10,0,0 to 10,0,0 using 'w' button and bring it back to initial possition using 'q' button. Everything work fine except the problem that I have 10 seconds delay after I release keyboard button and object starts to move. Could anybody help? I implented to the following class: class MoveObjectForward : public osg::AnimationPathCallback { public: MoveObjectForward::MoveObjectForward() { osg::ref_ptrosg::AnimationPath rPath = new osg::AnimationPath; rPath-setLoopMode( osg::AnimationPath::NO_LOOPING); osg::AnimationPath::ControlPoint c0(osg::Vec3(-10,0,0)); osg::AnimationPath::ControlPoint c1(osg::Vec3(10,0,0)); rPath-insert(16.0f , c0 ); rPath-insert( 20.0f, c1 ); this-setAnimationPath(rPath.get()); } }; after it I implented recursive function osg::Node* findNamedNode(const std::string searchName, osg::Node* currNode); which returns node according to its name. Then I implement Keyboard event which sets appropriate callBack according to key. bool myKeyboardEventHandler::handle(const osgGA::GUIEventAdapter ea,osgGA::GUIActionAdapter aa) { osgViewer::Viewer* viewer = dynamic_castosgViewer::Viewer*(aa); osg::Node* scene = viewer-getSceneData(); osg::PositionAttitudeTransform* tankXform = new osg::PositionAttitudeTransform(); switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::KEYUP): { switch(ea.getKey()) { case 'w': tankXform = dynamic_castosg::PositionAttitudeTransform*(findNamedNode(myNode,scene)); tankXform-setUpdateCallback(new MoveObjectForward()); return false; break; case 'q': tankXform = dynamic_castosg::PositionAttitudeTransform*(findNamedNode(myNode,scene)); tankXformsetUpdateCallback(new MoveObjectBack()); return false; break; default: return false; } } default: return false; } } Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16853#16853 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Shadows Problem on vista
Hi everybody, Thank you for reply. We are talking about 2 different laptops. One with Windows XP and second with Vista, both have latest ATI Rageon drivers. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16669#16669 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Intersect.
Hi, I'm trying to use intersect for primitive collision detection. I load one 3DS file into my scene and test whether this object has any intersections. The problem is following: Although ,there is only one object in my scene, I can clearly see that this object intersects with something. This is the code I'm using: tankNode = osgDB::readNodeFile(c:\\3.3DS); osg::Vec3d intersection; osg::BoundingSphere bs = tankNode-getBound(); osg::Vec3 start = bs.center() + osg::Vec3d(bs.radius(),0.0,0.0); osg::Vec3 end = bs.center() ; osg::ref_ptrosgUtil::LineSegmentIntersector lsi = new osgUtil::LineSegmentIntersector(start,end); osgUtil::IntersectionVisitor iv(lsi.get()); tankNode-accept(iv); if (lsi-containsIntersections()) { intersection = lsi-getIntersections().begin()-getWorldIntersectPoint(); } While I'm running this code in debugger,the values are following: bs.center = (0,0,0); bs.radius = 43.0 start = (43.0,0.0,0.0) end= (0,0,0) intersects = (12.5,0,0) and this is weird. Am I missing somthing? Thank you! Cheers, Danny. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16674#16674 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Intersect.
Hi Paul, I just can't realize I have only one object its bs radius os 43. what is the object that I can intersect with on x =12,5? There supposed to be nothing. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16689#16689 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Intersect.
Hi Paul, Thank you for your help. I think I understand now what LineSegmentIntersector is doing. What might be the correct approach to test wether bounding sphere intrsect with any other project? My idea is to move object with UpdateCallBack and stop movement if I have any other object on its way. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16700#16700 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Shdows Problem o vista
Hi, does anybody has any idea on that issiue? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16609#16609 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Shdows Problem o vista
Hi, I'm using Visual Studio 2008 with osg 2.8.1. I have vary strange problem with with shadows on my scene. On vista all shadows are moved chaoticaly (see attached pictures ). However on XP everything is OK and I can see my shadows casted by camera lights. I'm using the following code: const int ShadowTraversalMask = 0x2; osg::ref_ptrosgShadow::ShadowedScene shadowedScene = new osgShadow::ShadowedScene; shadowedScene-setReceivesShadowTraversalMask(ShadowTraversalMask); shadowedScene-setCastsShadowTraversalMask(ShadowTraversalMask); osg::ref_ptrosgShadow::ShadowMap sm = new osgShadow::ShadowMap; shadowedScene-setShadowTechnique(sm.get()); int mapres = 4096; sm-setTextureSize(osg::Vec2s(mapres,mapres)); node-setNodeMask(ShadowTraversalMask); shadowedScene-addChild(node); How can I solve this problem on Vista Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16496#16496 attachment: XP.JPGattachment: Vista.jpg___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Rotation and scaling problem
Hi, Thank you for the direction. osg::Matrix matrix; matrix.makeIdentity(); osg::Group* root = node-asGroup(); osg::MatrixTransform* transform = dynamic_castosg::MatrixTransform*(root-getChild(0)); transform-setMatrix(matrix); Solved the problem. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16288#16288 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Rotation and scaling problem
Hi Rabbi Thank you for your suggestion. I tried to make it as follows: Node* ResetNodeMatrices( Node *node) { osg::Group* root = new osg::Group; osg::Matrix matrix; osg::MatrixTransform* transform = new osg::MatrixTransform; matrix.makeIdentity(); transform-setMatrix(matrix); root-addChild(transform); transform-addChild(node); return root-getChild(0); } but the result was the same. What did I do wrong? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16251#16251 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Rotation and scaling problem
Hi, I have another newb question: I'm loading .3ds file using osgDB::readNodeFile. Originally, the file,for example, was scaled by 5 on X,Y,Z and rotated 45 degrees on axis Z. How can I reset these tranformation and show these files in original size and angle? I tried to use OrientationConverter class fro osgconv.exe source code, but i'm not able to reset original 3dmax scaling. Please help. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16193#16193 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Text location inside Label widget
Hi, I'm trying to set widget as canvas and label with text located in left upper corner. However when I'putting my text I see it in wrong place (see attached picture). Below you can find the code which draws this widget: osgWidget::Canvas* canvas = new osgWidget::Canvas(canvas); canvas-setOrigin(600,70); osgWidget::Label* pLabel = new osgWidget::Label(infoLabel, ); pLabel-setFont(c:\\windows\\font\\BROWAUZ.TTF); pLabel-setFontSize(20); pLabel-setTexCoord(0.0f,0.0f,osgWidget::Widget::UPPER_LEFT); pLabel-setFontColor(0.4f, 0.5f, 1.0f, 0.7f); pLabel-setText(...); pLabel-setSize(300.0f, 300.0f); canvas-addWidget(pLabel,30.0f,0.0f); canvas-getBackground()-setColor(0.9f, 0.3f, 0.5f, 0.4f); wm-addChild(canvas); Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=16139#16139 attachment: widget.GIF___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Widgets and loaded model.
Hi Robert, Thank you very much for quick response. I solved this problem your last resposne helped me. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15526#15526 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Widgets and loaded model.
Hi Robert, Thank you for response, I'll explain more. I loaded any 3ds file using the following: myNode = osgDB::readNodeFile(C:\\3.3DS); osg::Group* root = new osg::Group(); root-addChild(myNode); osgViewer::Viewer viewer; viewer.setCameraManipulator(new osgGA::TrackballManipulator); viewer.setSceneData( root ); //running my window with and widget button. wm-addChild(buttons); return createExample(viewer, wm, root); Now I want to click on my widget and hide object with myNode-SetNodeMask(0), if I understand correctly I have the following widget event bool handlePressAdd(osgWidget::Event ev) { . .. } My question is how can I access myNode from handlePressAdd event? and I want to perfrom opposite operation. I would like to click on myNode and change text on the widget button. how can I access widget from bool handle event. Hope this explaination clrifies my question. Thank you, Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15472#15472 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Widgets and loaded model.
Hi, I have another question. Can I update widget text when I select node (loaded 3ds mode) in the scene? Can I update (translate, rotate) any node when I'm clicking on widget? Is there any example or clue? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15458#15458 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] object blinking while moving camera
Hi Everybody, Does anyone have any clue? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15440#15440 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera Move example
Hi, Thank you so much you solved my problem. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15280#15280 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] object blinking why moving camera
Hi, I'm able now to move my camera left and right as the keyboard event. waht i'm doing is taking current camera matrix by camera-getViewMatrix(); Then multiply this matrix with transaction matrix having X(0,4) = 1 for moving right and -1 ny moving left. any setting new camera location matrix by camera-setViewMatrix(result); This works fine, but my problem is that every ten step my objects are blinking (or kind of refreshing) and animation is not smooth. I'm running my viewer with the loop viewer.realize(); while( !viewer.done() ) { viewer.frame(); } How can I avoid this blinking and get smooth picture? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15281#15281 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera Move example
Hi, It looks like camera is not moving. I have changed the order of matrix transformation, but there was no result. I also changed case(osgGA::GUIEventAdapter::KEYDOWN): { switch(ea.getKey()) { case osgGA::GUIEventAdapter::KEY_Down: viewer-getCamera()-setViewMatrixAsLookAt(osg::Vec3d(15.0, -25.0, -25.0), osg::Vec3d(0.0, 0.0, -30.0), osg::Vec3d(0.0, 0.0, 1.0) ); But camera still freezes. I still believe that I'm doing something wrong, but am running out of ideas what. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15168#15168 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera Move example
Hi Jean-Sébastien, Thank you for your reply i'm trying to do it by first method I implemented some code but it looks like this code does nothing: bool CameraMover::handle(const osgGA::GUIEventAdapter ea,osgGA::GUIActionAdapter us) { osg::Matrixd myCameraMatrix; osg::Matrixd cameraRotation; osg::Matrixd cameraTrans; cameraRotation.makeRotate( osg::DegreesToRadians(0.0), osg::Vec3(0,1,0), // roll osg::DegreesToRadians(60.0), osg::Vec3(1,0,0) , // pitch osg::DegreesToRadians( 45.0), osg::Vec3(0,0,1) ); // heading cameraTrans.makeTranslate( 1,5,1 ); myCameraMatrix = cameraRotation * cameraTrans; osg::Matrixd i = myCameraMatrix.inverse(myCameraMatrix); osgViewer::Viewer* viewer = dynamic_castosgViewer::Viewer*( us ); ... switch(ea.getKey()) { case osgGA::GUIEventAdapter::KEY_Down: viewer-getCamera()-setViewMatrix(i*osg::Matrix::rotate(-(osg::PI_2),1,0,0)); return false; break; .. } } int main() { .. viewer.addEventHandler(new CameraMover); viewer.realize(); while( !viewer.done() ) { viewer.frame(); } Could you tell me please why my event is not working? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15152#15152 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] BasicKeyboardInput example
Hi, I'm learning OSG throught the examples in tutorials section. I'm looking in following tutorial: http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/BasicKeyboardInput There is some piece of code: class updateTankPosCallback : public osg::NodeCallback { public: updateTankPosCallback::updateTankPosCallback(tankInputDeviceStateType* tankIDevState) : rotation(0.0) , tankPos(-15.,0.,0.) What is rotation(0,0) ? waht king of variable it is? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15050#15050 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Camera Move example
Hi, Another Nub Q: I'm trying to move my camera forward and backward as the event of up/down key. I created class CameraMover inherited from osgGA::GUIEventHandler. I also have handle function with switch\case: case(osgGA::GUIEventAdapter::KEYDOWN): { switch(ea.getKey()) { case osgGA::GUIEventAdapter::KEY_Down: std::cout down key pressed std::endl; return false; break; case osgGA::GUIEventAdapter::KEY_Up: std::cout up key pressed std::endl; return false; break; default: return false; } } viewer.addEventHandler(new CameraMover()); I also understand that in order to move camera back and forward in need to perform camera-setViewMatrix() manipulation, but I'm failing to understand where and how should I call to the camera function and how to link this function to event handle function: osg::Camera* camera = viewer.getCamera(); camera- ? Any help or example will be appreciated. Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15116#15116 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org