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
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 ]