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.

153 lines
5.7KB

  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <style>
  6. #header
  7. {
  8. background: #2BA6E3;
  9. padding: 0.7em;
  10. text-align: left;
  11. }
  12. #header a
  13. {
  14. color: white;
  15. text-decoration: none;
  16. padding: 0.5em 1em 0.5em 1em;
  17. }
  18. .news_item
  19. {
  20. background: #FFFFFF;
  21. width: 720px;
  22. padding: 1em;
  23. margin-top: 2em;
  24. margin-bottom: 2em;
  25. border: 1px solid #E0E0E0;
  26. text-align: left;
  27. }
  28. .news_item_contents
  29. {
  30. color: #444;
  31. line-height: 1.5em;
  32. }
  33. .news_item_date
  34. {
  35. margin-bottom: 2em;
  36. color: #aaa;
  37. }
  38. body
  39. {
  40. background: #FAFAFA;
  41. }
  42. code, pre
  43. {
  44. font-family: monospace, serif;
  45. font-size: 1em;
  46. color: #7f0a0c;
  47. }
  48. figure
  49. {
  50. margin: 0px;
  51. padding: 0px;
  52. }
  53. img
  54. {
  55. width: 720px;
  56. }
  57. html
  58. {
  59. font-family: sans-serif;
  60. }
  61. a
  62. {
  63. color: #3A91CB;
  64. text-decoration: none;
  65. }
  66. #lang
  67. {
  68. float: right;
  69. }
  70. figcaption
  71. {
  72. color: #aaa;
  73. }
  74. table
  75. {
  76. border-collapse: collapse;
  77. }
  78. table, th, td
  79. {
  80. border: 1px solid #aaa;
  81. padding: 0.5em;
  82. margin-top: 0.5em;
  83. margin-bottom: 0.5em;
  84. }
  85. </style>
  86. </head>
  87. <body>
  88. <center>
  89. <div id="header">
  90. <a href="../../en/news/index.html">News</a>
  91. <a href="../../en/page/games.html">Games</a>
  92. <a href="../../en/page/about.html">About</a>
  93. <div id="lang">
  94. <a href="osg-sample.html">EN</a>
  95. <a href="../../ru/news/osg-sample.html">RU</a>
  96. </div>
  97. </div>
  98. <h1>In the news</h1>
  99. <div class="news_item">
  100. <h2 class="news_item_title">
  101. <a href="osg-sample.html">OpenSceneGraph sample</a>
  102. </h2>
  103. <p class="news_item_date">
  104. 2017-05-12 00:00
  105. </p>
  106. <div class="news_item_contents">
  107. <figure>
  108. <img src="../../images/2017-05_osg-sample.png" alt="Rocket in the distance" /><figcaption>Rocket in the distance</figcaption>
  109. </figure>
  110. <p>This article describes creation of the tutorials for building sample OpenSceneGraph application under Linux, macOS, Windows, and Android in April 2017.</p>
  111. <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>
  112. <p>The application is very basic and has the following features:</p>
  113. <ol type="1">
  114. <li>Render window creation</li>
  115. <li>Model loading</li>
  116. <li>Model rendering with simple GLSL shaders</li>
  117. <li>Model motion with a mouse under Linux, macOS, Windows and a finger under Android</li>
  118. </ol>
  119. <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>
  120. <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>
  121. <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>
  122. <p>Here’s a quick rundown of the files:</p>
  123. <ol type="1">
  124. <li>GLES2 surface</li>
  125. <li>Render activity to render to the surface</li>
  126. <li>Native library Java interface</li>
  127. <li>Native library C++ implementation</li>
  128. <li>CMake file to build native library</li>
  129. <li>Render activity layout</li>
  130. <li>Model to display</li>
  131. </ol>
  132. <p>Here’s a quick rundown of the project changes:</p>
  133. <ol type="1">
  134. <li>Update Android manifest to use GLES2 and render activity</li>
  135. <li>Reference native library’s CMake file in the project’s CMake file</li>
  136. </ol>
  137. <p>OpenSceneGraph documentation suggests building OpenSceneGraph outside Android Studio with CMake. However, this approach has the following limitations:</p>
  138. <ol type="1">
  139. <li>You have to build OpenSceneGraph for each target architecture</li>
  140. <li>You have to manually copy/reference built OpenSceneGraph libraries into Android Studio project</li>
  141. </ol>
  142. <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>
  143. <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>
  144. </div>
  145. </div>
  146. </center>
  147. </body>
  148. </html>