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.

92 lines
5.1KB

  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <link rel="stylesheet" href="../../style.css">
  6. </head>
  7. <body>
  8. <script data-goatcounter="https://services.opengamestudio.org:443/count" async src="//services.opengamestudio.org:443/count.js"></script>
  9. <div id="header">
  10. <div class="header2">
  11. <div class="menu">
  12. <a href="../../en/news/index.html">News</a>
  13. <a href="../../en/game/index.html">Games</a>
  14. <a href="../../en/tool/index.html">Tools</a>
  15. <a href="../../en/page/about.html">About</a>
  16. </div>
  17. <div id="lang">
  18. <a href="../../en/news/osg-sample.html">EN</a>
  19. <a href="../../ru/news/osg-sample.html">RU</a>
  20. </div>
  21. <div class="clear"></div>
  22. </div>
  23. </div>
  24. <h3 class="left_item_title">In the news...</h3>
  25. <center>
  26. <div class="news_item">
  27. <h2 class="news_item_title">
  28. <a href="osg-sample.html">OpenSceneGraph sample</a>
  29. </h2>
  30. <p class="news_item_date">
  31. 2017-05-12 00:00
  32. </p>
  33. <div class="news_item_contents">
  34. <p><img src="../../images/2017-05_osg-sample.png" alt="Rocket in the distance" /></p>
  35. <p>This article describes creation of the tutorials for building sample OpenSceneGraph application under Linux, macOS, Windows, and Android in April 2017.</p>
  36. <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>
  37. <p>The application is very basic and has the following features:</p>
  38. <ol>
  39. <li>Render window creation</li>
  40. <li>Model loading</li>
  41. <li>Model rendering with simple GLSL shaders</li>
  42. <li>Model motion with a mouse under Linux, macOS, Windows and a finger under Android</li>
  43. </ol>
  44. <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>
  45. <p>Our <a href="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>
  46. <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>
  47. <p>Here's a quick rundown of the files:</p>
  48. <ol>
  49. <li>GLES2 surface</li>
  50. <li>Render activity to render to the surface</li>
  51. <li>Native library Java interface</li>
  52. <li>Native library C++ implementation</li>
  53. <li>CMake file to build native library</li>
  54. <li>Render activity layout</li>
  55. <li>Model to display</li>
  56. </ol>
  57. <p>Here's a quick rundown of the project changes:</p>
  58. <ol>
  59. <li>Update Android manifest to use GLES2 and render activity</li>
  60. <li>Reference native library's CMake file in the project's CMake file</li>
  61. </ol>
  62. <p>OpenSceneGraph documentation suggests building OpenSceneGraph outside Android Studio with CMake. However, this approach has the following limitations:</p>
  63. <ol>
  64. <li>You have to build OpenSceneGraph for each target architecture</li>
  65. <li>You have to manually copy/reference built OpenSceneGraph libraries into Android Studio project</li>
  66. </ol>
  67. <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>
  68. <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>
  69. </div>
  70. </div>
  71. <div id="disqus_thread"></div>
  72. <script>
  73. var disqus_config = function () {
  74. this.page.url = "https://opengamestudio.org/en/news/osg-sample.html";
  75. this.page.identifier = "osg-sample.html";
  76. };
  77. (function() { // DON'T EDIT BELOW THIS LINE
  78. var d = document, s = d.createElement('script');
  79. s.src = 'https://opengamestudio.disqus.com/embed.js';
  80. s.setAttribute('data-timestamp', +new Date());
  81. (d.head || d.body).appendChild(s);
  82. })();
  83. </script>
  84. <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  85. <div id="footer">
  86. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  87. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  88. </div>
  89. </center>
  90. </body>
  91. </html>