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.

osg-sample.html 5.9KB

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