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.

156 line
6.3KB

  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <style>
  6. #header
  7. {
  8. background: #2BA6E3;
  9. padding: 0.7em;
  10. text-align: left;
  11. }
  12. #header a
  13. {
  14. color: white;
  15. text-decoration: none;
  16. padding: 0.5em 1em 0.5em 1em;
  17. }
  18. .news_item
  19. {
  20. background: #FFFFFF;
  21. width: 720px;
  22. padding: 1em;
  23. margin-top: 2em;
  24. margin-bottom: 2em;
  25. border: 1px solid #E0E0E0;
  26. text-align: left;
  27. }
  28. .news_item_contents
  29. {
  30. color: #444;
  31. line-height: 1.5em;
  32. }
  33. .news_item_date
  34. {
  35. margin-bottom: 2em;
  36. color: #aaa;
  37. }
  38. body
  39. {
  40. background: #FAFAFA;
  41. }
  42. code, pre
  43. {
  44. font-family: monospace, serif;
  45. font-size: 1em;
  46. color: #7f0a0c;
  47. }
  48. figure
  49. {
  50. margin: 0px;
  51. padding: 0px;
  52. }
  53. img
  54. {
  55. width: 720px;
  56. }
  57. html
  58. {
  59. font-family: sans-serif;
  60. }
  61. a
  62. {
  63. color: #3A91CB;
  64. text-decoration: none;
  65. }
  66. #lang
  67. {
  68. float: right;
  69. }
  70. figcaption
  71. {
  72. color: #aaa;
  73. }
  74. table
  75. {
  76. border-collapse: collapse;
  77. }
  78. table, th, td
  79. {
  80. border: 1px solid #aaa;
  81. padding: 0.5em;
  82. margin-top: 0.5em;
  83. margin-bottom: 0.5em;
  84. }
  85. </style>
  86. </head>
  87. <body>
  88. <center>
  89. <div id="header">
  90. <a href="../../en/news/index.html">News</a>
  91. <a href="../../en/page/games.html">Games</a>
  92. <a href="../../en/page/about.html">About</a>
  93. <div id="lang">
  94. <a href="examples-and-dependencies.html">EN</a>
  95. <a href="../../ru/news/examples-and-dependencies.html">RU</a>
  96. </div>
  97. </div>
  98. <h1>In the news</h1>
  99. <div class="news_item">
  100. <h2 class="news_item_title">
  101. <a href="examples-and-dependencies.html">Examples and dependencies</a>
  102. </h2>
  103. <p class="news_item_date">
  104. 2018-08-21 00:00
  105. </p>
  106. <div class="news_item_contents">
  107. <figure>
  108. <img src="../../images/2018-08-21-examples-and-dependencies.png" alt="Cloud" /><figcaption>Cloud</figcaption>
  109. </figure>
  110. <p>This article describes two new OpenSceneGraph cross-platform examples and the change in handling dependencies.</p>
  111. <p><strong>Examples of HTTP client and node selection</strong></p>
  112. <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>
  113. <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>
  114. <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>
  115. <ul>
  116. <li>web (Emscripten) provides Fetch API</li>
  117. <li>desktop is fine with Mongoose and OpenSSL</li>
  118. <li>Android provides HttpUrlConnection in Java</li>
  119. <li>iOS provides NSURLSession in Objective-C</li>
  120. </ul>
  121. <p>The need to support different languages on different platforms resulted in the creation of so-called ‘host-guest’ pattern:</p>
  122. <ul>
  123. <li>guest (platform agnostic)
  124. <ul>
  125. <li>provides networking representation</li>
  126. <li>used by cross-platform C++ code</li>
  127. </ul></li>
  128. <li>host (specific platform)
  129. <ul>
  130. <li>polls guest for pending requests</li>
  131. <li>processes them</li>
  132. <li>reports results back to the guest</li>
  133. </ul></li>
  134. </ul>
  135. <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>
  136. <p><strong>The change in handling dependencies</strong></p>
  137. <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>
  138. <ul>
  139. <li>macOS builds failing due to certain compile flags we use</li>
  140. <li>hacking PNG plugin safety guards to have PNG support under Android</li>
  141. <li>iOS simulator and device builds of the same example being in separate Xcode projects</li>
  142. <li>OpenSceneGraph taking 20-30 minutes to build</li>
  143. </ul>
  144. <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>
  145. <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>
  146. <p>That’s it for describing two new OpenSceneGraph cross-platform examples and the change in handling dependencies.</p>
  147. </div>
  148. </div>
  149. </center>
  150. </body>
  151. </html>