Hardware accelerated blending and render to texture in openfl?

I saw a cool but fake 2d lighting which looks great, can be achieved with minimal effort. Its also very performance friendly, as the author stated. The full post is here,


Achieved result:

What is actually done here is:

  • First you draw your game scene as usual.
  • Then you draw all your lights onto a framebuffer or an intermediate texture with additive blending.
  • Then draw the framebuffer or the intermediate texture over the scene with multiply blending.

Its as simple as that, and one can draw all their lights with just single draw call.

So my questions are,

  1. Does openfl supports hardware accelerated blending modes? Someone on haxeflixel forum said that openfl-legacy uses software blending which is slow.
  2. Does openfl supports hardware accelerated render to texture? I noticed bitmapdata.draw(…) but is it hardware accelerated or is it fast like writing to framebuffer, mentioned in the blog post?

Thank you!


I believe add and multiply blending should work in the new code with hardware, worth trying out?

I will check blend, but is there any way to switch to openfl-legacy (or the one with software blending) during build so that I can know how the performance is with or without hardware accelerated blending.

But what about render to texture or bitmapdata.draw? Is that hardware accelerated?

bitmapdata.draw was using a framebuffer, but this had issues on lower-end graphics cards (like integrated Intel cards) as well as lower performance than just using software. Cairo does support blending modes, we’ll just need to use them in the renderer