flashactionscript-3pixel-bender

Is there a trick to get Pixel Bender shader 'inputSize' parameter working in Flash?


Here's a snippet of a pixel bender shader that I'm using in Flash:

parameter float2 srcSize
<
    parameterType: "inputSize";
    inputSizeName: "src";
>;

input image4 src;

The width and height of the source image are filled in correctly in the Pixel Bender Toolkit, but when I run this shader as a filter in Flash Player 10, the srcSize value is not automatically filled in.


Solution

  • Apparently it's not possible to have flash populate the source image width and height, you have to do it yourself by calling:

    var rect:Rectangle = dispObj.getBounds(dispObj);
    

    ...and then pass rect.width and rect.height into the shader parameters.