Files
ogs-site/en/news/osg-sample.html

148 lines
5.8 KiB
HTML

<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<style>
#header
{
background: #2BA6E3;
padding: 0.7em;
text-align: left;
}
#header a
{
color: white;
text-decoration: none;
padding: 0.5em 1em 0.5em 1em;
}
#lang
{
float: right;
}
.news_item
{
background: #FFFFFF;
width: 720px;
padding: 1em;
margin-top: 2em;
margin-bottom: 2em;
border: 1px solid #E0E0E0;
text-align: left;
}
.news_item_contents
{
color: #444;
line-height: 1.5em;
}
.news_item_date
{
margin-bottom: 2em;
color: #aaa;
}
html
{
font-family: sans-serif;
}
body
{
background: #FAFAFA;
}
code, pre
{
font-family: monospace, serif;
font-size: 1em;
color: #7f0a0c;
}
img
{
width: 720px;
}
a
{
color: #3A91CB;
}
table
{
border-collapse: collapse;
}
table, th, td
{
border: 1px solid #aaa;
padding: 0.5em;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
</style>
</head>
<body>
<div id="header">
<strong id="title">Open Game Studio</strong>
<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 id="lang">
<a href="../../en/news/osg-sample.html">EN</a>
<a href="../../ru/news/osg-sample.html">RU</a>
</div>
</div>
<center>
<h1>In the news...</h1>
<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="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>.
The site is hosted by <a href="https://pages.github.com">GitHub Pages</a>.
</div>
</center>
</body>
</html>