appMobiSam's Forum Posts

  • 1 posts
  • Hi Guys - this is Sam at appMobi jumping into the discussion a little late.

    IMPLEMENTING DIRECTCANVAS

    For earlier readers of this thread - implementation details for directCanvas can be found here:

    appmobi.com/documentation/index.html

    We'll follow-up with new/better versions of the implementation guides as we get get feedback and experience through more engine integrations.

    Ashley I'm playing around with converting your engine in my spare cycles (though I don't get too many of those unfortunately - so it's not going to be the quickest process).

    To answer your question "why have two contexts?" - the answer is simply that there would be no performance gain. The primary problem is the DOM and re-flow render code of the browser. The Canvas element is still a DOM element and so moving any other element causes a recalculation of the Canvas and it's contained elements. The secondary problem is that to extend the capabilities of the webview you need to have a JavaScript to Native bridge of some sort. On iOS that bridge is essentially a string parser on the native side that reads in javascript strings that are passed to it. Frequent drawing calls would therefore have an offsetting negative impact to rendering outside the DOM.

    We have the syntax in place to invoke methods in one context from the other - so could you do something similar today to what you do with WebGL? There answer is yes, but there is the previously mentioned string parsing hit when crossing from the DOM to the directCanvas execution context.

    With regard to implementation - my (very) cursory understanding of your code leads me to believe that the conversion to use directCanvas would be relatively straight forward. What I'm playing with is moving everything to the directCanvas context. It doesn't look like you use the DOM extensively so this might not be too bad - but, like I said, I'm just getting into looking at it seriously. For compatibility with standard/desktop browsers we have a directCanvas javascript shim that will transparently work when the dicrectCanvas acceleration is not available.

    Anyway, once I look more closely (say next week or so) - let's have a quick chat to sync-up.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 1 posts