You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
6.8KB

  1. <!DOCTYPE html>
  2. <head>
  3. <meta charset="utf-8" />
  4. <!-- Set the viewport width to device width for mobile -->
  5. <meta name="viewport" content="width=device-width" />
  6. <title>OpenSceneGraph sample</title>
  7. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/normalize.css" />
  8. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/foundation.min.css" />
  9. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/style.css" />
  10. <link rel="stylesheet" href="http://opengamestudio.org/theme/css/pygments.css" />
  11. <script src="http://opengamestudio.org/theme/js/custom.modernizr.js"></script>
  12. <!-- So Firefox can bookmark->"abo this site" -->
  13. <link href="feeds/all.atom.xml" rel="alternate" title="Opensource Game Studio" type="application/atom+xml">
  14. </head>
  15. <body>
  16. <!-- Nav Bar -->
  17. <nav>
  18. <!-- Show menu items and pages -->
  19. <div class="row">
  20. <div class="large-12 columns top-bar">
  21. <h1><a href="http://opengamestudio.org">Opensource Game Studio</a></h1>
  22. </div>
  23. </div>
  24. <div class="row top-menu">
  25. <div class="large-12 columns">
  26. <a href="/pages/games.html" class="menu-button secondary">Games</a>
  27. <a href="/pages/education.html" class="menu-button secondary">Education</a>
  28. <a href="/pages/about.html" class="menu-button secondary">About</a>
  29. </div>
  30. </div>
  31. </nav>
  32. <!-- End Nav -->
  33. <!-- Main Page Content and Sidebar -->
  34. <div class="row">
  35. <!-- Main Blog Content -->
  36. <div class="large-9 columns">
  37. <article>
  38. <header>
  39. <h3 class="article-title"><a href="http://opengamestudio.org/osg-sample.html" rel="bookmark"
  40. title="Permalink to OpenSceneGraph sample">OpenSceneGraph sample</a></h3>
  41. </header>
  42. <h6 class="subheader" title="2017-05-12T00:00:00+03:00">Пт 12 мая 2017
  43. <a class="button secondary small translation-button" href="http://opengamestudio.org/osg-sample-ru.html">ru</a>
  44. </h6> <p><img alt="OSG sample" src="http://opengamestudio.org/2017-05_osg-sample.png"></p>
  45. <p>This article describes creation of the tutorials for building sample OpenSceneGraph application under Linux, macOS, Windows, and Android in April 2017.</p>
  46. <p>Previous tutorials described how to install OpenSceneGraph under Linux, macOS, Windows and render a model using the standard <strong>osgviewer</strong> tool. This time we worked on a <a href="https://github.com/OGStudio/openscenegraph-cross-platform-guide-application">sample OpenSceneGraph application</a> that would run under Linux, macOS, Windows, and Android.</p>
  47. <p>The application is very basic and has the following features:</p>
  48. <ol>
  49. <li>Render window creation</li>
  50. <li>Model loading</li>
  51. <li>Model rendering with simple GLSL shaders</li>
  52. <li>Model motion with a mouse under Linux, macOS, Windows and a finger under Android</li>
  53. </ol>
  54. <p>Creating the tutorials for Linux, macOS, Windows was so easy and straightforward, that it only took us half a month. We spent the second half of the month creating Android tutorial.</p>
  55. <p>Our <a href="http://opengamestudio.org/2016-october-recap.html">first successful Android build</a> last year included hacks and non-obvious steps to make OpenSceneGraph run under Android. This time we wanted a cleaner, faster, and cheaper approach.</p>
  56. <p>The approach we ended up with requires just a few files and a few changes to the original Android Studio project (with C++ support) to make sample OpenSceneGraph application run under Android.</p>
  57. <p>Here's a quick rundown of the files:</p>
  58. <ol>
  59. <li>GLES2 surface</li>
  60. <li>Render activity to render to the surface</li>
  61. <li>Native library Java interface</li>
  62. <li>Native library C++ implementation</li>
  63. <li>CMake file to build native library</li>
  64. <li>Render activity layout</li>
  65. <li>Model to display</li>
  66. </ol>
  67. <p>Here's a quick rundown of the project changes:</p>
  68. <ol>
  69. <li>Update Android manifest to use GLES2 and render activity</li>
  70. <li>Reference native library's CMake file in the project's CMake file</li>
  71. </ol>
  72. <p>OpenSceneGraph documentation suggests building OpenSceneGraph outside Android Studio with CMake. However, this approach has the following limitations:</p>
  73. <ol>
  74. <li>You have to build OpenSceneGraph for each target architecture</li>
  75. <li>You have to manually copy/reference built OpenSceneGraph libraries into Android Studio project</li>
  76. </ol>
  77. <p>Our approach includes building OpenSceneGraph for those target architectures that Android Studio project is built for. Also, OpenSceneGraph is already referenced, so no extra work is required: you just need to rebuild the project, and you're done.</p>
  78. <p>That's it for describing the creation of the tutorials for building sample OpenSceneGraph application under Linux, macOS, Windows, and Android in April 2017.</p>
  79. <p class="subheader">Category: <a href="http://opengamestudio.org/category/news.html">News</a>
  80. </p>
  81. </article>
  82. </div>
  83. <!-- End Main Content -->
  84. <!-- Sidebar -->
  85. <aside class="large-3 columns">
  86. <!--k
  87. <h5 class="sidebar-title">Site</h5>
  88. <ul class="side-nav">
  89. <li><a href="http://opengamestudio.org/archives.html">Archives</a>
  90. <li><a href="http://opengamestudio.org/tags.html">Tags</a>
  91. <li><a href="http://opengamestudio.org/feeds/all.atom.xml" rel="alternate">Atom feed</a></li>
  92. </ul>
  93. <h5 class="sidebar-title">Categories</h5>
  94. <ul class="side-nav">
  95. <li><a href="http://opengamestudio.org/category/news.html">News</a></li>
  96. </ul>
  97. -->
  98. <h5 class="sidebar-title">Ads</h5>
  99. <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  100. <!-- ogs2 -->
  101. <ins class="adsbygoogle"
  102. style="display:block"
  103. data-ad-client="ca-pub-4473792248813084"
  104. data-ad-slot="9024247127"
  105. data-ad-format="auto"></ins>
  106. <script>
  107. (adsbygoogle = window.adsbygoogle || []).push({});
  108. </script>
  109. </aside> <!-- End Sidebar -->
  110. </div> <!-- End Main Content and Sidebar -->
  111. <!-- Footer -->
  112. <footer class="row">
  113. <div class="large-12 columns">
  114. <hr />
  115. <div class="row">
  116. <div class="large-7 columns">
  117. <p>Proudly powered by <a href="http://getpelican.com">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.</p>
  118. </div>
  119. </div>
  120. </div>
  121. <script type="text/javascript">
  122. var _gaq = _gaq || [];
  123. _gaq.push(['_setAccount', 'UA-3773114-1']);
  124. _gaq.push(['_trackPageview']);
  125. (function() {
  126. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  127. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  128. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  129. })();
  130. </script>
  131. </footer>