• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Glow effect with GPU render

Contributor ,
Jan 06, 2014 Jan 06, 2014

Copy link to clipboard

Copied

Hi everyone,

I know that the glow effect can't be visible with GPU render on IOS/ANDROID devices.

But I heard that there was a way to appply a glow effect anyway. (I need the GPU render as my animations are smoother with it)

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 decided to replace it, in order to make it work with GPU render, 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....

Any idea why ?

Thank you very much,

Stephan

TOPICS
ActionScript

Views

679

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 06, 2014 Jan 06, 2014

Copy link to clipboard

Copied

LATEST

From what I see it's for the same reason the original code wouldn't work. You're applying a glow filter the same way. The only different thing you're doing is drawing a black 40x40 black circle, drawing it into a transparent BitmapData (which isn't big enough) while adding that circle as a Bitmap to the display list.

Are you working in 3D? Either way in general the way you can utilize the graphics class is to draw the object using built in Flash classes, then draw that object into a BitmapData (so draw "draggedItem" into a BitmapData with the glow applied) and then use the BitmapData (in a Bitmap like you did for example).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines