Pass position to fragment shader in AGAL

110 views Asked by At

I am trying to get into shading with AGAL. I have set up a full screen quad to be drawn with shader programs, but I ran into something unexplainable.

I have these vertices

var vertices:Vector.<Number> = Vector.<Number>([

    - 1, - 1, 0, - 1, - 1, 0,
    + 1, - 1, 0, + 1, - 1, 0,
    - 1, + 1, 0, - 1, + 1, 0,
    + 1, + 1, 0, + 1, + 1, 0

]);

This pair of program works

vertexShaderAssembler.assemble(Context3DProgramType.VERTEX,

    "mov op, va0\n" +
    "mov v0, va1"
);

...

fragmentShaderAssembler.assemble(Context3DProgramType.FRAGMENT,

    "mov oc, v0"
);

However this does not

vertexShaderAssembler.assemble(Context3DProgramType.VERTEX,

    "mov op, va0\n" +
    "mov v0, va0"
);

...

fragmentShaderAssembler.assemble(Context3DProgramType.FRAGMENT,

    "mov oc, v0"
);

Any clue on why I have to pass the same values through va1 and why it does not work when vertices only have three coordiante?

1

There are 1 answers

1
Sergey Gonchar On

There are a validation error or wrong indices order, If you don't see any result on the screen. To detect the issue please set enableErrorChecking property to true in context3d object. Stage3d will start to throw validation errors. For any additional questions about Stage3D you can join our Stage3D Group on Facebook and get answers faster.