Drawed Lines Uses Too Much Cpu - Neko

I am drawing them with Sprite.graphics.lineTo(x,y)

Flash export

How often do you draw them? Just to be sure – if repeatedly, are you using graphics.clear() before every frame redraw? Nonetheless, please post a code example or more information about what you are trying to do.

Just 1 time i drawing them. But there is no change if i do it at every frame. There is no problem with flash.

Well, there could be too many line segments for this API to handle properly, although it doesn’t seem to be all that much. You can check with graphics.readGraphicsData().length, whether the number isn’t too high.

How does it perform in HTML5?


On native platforms, sprite.graphics is implemented using Cairo. I believe libcairo is what inspired the canvas API on HTML5, and was used originally by Mozilla and Webkit browsers.

Flash Player has a different implementation that is heavily optimized for fast performance of the vector API.

The fast implementation on OpenFL would probably be to draw a line to a BitmapData, then use the Tilemap API to batch render.

Targeting C++ may be faster than Neko as well

Could i easily port my sprite.graphics codes for tilemap api? I never used it, i dont know how to, thanks.

Try this

openfl create BunnyMark
cd BunnyMark
openfl test neko

That’s using the Tilemap API, you won’t want a bunny, but instead you could draw a single line to a bitmap, and duplicate it similar to that sample. Each tile object supports x, y, rotation, etc, so you would add a tile per each line you need to draw, and scale accordingly