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.

2018-08-21-examples-and-dependencies.md 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Title: Examples and dependencies
  2. Date: 2018-08-21 00:00
  3. Category: News
  4. Slug: examples-and-dependencies
  5. Lang: en
  6. ![Cloud][screenshot]
  7. This article describes two new OpenSceneGraph cross-platform examples and the change in handling dependencies.
  8. **Examples of HTTP client and node selection**
  9. Once we finished working on [the remote debugging example][osgcpe-04] and [reported its completion][article-2018-june], we were surprised by the fact that secure HTTP connection between a debugged application and debug broker was only working in the web version of the example. Desktop and mobile versions only worked with insecure HTTP.
  10. Since current debug scheme has no authentication, insecure debugging over HTTP doesn't really hurt. However, if we want to access resources located at popular sites like GitHub and BitBucket, we have to support secure HTTP.
  11. The need to support HTTPS on each platform spurred us to create [HTTP client example][osgcpe-03]. Turned out, each platform had its own preferred way of doing secure HTTP:
  12. * web (Emscripten) provides Fetch API
  13. * desktop is fine with Mongoose and OpenSSL
  14. * Android provides HttpUrlConnection in Java
  15. * iOS provides NSURLSession in Objective-C
  16. The need to support different languages on different platforms resulted in the creation of so-called 'host-guest' pattern:
  17. * guest (platform agnostic)
  18. * provides networking representation
  19. * used by cross-platform C++ code
  20. * host (specific platform)
  21. * polls guest for pending requests
  22. * processes them
  23. * reports results back to the guest
  24. [Node selection example][osgcpe-05] was straightforward and caused no troubles.
  25. **The change in handling dependencies**
  26. For over a year we had to deal with the following [shortcomings][osg-shortcomings] when building OpenSceneGraph across platforms using conventional methods:
  27. * macOS builds failing due to certain compile flags we use
  28. * hacking PNG plugin safety guards to have PNG support under Android
  29. * iOS simulator and device builds of the same example being in separate Xcode projects
  30. * OpenSceneGraph taking 20-30 minutes to build
  31. These shortcomings were slowing us down and complicating the development of new examples. Upon hitting these problems ten more times this month we decided it was time to solve them once and for all. Now OpenSceneGraph is built as part of each example in 2-3 minutes, and there's no more dependency magic involved. We took the same approach of building dependencies as part of each example to other external libraries like Mongoose and libpng-android, too.
  32. With these obstacles out of the way, we can now iterate faster. Just in time for the next technical demonstration of Mahjong 2!
  33. That's it for describing two new OpenSceneGraph cross-platform examples and the change in handling dependencies.
  34. [screenshot]: ../../images/2018-08-21-examples-and-dependencies.png
  35. [article-2018-june]: example-driven-development.html
  36. [osgcpe-03]: https://github.com/OGStudio/openscenegraph-cross-platform-examples/tree/master/03.HTTPClient
  37. [osgcpe-04]: https://github.com/OGStudio/openscenegraph-cross-platform-examples/tree/master/04.RemoteDebugging
  38. [osgcpe-05]: https://github.com/OGStudio/openscenegraph-cross-platform-examples/tree/master/05.NodeSelection
  39. [osg-shortcomings]: http://forum.openscenegraph.org/viewtopic.php?t=17443