i tried to write a simple shader which display a texture. if the texture ist stored in Texture Unit1 everything is ok but if the texture is stored in Texture Unit 2 my object is simply black.
Looks ok to me. Checked you actually set up the uniform samplers correctly? Maybe you can post your application code for setting up the textures and the uniforms?
By default, the driver/compiler sees you don’t use tex1, so it expects tex2=TexUnit0.
Either you use glUniform1i() to set the sampler to use a given texunit, or on nVidia cards you specify a semantic (which binds the tex2 to a given unit)
uniform sampler2D tex1: TEXUNIT0;
uniform sampler2D tex2: TEXUNIT1;
i tried to write a simple shader which display a texture. if the texture ist stored in Texture Unit1 everything is ok but if the texture is stored in Texture Unit 2 my object is simply black
Are you using an Intel driver/card? I’ve found similar problems on shaders that use tha second TU, especially with texture coordinates…
By default, the driver/compiler sees you don’t use tex1, so it expects tex2=TexUnit0.
If i also use the tex1 the same thing happened. I see no texture.
I have a gforce 8800 gt but unfortunately
uniform sampler2D tex1: TEXUNIT0;
uniform sampler2D tex2: TEXUNIT1;
don’t work.
Now i have set the sampler and it works.
Is it necessary to set the sampler if i use TEXUNIT1 or do multitexturing because I don’t set the sampler before