Starling HTML5 not loading textures

Ahoy!

I’m trying to port a small prototype I made on Starling/ActionScript for the Ludum Dare 30 (loooong time ago :wink: ). I get the code converted by using the fantastic as3hx library. I’m using OpenFL and Starling Haxe port. It’s running pretty well when exported to Flash.

However, I just hit a wall when trying to export it to HTML5. The gray background is showing but the area where textures are supposed to be displayed is just a black rectangle.

I tried to set <haxedef name="webgl" if="html5" /> on project.xml file with no luck. I also set <haxedef name="canvas" /> but then just the gray background is displayed, no black rectangle, no textures.

By checking the browser’s console, I got a bunch of WebGL warnings when exporting it as webgl.

[Warning] WebGL: INVALID_OPERATION: texImage2D: ArrayBufferView not big enough for request 
[Warning] WebGL: drawElements: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete', or it is a float/half-float type with linear filtering and without the relevant float/half-float linear extension enabled. (ludumdare30.js, line 29564)

Any help would be appreciated!

P.S. Libraries I’m using right now:

actuate: [1.8.7]
as3hx: [1.0.3]
box2d: [1.2.3]
HaxePunk: [2.5.6]
hxcpp: 3.2.193 [3.3.49]
layout: [1.2.1]
lime-samples: [2.6.0]
lime: 2.7.0 [3.3.0]
nape: 2.0.19 [2.0.20]
openfl-ouya: [1.0.2]
openfl-samples: [4.0.0]
openfl: 3.4.0 [4.3.1]
starling: 0.3.8 0.4.0 0.5.7 [1.8.0]
swf: [2.3.0]

Hi!

I think this has to do with mipmapping, I will look into this further, but the following appears to fix a basic Texture

1 Like

Why should do those lines generate all mipmap level automatically?
Solution like that (switching with #if) would cause incompatibility because Flash Stage3D doesn’t support automatically generating mip maps, I guess. There is no Stage3D equivalent for “glGenerateMipmap”.

I think you have to upload them manually to correctly render textures with mip maps.

http://www.adobe.com/devnet/flashplayer/articles/mipmapping.html

I actually fixed mipmapping yesterday

This is better than disabling in Starling :slight_smile: (I removed the commit from Starling afterward too)

1 Like

Sorry for the late response. Thank you Joshua for the bug fixing :+1:, I really appreciate it! The prototype is now working really well on HTML5. I just cloned the openfl, lime and starling repos and set those as my current libraries with haxelib dev command.

1 Like