XML Feeds

.

[jitter] first shader

marius schebella marius.schebella at gmail.com
Thu Nov 8 12:19:15 MST 2007


thank you for the quick reply.
I think I have a problem in my max patch, because
even
void main()
{
     vec4 A = texture2DRect(image, texcoord);
     A.a = 0.4;
     gl_FragColor = A;
}
does not look transparent. (A.r, A.g, A.b all work.)
do I need a special object or argument to turn alphachannel computation 
on? sorry if that is a basic question. right now I am only using 
jit.qt.movie,  jit.gl.slab and jit.gl.videoplane.
thanks,
marius.

Wesley Smith wrote:
>   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
>>
> _______________________________________________
> jitter mailing list
> jitter at cycling74.com
> http://www.cycling74.com/mailman/listinfo/jitter
> 



More information about the jitter mailing list