我使用ShaderDesigner版本1.5.9.6開發GLSL。所以困惑爲什麼多紋理不能工作!有人知道嗎? thx回答。ShaderDesigner多紋理不起作用
頂點着色器:
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = gl_MultiTexCoord1;
gl_Position = ftransform();
}
片段着色器:
uniform sampler2D BaseImage;
uniform sampler2D BlendImage;
uniform float Opacity;
void main()
{
vec4 baseColor = texture2D(BaseImage, gl_TexCoord[0].st);
vec4 blendColor = texture2D(BlendImage, gl_TexCoord[1].st);
gl_FragColor = blendColor;
}
BlendImage着展現在ShaderDesigner,雖然BaseImage是好的。我肯定肯定已經爲兩個採樣器設置了紋理單元0和1。
什麼GLSL版本你在這裏定位? –
看起來您在頂點和片段着色器中使用了多個GLSL版本。在這方面有很多未定義的行爲,可能是你問題的原因。 – Bartvbl
@Bartvbl其實我只是在ShaderDesigner軟件中測試教程代碼。沒有任何語法錯誤和編譯鏈接都可以,也可以使用baseColor顯示正確! GLSL版本4.5.0。更新的opengl,appologize。 – santi