Now speaking of GLSL and shaders, I think @ibilon 's library https://github.com/ibilon/BitmapDataShaders is a very useful tool. It uploads the bitmap to the shader, renders it and get the image back using GL.readPixels().
In order to pass stuff to shaders (a number or an image etc) one of the ways is to use uniform.
“imageUniform = GL.getUniformLocation (program, “uImage0”);” returns a location in the GPU to store your uniform, named “uImage0”,
“GL.texImage2D” with some other functions use your bitmap’s pixel data to create a texture which is bound to location 0, and finally
"GL.uniform1i (imageUniform, 0);" uploads number 0(the location where you have ur texture stored) to the uniform location where you got earlier.
Once these are set up, inside your fragment shader (basically pixel shader) you will need
"uniform sampler2D uImage0;" which tells the shader “I am gonna be using uImage0 that I just uploaded”, put another way, creating a variable with name uImage0 and with the value I just uploaded. Then inside the shader main function you use texture2D (uImage0, [the coordinate I want to get color from]) to get the pixel color(vec4 storing RGBA) from the image using a vec2(XY) coordinate.
I hope this will help you understand GLSL better by a little bit. And for the FXAA shader that you’ve found ( https://dl.dropboxusercontent.com/u/11542084/FXAA ), it seems that it has 2 more uniform values needed which is the width and height of the texture. ibilon’s library gives a way to upload uniform stuffs, which is in his example Main.hx
var c1_bitmap = new Bitmap (ShaderCompositing.compositePerLayerParams (c1, shader, [[{name: "param", value: [0.2, 0.5, 0.2], type: Float3}],[{name: "param", value: [0.2, 0.2, 0.2], type: Float3}],[{name: "param", value: [0.5, 0.5, 0.2], type: Float3}]]));
var c2_bitmap = new Bitmap (ShaderCompositing.compositeParams (c2, shader, [{name: "param", value: [0.2, 0.5, 0.2], type: Float3}]));
And you will need to upload 2 floats with name “bgl_RenderedTextureWidth” and “bgl_RenderedTextureHeight”, value equal to the width and height of the texture, and type being Float. Something like this:
var bitmap = new Bitmap (ShaderCompositing.compositeParams(c1, shader, [{name: "bgl_RenderedTextureWidth", value: myBitmapdata.width, type: Float},{name: "bgl_RenderedTextureHeight", value: myBitmapdata.height, type: Float}]));
And I am pretty sure you can achieve what you wanted with just a little bit more arrangement and stuff. It seems that if you only uploaded 1 image, you can name it whatever you want inside the shader so you dont need to mess with “uniform sampler2D bgl_RenderedTexture;”, but if something is wrong you can just ctrl+Find all “bgl_RenderedTexture” in your FXAA shader and change it to “uImage0”.
Hope this helps and good luck with shaders!