openscenegraph

How to build OpenSceneGraph from source and third party dependencies?

好久不见. 提交于 2019-11-30 23:25:21
How can I build OpenSceneGraph from source? What should I do to get the third party dependencies for OSG built? This is just an initial guide which will get basic OSG installed on your system. There are many other configuration changes and compilation with dependencies that you can do later (building third party libraries is specified after the first long dotted line). Extract the OSG source code zip file to a folder Download and install CMake from the CMake website Run CMake In CMake, set the source code folder as the equivalent of F:/ProgramFiles/OSG/OpenSceneGraph–3.1.1 and not as F:

OpenSceneGraph integration into Qt Quick

时光总嘲笑我的痴心妄想 提交于 2019-11-29 16:41:20
I want to integrate OSG scene into my Qt Quick application. It seems that the proper way to do it is to use QQuickFramebufferObject class and call osgViewer::Viewer::frame() inside QQuickFramebufferObject::Renderer::render() . I've tried to use https://bitbucket.org/leon_manukyan/qtquick2osgitem/overview . However, it seems this approach doesn't work correctly in all cases. For example, in Android platform this code renders only the first frame. I think the problem is that QQuickFramebufferObject uses the same OpenGL context both for Qt Quick Scene Graph and code called within

In a multi-threaded C++ app, do I need a mutex to protect a simple boolean?

筅森魡賤 提交于 2019-11-29 11:58:15
问题 I have a multi-threaded C++ app which does 3D rendering with the OpenSceneGraph library. I'm planning to kick off OSG's render loop as a separate thread using boost::threads, passing a data structure containing shared state in to the thread. I'm trying to avoid anything too heavyweight (like mutexes) for synchronization, as the render loop needs to be pretty tight, and OSG itself tries to avoid having to ever lock. Most of the shared state is set before the thread is started, and never

OpenSceneGraph integration into Qt Quick

旧街凉风 提交于 2019-11-28 11:29:22
问题 I want to integrate OSG scene into my Qt Quick application. It seems that the proper way to do it is to use QQuickFramebufferObject class and call osgViewer::Viewer::frame() inside QQuickFramebufferObject::Renderer::render() . I've tried to use https://bitbucket.org/leon_manukyan/qtquick2osgitem/overview. However, it seems this approach doesn't work correctly in all cases. For example, in Android platform this code renders only the first frame. I think the problem is that

[导入]OpenSceneGraph编译指导

邮差的信 提交于 2019-11-26 15:14:43
此文为转载,原文请见www.hesicong.net OpenSceneGraph是一个很大的开源工程,如果要自己编译的话要花一些功夫,而且开源的经常有一些依赖库的原因经常编译失败。开源还有一个问题就是文档有时候跟不上源代码,这个是最恼火的事情。通过好几天的摸索,反复阅读www.openscenegraph.org上面的相关文章,终于在VC++2005环境下面编译成功,现分享如下: 一、OSG源代码的获取: 1、SVN的方式: 参见 http://www.openscenegraph.com/index.php?page=Downloads.SVN 缺点:速度比较慢 2、NightlyTarballs(推荐,以下叙述都以此为基础): 可以自动生成最新的源代码。地址: http://openscenegraph.org/downloads/developer 优点:速度快,源代码保持最新。 二、第三方代码获取: 如果你只编译Core osgXXXX的话可以跳过此步骤。 由于OSG的有一些plugin需要第三方库的支持,所以必需要找到相应的库才能编译完成。 从 http://www.openscenegraph.com/index.php?page=Downloads.Dependencies 可以得到一个WIN32库的压缩包( http://openscenegraph.org

OpenSceneGraph 笔记--C++/CLI写托管Scene类

…衆ロ難τιáo~ 提交于 2019-11-26 15:14:27
最近学了C++/CLI,也写了一些小玩意儿体验了它的强大,昨天开始筹划将以前的弯管机的模拟程序用C++/CLI重写。 基本思路是将底层3D部分和上层GUI图形界面部分大体分离。最原始的做法是写一个C++的类,然后定义一些接口,然后用C++/CLI写一个 Wrapper,然后用C#进行调用。这种做法其实不是很好,增加了很大的工作量,而且在写Wrapper的时候难免有很多重复性的赋值代码。 第二种思路就是直接用C++/CLI开始写,将Native部分和Managed部分合并在一块儿写。当然C++/CLI有一些限制,不能在托管类里面直 接嵌套非托管类,只能有非托管类的指针等等。这个限制带来的最大的不好是osg::ref_ptr,也就是OpenSceneGraph里面的智能指针无 法使用了,因为他是一个类型,不能直接嵌入到托管类里面,所以类似下面的语法是错误的: ref class ManagedClass { osg::ref_ptr<osg::Node> node; } 当然这样写是正确的: ref class ManagedClass { osg::Node* node; } 但这样就失去了智能指针的保护,很容易造成内存泄露,所以当务之急是需要写一个智能指针来代替osg::ref_ptr,但基本上要保持功能的不变。 OpenSceneGraph的引用类都是继承与osg::Object

How To Get File In Assets From Android NDK

时光总嘲笑我的痴心妄想 提交于 2019-11-26 11:20:35
I'm trying to access an image file in the assets folder from the native side. Now I can successfully search through the assets folder and its subdirectories locating the particular file that I am looking for: AAssetDir* assetDir = AAssetManager_openDir(asset_manager, "images"); const char* filename; while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) { __android_log_print(ANDROID_LOG_DEBUG, "Debug", filename); } AAssetDir_close(assetDir); I am also using OSG. I set the image as a texture to my shader with the following code: texture->setImage(osgDB::readImageFile(fileNameWithPath)

How To Get File In Assets From Android NDK

我与影子孤独终老i 提交于 2019-11-26 02:19:57
问题 I\'m trying to access an image file in the assets folder from the native side. Now I can successfully search through the assets folder and its subdirectories locating the particular file that I am looking for: AAssetDir* assetDir = AAssetManager_openDir(asset_manager, \"images\"); const char* filename; while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) { __android_log_print(ANDROID_LOG_DEBUG, \"Debug\", filename); } AAssetDir_close(assetDir); I am also using OSG. I set the image