简体   繁体   English

使用OpenSceneGraph和Code :: Blocks

[英]Using OpenSceneGraph with Code::Blocks

I have to integrate osg into my project on code blocks. 我必须在代码块上将osg集成到我的项目中。 In osg web site, there is only one unanswered post. 在osg网站上,只有一篇未答复的帖子。

Has anyone used osg and codeblocks together? 是否有人一起使用过osg和代码块?

I assume you're developing on windows from your tags. 我假设您正在使用标签在Windows上进行开发。
Ok. 好。 If you havent set up OSG already, checkout this blog for instructions on compiling with MingW/MSYS. 如果您尚未设置OSG,请查看此博客以获取有关使用MingW / MSYS进行编译的说明。
The OSG wiki considers the article to be more up to date (as at May-26-13') than its wiki entry. OSG Wiki认为该文章比其Wiki条目更具最新性 (截至13年5月26日)。
There's also binaries at the bottom to save you time. 底部还有二进制文件,以节省您的时间。

Next, fire up C::B and create a new C++ console application. 接下来,启动C :: B并创建一个新的C ++控制台应用程序。 Follow the wizard thru to the end. 按照向导进行操作,直至结束。 Select MingW/GCC as your compiler. 选择MingW / GCC作为编译器。

  1. Create a new set of Global Variables. 创建一组新的全局变量。 Settings -> Global Variables 设置->全局变量
  2. Call the new variable "OSG". 调用新变量“ OSG”。
  3. Set the "base" field to your OSG root folder 将“基本”字段设置为您的OSG根文件夹
    • Optional: Set the "include" field to your OSG include folder 可选:将“ include”字段设置为您的OSG include文件夹
    • Optional: Set the "lib" field to your OSG libs folder 可选:将“ lib”字段设置为您的OSG libs文件夹
  4. Open project -> build options. 打开项目->构建选项。
    • go to the "Search Directories" tab 转到“搜索目录”标签
    • under the "compiler" tab add $(#OSG.include) 在“编译器”选项卡下,添加$(#OSG.include)
    • under the "linker" tab add $(#OSG.lib) 在“链接器”选项卡下,添加$(#OSG.lib)
  5. Click the "Linker Setings" tab and copy paste the following libs (according to your projects needs) under the "Other linker options" textbox. 单击“链接器设置”选项卡,然后将以下库(根据您的项目需要)复制粘贴到“其他链接器选项”文本框中。 Each should be separated by a new-line AS IS. 每一个都应由换行符AS IS分隔。
    \n-losg -losg \n-losgGA -losgGA \n-losgDB -losgDB \n-losgViewer -losgViewer\n-losgText -losgText \n-losgUtil -losgUtil \n-lOpenThreads -lOpenThreads\n
  6. Click ok. 单击确定。
  7. Goto File -> Save everything (optional but if C::B crashes, you might wish you did this) 转到文件->保存所有内容(可选,但如果C :: B崩溃,则可能希望这样做)
  8. Copy paste all the code from this tut/example into your main.cpp and try compiling. 将所有示例代码/示例中的所有代码复制并粘贴到main.cpp中,然后尝试进行编译。

Make a good game/3d app if it works, otherwise Let me know if it mis-behaves. 如果可以,请制作一个好的游戏/ 3d应用程序,否则,请让我知道它的行为是否正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM