<!DOCTYPE html> <html> <meta charset="utf-8"> <head> <link rel="stylesheet" href="../../style.css"> </head> <body> <script data-goatcounter="https://services.opengamestudio.org:443/count" async src="//services.opengamestudio.org:443/count.js"></script> <div id="header"> <div> <strong id="title">Open Game Studio</strong> <div id="lang"> <a href="../../en/news/osg-sample.html">EN</a> <a href="../../ru/news/osg-sample.html">RU</a> </div> </div> <div class="header2"> <div class="menu"> <a href="../../en/news/index.html">News</a> <a href="../../en/game/index.html">Games</a> <a href="../../en/tool/index.html">Tools</a> <a href="../../en/page/about.html">About</a> </div> <a class="discord" href="https://t.me/Tail_and_shadow"> <img src="../../images/telegram.png"></img> </a> <div class="clear"></div> </div> </div> <h3 class="left_item_title">In the news...</h3> <center> <div class="news_item"> <h2 class="news_item_title"> <a href="osg-sample.html">OpenSceneGraph sample</a> </h2> <p class="news_item_date"> 2017-05-12 00:00 </p> <div class="news_item_contents"> <p><img src="../../images/2017-05_osg-sample.png" alt="Rocket in the distance" /></p> <p>This article describes creation of the tutorials for building sample OpenSceneGraph application under Linux, macOS, Windows, and Android in April 2017.</p> <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> <p>The application is very basic and has the following features:</p> <ol> <li>Render window creation</li> <li>Model loading</li> <li>Model rendering with simple GLSL shaders</li> <li>Model motion with a mouse under Linux, macOS, Windows and a finger under Android</li> </ol> <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> <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> <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> <p>Here's a quick rundown of the files:</p> <ol> <li>GLES2 surface</li> <li>Render activity to render to the surface</li> <li>Native library Java interface</li> <li>Native library C++ implementation</li> <li>CMake file to build native library</li> <li>Render activity layout</li> <li>Model to display</li> </ol> <p>Here's a quick rundown of the project changes:</p> <ol> <li>Update Android manifest to use GLES2 and render activity</li> <li>Reference native library's CMake file in the project's CMake file</li> </ol> <p>OpenSceneGraph documentation suggests building OpenSceneGraph outside Android Studio with CMake. However, this approach has the following limitations:</p> <ol> <li>You have to build OpenSceneGraph for each target architecture</li> <li>You have to manually copy/reference built OpenSceneGraph libraries into Android Studio project</li> </ol> <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> <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> </div> </div> <div id="disqus_thread"></div> <script> var disqus_config = function () { this.page.url = "https://opengamestudio.org/en/news/osg-sample.html"; this.page.identifier = "osg-sample.html"; }; (function() { // DON'T EDIT BELOW THIS LINE var d = document, s = d.createElement('script'); s.src = 'https://opengamestudio.disqus.com/embed.js'; s.setAttribute('data-timestamp', +new Date()); (d.head || d.body).appendChild(s); })(); </script> <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <div id="footer"> The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a> from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>. </div> </center> </body> </html>