Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

2017-05-12_osg-sample.md 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. Title: OpenSceneGraph sample
  2. Date: 2017-05-12 00:00
  3. Category: News
  4. Slug: osg-sample
  5. Lang: en
  6. ![OSG sample][screenshot]
  7. This article describes creation of the tutorials for building sample OpenSceneGraph application under Linux, macOS, Windows, and Android in April 2017.
  8. Previous tutorials described how to install OpenSceneGraph under Linux, macOS, Windows and render a model using the standard **osgviewer** tool. This time we worked on a [sample OpenSceneGraph application](https://github.com/OGStudio/openscenegraph-cross-platform-guide-application) that would run under Linux, macOS, Windows, and Android.
  9. The application is very basic and has the following features:
  10. 0. Render window creation
  11. 0. Model loading
  12. 0. Model rendering with simple GLSL shaders
  13. 0. Model motion with a mouse under Linux, macOS, Windows and a finger under Android
  14. 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.
  15. Our [first successful Android build][oct16_article] last year included hacks and non-obvious steps to make OpenSceneGraph run under Android. This time we wanted a cleaner, faster, and cheaper approach.
  16. 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.
  17. Here's a quick rundown of the files:
  18. 0. GLES2 surface
  19. 0. Render activity to render to the surface
  20. 0. Native library Java interface
  21. 0. Native library C++ implementation
  22. 0. CMake file to build native library
  23. 0. Render activity layout
  24. 0. Model to display
  25. Here's a quick rundown of the project changes:
  26. 0. Update Android manifest to use GLES2 and render activity
  27. 0. Reference native library's CMake file in the project's CMake file
  28. OpenSceneGraph documentation suggests building OpenSceneGraph outside Android Studio with CMake. However, this approach has the following limitations:
  29. 0. You have to build OpenSceneGraph for each target architecture
  30. 0. You have to manually copy/reference built OpenSceneGraph libraries into Android Studio project
  31. 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.
  32. That's it for describing the creation of the tutorials for building sample OpenSceneGraph application under Linux, macOS, Windows, and Android in April 2017.
  33. [screenshot]: {attach}/images/2017-05_osg-sample.png
  34. [oct16_article]: {filename}/articles/2016-11-19_2016-october-recap.md