hi, sorry to be bothering, I asked that question some days ago on the pd list, maybe the gem-dev is the better place to ask. I am referring to a mail from the summer between cyrille and chris, but can't find it anymore.
I am trying to get more multitexture glsl stuff working. the problem I am having right now is that I don't know how to pass the rectangle coords of the second texture to the glsl program. in the example I got, it looks like only the coords of one texture are used... vec4 color = texture2DRect(MyTex, texcoord1); vec4 color2 = texture2DRect(MyTex1, texcoord1);
but in another shader I got
texcoord0 = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0); texcoord1 = vec2(gl_TextureMatrix[1] * gl_MultiTexCoord1);
and that does not work.
I wondered how glsl knows the size of the first texture and I tried to have both textures in one render chain, but that did not work. in the mail I mentioned above read that I can send a message to the glsl program to tell it the coords. how do I do that?
or should this work, and I am only using an old GEM version (0.91-cvs from july29)
thanks, marius.
On 10/1/07, marius schebella marius.schebella@gmail.com wrote:
I am trying to get more multitexture glsl stuff working. the problem I am having right now is that I don't know how to pass the rectangle coords of the second texture to the glsl program.
Send the message 'MyTex1 1' to glsl_program and it will set the sampler to read from the second texture unit. The sampler texunit is treated like any variable sent to the shader. You can name it whatever you want as long as the right message is given to glsl_program.
hi chris, thanxs for your answer. the texture is read, but I think the correct size is not (gl_MultiTexCoord1). if I try to mix the two textures, then it looks like the second texture is only 1*1 pix. maybe I am wrong. I read that I have to pass that value manually. it works fine, when I use only gl_MultiTexCoord0 for both textures. marius.
chris clepper wrote:
On 10/1/07, marius schebella marius.schebella@gmail.com wrote:
I am trying to get more multitexture glsl stuff working. the problem I am having right now is that I don't know how to pass the rectangle coords of the second texture to the glsl program.
Send the message 'MyTex1 1' to glsl_program and it will set the sampler to read from the second texture unit. The sampler texunit is treated like any variable sent to the shader. You can name it whatever you want as long as the right message is given to glsl_program.
I posted an example patch and shaders on July 12 of this year. Can you test that one?
On 10/1/07, marius schebella marius.schebella@gmail.com wrote:
hi chris, thanxs for your answer. the texture is read, but I think the correct size is not (gl_MultiTexCoord1). if I try to mix the two textures, then it looks like the second texture is only 1*1 pix. maybe I am wrong. I read that I have to pass that value manually. it works fine, when I use only gl_MultiTexCoord0 for both textures. marius.
well, yes it works, but as I already posted before the fragment shader has vec4 color = texture2DRect(MyTex, texcoord1); vec4 color2 = texture2DRect(MyTex1, texcoord1); which means only texcoord1 are used. all other shaders for more than one texture would use vec4 color = texture2DRect(MyTex, texcoord1); vec4 color2 = texture2DRect(MyTex1, texcoord*2*); and that is not working. I finally found your mail from summer, where you suggested how to get dimensions into glsl_program, but I don't see how to do that. http://lists.puredata.info/pipermail/gem-dev/2007-08/002873.html marius.
chris clepper wrote:
I posted an example patch and shaders on July 12 of this year. Can you test that one?
On 10/1/07, marius schebella marius.schebella@gmail.com wrote:
hi chris, thanxs for your answer. the texture is read, but I think the correct size is not (gl_MultiTexCoord1). if I try to mix the two textures, then it looks like the second texture is only 1*1 pix. maybe I am wrong. I read that I have to pass that value manually. it works fine, when I use only gl_MultiTexCoord0 for both textures. marius.