flambe icon indicating copy to clipboard operation
flambe copied to clipboard

WARN flambe: Failed to create texture. Is the GPU context unavailable?

Open sonygod opened this issue 12 years ago • 2 comments

when my assets folder is empty,it's will be flambe get error here is test code.

private static function onSuccess(pack:AssetPack) {
         var texture:Texture= System.createTexture(100, 100);
  texture.graphics.fillRect(0xff00ff, 0, 0, 100, 100);

}

sonygod avatar Jul 22 '13 02:07 sonygod

Yeah, unfortunately creating a Stage3D context is asynchronous. So it's possible for it not to be ready yet by the time you call createTexture(), which is especially likely with an empty asset pack that loads immediately.

You can try watching System.hasGPU, and wait for it to become true. Or wait a frame.

Maybe we want System.init() to take a callback that gets called when everything's fully initialized. That's a little annoying but it may be the best solution.

aduros avatar Jul 22 '13 03:07 aduros

I'm getting this issue and the asset folder isn't empty. The context also never becomes available even as I check it every 100 ms with a haxe timer. The target platform is flash, though, and this error just materialized without changing any of the code after picking it up several months and several flambe updates later. Hmm. It seems to happen mainly in Firefox, not Chrome, and in flash, not html5.

SavedByZero avatar Nov 07 '14 15:11 SavedByZero