In OpenFl, there are supposedly three HTML5 target render modes, HTML5 WebGL, Canvas and DOM. How do I specify which one when building to HTML5?
Do I specify it in the xml file for a project. If so, how?
I use Visual Studio Code to write the code and do the builds. In VSC the initial build is created with the VSC terminal command lime: test html5 which sets up the URL http://127.0.0.1:3000 and subsequent builds are created with lime: build html5. Do I specify the render mode using a VSC terminal command? If so, how?
Thanks in advance!
Try this (the “if” attribute is optional):
<haxedef name="canvas" if="html5" />
Where do I put that? And how does that affect the render mode?
It goes in your project.xml and it should trigger canvas render mode. “webgl” is the default, and “dom” can be used instead of “canvas”.
Hi. You can use -Dcanvas or -Ddom command line parameter to force these modes.
How can I tell after a build what render mode is actually used?
I’m using now Lime 7.8.0 and OpenFL 9.0.2 and my way of showing renderMode in a console is to trace the
stage.window.context.type; it seems like this is working also on latest versions (Lime 7.9.0+OpenFL 9.1.0) and I’m using also this property since 2018 with older versions of Lime+OpenFL.
If I remember correctly, OpenFL will switch to canvas rendering if the webgl isn’t available; and from what I know, you can only specify at the start of the app the rendering mode (I’m doing it in FlashDevelop - Project/Properties/Build tab and specify there
-Dcanvas in order to run on canvas instead of default