openfl / starling

Known as the "Cross-Platform Game Engine", Starling is a popular Stage3D framework for OpenFL and Haxe
Other
236 stars 67 forks source link

Target HTML5 + shareContext #82

Closed railnation closed 6 years ago

railnation commented 6 years ago

Hi,

I have an issue. I use Away3D with shareContext = true and I have two Starling Layers. The first layer for our UI System and the second layer for the map.

If I initialize the second layer the context will be restored, but the UI layer does not render anything. I use tex.onRestore function.

Any help is appreciated.

Best

peteshand commented 6 years ago

Are there any runtime errors? Is the tex.onRestore functions being fired on the UI layer?

railnation commented 6 years ago

Yes , tex.onRestore is fired. I got it working. But I have some more questions.

  1. I have an issue embedding Fonts. I use the Assets Class for font usage, but it appears that the font is not used.

  2. Why is the performance so bad. I just get only 1 FPS in debugging mode.

  3. Why is a texture for e.g. 512 * 1024 not allowed?

  4. Any tip to reduce texture filesize, because LZM - R compression is not allowed.

peteshand commented 6 years ago

What version of Starling are you using? Is it from Github or Haxelib?

The performance issue is mostly likely caused by WebGLs get error function: Try setting GLUtils.debug = false;

https://github.com/openfl/openfl/blob/develop/src/openfl/_internal/stage3D/GLUtils.hx

railnation commented 6 years ago

I use Starling version 2.1.1. It is from Github.

railnation commented 6 years ago

How can I set this <haxedef name="mobile"/> to false? I have also <haxedef name="desktop" if="html5"/>

jgranick commented 6 years ago

Defining mobile and desktop should be done automatically by the Lime compiler tools, I do not believe that either is defined for HTML5 by default, as it really could be either.