[GEM-dev] multitexture with shader

cyrille henry cyrille.henry at la-kitchen.fr
Sat May 5 12:11:51 CEST 2007


hello,


Wesley Smith a écrit :
> I'm not sure how this works in GEM, but somewhere you have to call:
> 
> glUniform1ivARB(samplerLocation, multiTexIndex);
> 
> In other words, the texture unit index value you're binding to has to
> be passed to the sampler's uniform parameter, otherwise it will
> default to 0 and only give you 1 texture.

i think this call should be made in glsl_program.
well, i'll have to open the source code in order to try to understand.

thanks
Cyrille


> 
> wes
> 
> On 5/3/07, cyrille henry <cyrille.henry at la-kitchen.fr> wrote:
>> hello,
>>
>> i still have problem trying to have multiple texture on a shader to work.
>>
>> i just adapt the pix_multitexture exemple jamie send month ago on this
>> list (see attachment).
>>
>> my problem is that i can only access to my 1st texture in the shader.
>>
>> the 2 textures have the same size.
>> i've test this patch on linux and osX with the same result.
>>
>> my shader look like this :
>>
>> void main()
>> {
>>      gl_TexCoord[0] = gl_MultiTexCoord0;
>> //    gl_TexCoord[1] = gl_MultiTexCoord1;
>>      gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
>>
>> }
>>
>> and
>>
>> uniform sampler2DRect txtur, txtur2;
>>
>> void main (void)
>> {
>>         vec4 color;
>>         color = texture2DRect(txtur, gl_TexCoord[0].st) + 
>> texture2DRect(txtur2,
>> gl_TexCoord[0].st);
>>
>>         gl_FragColor = 0.5 * color + 0.1 ;
>> }
>>
>>
>> i'll be very happy if someone could help me.
>>
>> thanks
>> Cyrille
>>
>> _______________________________________________
>> GEM-dev mailing list
>> GEM-dev at iem.at
>> http://lists.puredata.info/listinfo/gem-dev
>>
>>
>>
> 
> 




More information about the GEM-dev mailing list