flashstage3dagal

Cannot upload vector to fragment shader in Stage3D


I am trying to upload a vector to the shader but it's not working and I can found why.

Here is the code:

mov ft0.rgb, fc0.rgbb
tex ft1, v1.rggg, fs0 <2d, linear, nomip, repeat>
mov ft0.a, ft1.aaaa
mov oc, ft0

Where fc0 is the vector I am trying to upload:

With this function I call before drawTriangles and present:

Engine.context.setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, Vector.<Number>([value1, value2, value3]));

I've debugged the scene with Adobe Scout and apparently fc0 has no value.

If I substitue the last ft0 for ft1 it works since I am rendering only the texture.

Any suggestions?


Solution

  • The vector that you upload needs to have at least 4 elements in it.

    See the description of the data parameter on this page.