How to use OpenGLView on a BitmapData?

I’ve tried to play with HerokShaders in OpenFL 4.0 samples, the sample uses OpenGLView to create a view then add it as a child to stage, I tried to set scaleX and scaleY for view, but it didn’t get scaled…

The question is, how can I use OpenGLView on a BitmapData ?
Would I be able to use glow effects in alpha OpenGLView ? so that I can add the glow as a child on another sprite?

I’ve trying to achieve glow effect in HTML5, but could not so far, SpriteDOM and -Dcanvas are not an option due to poor performance.

I could use get the GL context in a bitmap as

public override function __renderGL (renderSession:RenderSession):Void {
GLBitmap.render (this, renderSession);
}

Is it possible to apply a shader over a particular bitmap? any example?

Check for the source for GLBitmap.render, you’ll see that we set a shader and upload a bitmap. If you do something custom, you would want the same, though you can use a custom filter shader to accomplish the same.

In order to get efficient glow in GL, you might need to use a framebuffer and make multiple passes. We don’t do this yet in the core renderer

I have a similar problem, Is there an example of how to use custom filter shaders anywhere?

I found a few which had @fragment var code = ‘shader code’; but they no longer appear to work with openfl?

Here’s an example of a custom shader:

https://github.com/openfl/openfl/blob/develop/openfl/filters/ColorMatrixFilter.hx#L113

You can just set shader.glFragmentSource and/or shader.glVertexSource, or (in the latest development builds) use a @:glFragmentSource or @:glVertexSource meta tag in a class that extends Shader

Then to set uniform data on a shader, use shader.data.nameOfYourVariable = [ value ]

It mimics this API:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Shader.html

(but uses glVertexSource and/or glFragmentSource rather than byteCode)

I tried to update GLBitmap.render to change color, as inspired by this answer:

Would you please check my updated GLBitmap.render here https://gist.github.com/hopewise/0b074d125f5b8317bfc1882865927740 line 50…54

I tried to just change the color, but didn’t work…

Thank you