[jitter] first shader
Wesley Smith
wesley.hoke at gmail.com
Thu Nov 8 11:00:47 MST 2007
- Previous message: [jitter] first shader
- Next message: [jitter] first shader
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
vec4 A = texture2DRect(image, texcoord);
A.a = pass_other[0];
this should be :
vec4 A = texture2DRect(image, texcoord);
A.a = pass_other.x;
wes
On 11/8/07, marius schebella <marius.schebella at gmail.com> wrote:
> hey,
> I just subscribed to the jitter list, trying to test a shader but
> something is wrong. I hope it is ok, if I just paste it.
> I have to say that this is my first shader, so it could be some very
> basic problem with bindings or jitter communication.
> anyway, when I try to load the shader I get:
> setting GLSL param: GL Error: Invalid operation
> thanks for help,
> marius.
>
> ---------
> <jittershader name="set-alpha">
> <description>Shader to set alpha related to color thresholds</description>
> <param name="image" type="float" default="0" />
> <param name="hithresh" type="vec4" default="0.0 0.0 0.0 0.0" />
> <param name="lothresh" type="vec4" default="0.0 0.0 0.0 0.0" />
> <param name="pass_other" type="vec2" default="0.0 1.0" />
> <language name="glsl" version="1.0">
> <bind param="image" program="fp" />
> <bind param="hithresh" program="fp" />
> <bind param="lothresh" program="fp" />
> <bind param="pass_other" program="fp" />
>
> <program name="vp" type="vertex">
> <![CDATA[
> // VERTEX SHAADER
>
> varying vec2 texcoord;
>
> void main (void)
> {
> gl_Position = ftransform();
> texcoord = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
> }
> ]]>
> </program>
>
> <program name="fp" type="fragment">
> <![CDATA[
> // FRAGMENT SHADER
>
> varying vec2 texcoord;
> uniform sampler2DRect image;
>
> uniform vec4 hithresh; // hi and lo threshold
> uniform vec4 lothresh;
> uniform vec2 pass_other;
>
> void main()
> {
> vec4 A = texture2DRect(image, texcoord);
> A.a = pass_other[0];
> if ((A.r >= hithresh.r) || (A.r <= lothresh.r) || (A.g >= hithresh.g)
> || (A.g <= lothresh.g) || (A.b >= hithresh.b) || (A.r <= lothresh.b))
> {
> A.a = pass_other[1];
> }
> gl_FragColor = A;
>
> }
> ]]>
> </program>
> </language>
> </jittershader>
> _______________________________________________
> jitter mailing list
> jitter at cycling74.com
> http://www.cycling74.com/mailman/listinfo/jitter
>
- Previous message: [jitter] first shader
- Next message: [jitter] first shader
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
