[jitter] first shader
marius schebella
marius.schebella at gmail.com
Thu Nov 8 10:07:54 MST 2007
- Previous message: [jitter] Re: addressing several unibrain fire-i cameras
- Next message: [jitter] first shader
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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>
- Previous message: [jitter] Re: addressing several unibrain fire-i cameras
- Next message: [jitter] first shader
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
