examples-and-dependencies.html 5.7KB

2 个月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <link rel="stylesheet" href="../../style.css">
  6. </head>
  7. <body>
  8. <script data-goatcounter="https://services.opengamestudio.org:443/count" async src="//services.opengamestudio.org:443/count.js"></script>
  9. <div id="header">
  10. <div class="header2">
  11. <div class="menu">
  12. <a href="../../en/news/index.html">News</a>
  13. <a href="../../en/game/index.html">Games</a>
  14. <a href="../../en/tool/index.html">Tools</a>
  15. <a href="../../en/page/about.html">About</a>
  16. </div>
  17. <div id="lang">
  18. <a href="../../en/news/examples-and-dependencies.html">EN</a>
  19. <a href="../../ru/news/examples-and-dependencies.html">RU</a>
  20. </div>
  21. <div class="clear"></div>
  22. </div>
  23. </div>
  24. <h3 class="left_item_title">In the news...</h3>
  25. <center>
  26. <div class="news_item">
  27. <h2 class="news_item_title">
  28. <a href="examples-and-dependencies.html">Examples and dependencies</a>
  29. </h2>
  30. <p class="news_item_date">
  31. 2018-08-21 00:00
  32. </p>
  33. <div class="news_item_contents">
  34. <p><img src="../../images/2018-08-21-examples-and-dependencies.png" alt="Cloud" /></p>
  35. <p>This article describes two new OpenSceneGraph cross-platform examples and the change in handling dependencies.</p>
  36. <p><strong>Examples of HTTP client and node selection</strong></p>
  37. <p>Once we finished working on <a href="https://github.com/OGStudio/openscenegraph-cross-platform-examples/tree/master/04.RemoteDebugging">the remote debugging example</a> and <a href="example-driven-development.html">reported its completion</a>, 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.</p>
  38. <p>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.</p>
  39. <p>The need to support HTTPS on each platform spurred us to create <a href="https://github.com/OGStudio/openscenegraph-cross-platform-examples/tree/master/03.HTTPClient">HTTP client example</a>. Turned out, each platform had its own preferred way of doing secure HTTP:</p>
  40. <ul>
  41. <li>web (Emscripten) provides Fetch API</li>
  42. <li>desktop is fine with Mongoose and OpenSSL</li>
  43. <li>Android provides HttpUrlConnection in Java</li>
  44. <li>iOS provides NSURLSession in Objective-C</li>
  45. </ul>
  46. <p>The need to support different languages on different platforms resulted in the creation of so-called 'host-guest' pattern:</p>
  47. <ul>
  48. <li>guest (platform agnostic)<ul>
  49. <li>provides networking representation</li>
  50. <li>used by cross-platform C++ code</li></ul></li>
  51. <li>host (specific platform)<ul>
  52. <li>polls guest for pending requests</li>
  53. <li>processes them</li>
  54. <li>reports results back to the guest</li></ul></li>
  55. </ul>
  56. <p><a href="https://github.com/OGStudio/openscenegraph-cross-platform-examples/tree/master/05.NodeSelection">Node selection example</a> was straightforward and caused no troubles.</p>
  57. <p><strong>The change in handling dependencies</strong></p>
  58. <p>For over a year we had to deal with the following <a href="http://forum.openscenegraph.org/viewtopic.php?t=17443">shortcomings</a> when building OpenSceneGraph across platforms using conventional methods:</p>
  59. <ul>
  60. <li>macOS builds failing due to certain compile flags we use</li>
  61. <li>hacking PNG plugin safety guards to have PNG support under Android</li>
  62. <li>iOS simulator and device builds of the same example being in separate Xcode projects</li>
  63. <li>OpenSceneGraph taking 20-30 minutes to build</li>
  64. </ul>
  65. <p>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.</p>
  66. <p>With these obstacles out of the way, we can now iterate faster. Just in time for the next technical demonstration of Mahjong 2!</p>
  67. <p>That's it for describing two new OpenSceneGraph cross-platform examples and the change in handling dependencies.</p>
  68. </div>
  69. </div>
  70. <div id="disqus_thread"></div>
  71. <script>
  72. var disqus_config = function () {
  73. this.page.url = "https://opengamestudio.org/en/news/examples-and-dependencies.html";
  74. this.page.identifier = "examples-and-dependencies.html";
  75. };
  76. (function() { // DON'T EDIT BELOW THIS LINE
  77. var d = document, s = d.createElement('script');
  78. s.src = 'https://opengamestudio.disqus.com/embed.js';
  79. s.setAttribute('data-timestamp', +new Date());
  80. (d.head || d.body).appendChild(s);
  81. })();
  82. </script>
  83. <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  84. <div id="footer">
  85. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  86. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  87. </div>
  88. </center>
  89. </body>
  90. </html>