25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
6.7KB

  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/projects.html" class="menu-button secondary">Projects</a>
  27. <a href="/pages/about.html" class="menu-button secondary">About</a>
  28. </div>
  29. </div>
  30. </nav>
  31. <!-- End Nav -->
  32. <!-- Main Page Content and Sidebar -->
  33. <div class="row">
  34. <!-- Main Blog Content -->
  35. <div class="large-9 columns">
  36. <article>
  37. <header>
  38. <h3 class="article-title"><a href="http://opengamestudio.org/osg-sample.html" rel="bookmark"
  39. title="Permalink to OpenSceneGraph sample">OpenSceneGraph sample</a></h3>
  40. </header>
  41. <h6 class="subheader" title="2017-05-12T00:00:00+03:00">Пт 12 Май 2017
  42. <a class="button secondary small translation-button" href="http://opengamestudio.org/osg-sample-ru.html">ru</a>
  43. </h6> <p><img alt="OSG sample" src="http://opengamestudio.org/2017-05_osg-sample.png" /></p>
  44. <p>This article describes creation of the tutorials for building sample OpenSceneGraph application under Linux, macOS, Windows, and Android in April 2017.</p>
  45. <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>
  46. <p>The application is very basic and has the following features:</p>
  47. <ol>
  48. <li>Render window creation</li>
  49. <li>Model loading</li>
  50. <li>Model rendering with simple GLSL shaders</li>
  51. <li>Model motion with a mouse under Linux, macOS, Windows and a finger under Android</li>
  52. </ol>
  53. <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>
  54. <p>Our <a href="http://www.opengame.epizy.com/lang/en/news/2414">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>
  55. <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>
  56. <p>Here's a quick rundown of the files:</p>
  57. <ol>
  58. <li>GLES2 surface</li>
  59. <li>Render activity to render to the surface</li>
  60. <li>Native library Java interface</li>
  61. <li>Native library C++ implementation</li>
  62. <li>CMake file to build native library</li>
  63. <li>Render activity layout</li>
  64. <li>Model to display</li>
  65. </ol>
  66. <p>Here's a quick rundown of the project changes:</p>
  67. <ol>
  68. <li>Update Android manifest to use GLES2 and render activity</li>
  69. <li>Reference native library's CMake file in the project's CMake file</li>
  70. </ol>
  71. <p>OpenSceneGraph documentation suggests building OpenSceneGraph outside Android Studio with CMake. However, this approach has the following limitations:</p>
  72. <ol>
  73. <li>You have to build OpenSceneGraph for each target architecture</li>
  74. <li>You have to manually copy/reference built OpenSceneGraph libraries into Android Studio project</li>
  75. </ol>
  76. <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>
  77. <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>
  78. <p class="subheader">Category: <a href="http://opengamestudio.org/category/news.html">News</a>
  79. </p>
  80. </article>
  81. </div>
  82. <!-- End Main Content -->
  83. <!-- Sidebar -->
  84. <aside class="large-3 columns">
  85. <!--k
  86. <h5 class="sidebar-title">Site</h5>
  87. <ul class="side-nav">
  88. <li><a href="http://opengamestudio.org/archives.html">Archives</a>
  89. <li><a href="http://opengamestudio.org/tags.html">Tags</a>
  90. <li><a href="http://opengamestudio.org/feeds/all.atom.xml" rel="alternate">Atom feed</a></li>
  91. </ul>
  92. <h5 class="sidebar-title">Categories</h5>
  93. <ul class="side-nav">
  94. <li><a href="http://opengamestudio.org/category/news.html">News</a></li>
  95. </ul>
  96. -->
  97. <h5 class="sidebar-title">Ads</h5>
  98. <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  99. <!-- ogs2 -->
  100. <ins class="adsbygoogle"
  101. style="display:block"
  102. data-ad-client="ca-pub-4473792248813084"
  103. data-ad-slot="9024247127"
  104. data-ad-format="auto"></ins>
  105. <script>
  106. (adsbygoogle = window.adsbygoogle || []).push({});
  107. </script>
  108. </aside> <!-- End Sidebar -->
  109. </div> <!-- End Main Content and Sidebar -->
  110. <!-- Footer -->
  111. <footer class="row">
  112. <div class="large-12 columns">
  113. <hr />
  114. <div class="row">
  115. <div class="large-7 columns">
  116. <p>Proudly powered by <a href="http://getpelican.com">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.</p>
  117. </div>
  118. </div>
  119. </div>
  120. <script type="text/javascript">
  121. var _gaq = _gaq || [];
  122. _gaq.push(['_setAccount', 'UA-3773114-1']);
  123. _gaq.push(['_trackPageview']);
  124. (function() {
  125. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  126. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  127. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  128. })();
  129. </script>
  130. </footer>