the problem is :that i found the effect of value2 and value1 is the same. whether the load texture is wrong or texture coordninate? but when put the shader in procedure, it’s all right.May i didn’t bind the second texture ?
thanks
Depends on what you are trying to achieve, but often you would want
gl_TexCoord[1] = gl_MultiTexCoord1;
in your vertex shader.
Apart from that we can’t tell anything because we don’t know how you bind textures to the uniform samplers and what texture coordinates you are setting.
Apart from that we can’t tell anything because we don’t know how you bind textures to the uniform samplers and what texture coordinates you are setting.
hi:
thank you for your reply. I bind the texture by the Textures which is below the Project menu. then i choose two textures; at last, refresh and accept it. but i just found the second didin’t appear Texture Preview dialog. why?
aslo you mention “texture coordinates you are setting”, Are texture coordinates set in vertex shader? At same time i rectify gl_TexCoord[1] = gl_MultiTexCoord1
but the effect is aslo wrong.
With multiple textures there is something strange with this tool, you have to manually add one or more custom uniform or something.
I had this problem and solved it, but I don’t really remember how
@huaner:
You shader code snippet will be optimised by driver’s GLSL compiler and propably it will discard value2 and TextureUnit1 as unused variables.
I don’t know what did you do in your app but samplers should have texture unit number, not texture ID. So… bind texture to unit and then bind texture unit index to sampler.