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

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