I'm making a game in AS3 with Adobe Flash Pro CC.
I've made a mobile version for Android but if I put GPU in render mode, my blurred effet or my glow effect doesn't work on the device.
If I put CPU or direct the blurred and glow effects are working but animations are not smooth. (with GPU render, everything is extra smooth !)
Do you know how I can have my blurred effect and my glow effect with GPU render mode ?
Thank you very much,
Stephan
Here's what I did (but it still doesn't work on an actual Android device) :
My code was :
private function itemGlow(isGlowing:Boolean):void{
if (isGlowing){
var glow:GlowFilter = new GlowFilter();
glow.color = 0xFFFF00;
glow.alpha = .75;
glow.blurX = 10;
glow.blurY = 10;
glow.quality = BitmapFilterQuality.MEDIUM;
draggedItem.filters = [glow];
} else {
draggedItem.filters = null;
}
And I replace it with this code :
public function itemGlow(isGlowing:Boolean):void{
if (isGlowing){
var glow:Sprite = new Sprite();
glow.graphics.beginFill(0); // black color
glow.graphics.drawCircle(20, 20, 20);
glow.graphics.endFill();
draggedItem.filters = [new GlowFilter(0xFFFF00, 1)];
var bd:BitmapData = new BitmapData(50, 50, true, 0x00000000);
bd.draw(glow);
var glowbit:Bitmap = new Bitmap(bd);
addChild(glowbit);
} else {
draggedItem.filters = null;
}
No errors, glow visible on the simulation device. But when it's not working on real Android device....
Vector effects and blending modes won't work in GPU mode. If you want to get a glowEffect you will have to calculate it in memory but display a bitmap that has the effect.
Here is a minimalist example:
As you will see you can now work with filters and blend modes! If you want an animation, just create an array of bitmapData objects and in the bitmap object change the bitmapData property on each frame.
From Adobe:
Source