0

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.

Stu
  • 1,282
  • 12
  • 29

2 Answers2

0

It's because the toolkit requires you to load an image before running. The flow in Flash is different because it doesn't assume you'll be using an image as the source. I'm fairly sure you'll need to set inputSize's width/height before running a ShaderJob on a source image.

NHubben
  • 246
  • 1
  • 5
  • I'm using the filter on a DisplayObject, so the source image IS assumed to be there and that input is pre-set by Flash. The only way I could get the width and height to work is to set it from a DisplayObject.getBounds() call. – Stu Jun 22 '11 at 06:31
0

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.

Stu
  • 1,282
  • 12
  • 29