次のフラグメントシェーダで何が問題になっていますか? GLSL 4.0ではOKをコンパイルしますが、GLSL 1.30では失敗します。GLSL 1.30でフラグメントシェーダをコンパイルする際にエラーが発生しました
これはコードです:
// Fragment Shader
"uniform sampler2D texture;\n"
"uniform sampler1D cmap;\n"
"uniform float minZ;\n"
"uniform float maxZ;\n"
"\n"
"void main() {\n"
" float height = texture2D(texture,gl_TexCoord[0].st);\n"
" float lum = (height-minZ)/(maxZ-minZ);\n"
" if (lum > 1.0) lum = 1.0;\n"
" else if (lum < 0.0) lum = 0.0;\n"
" gl_FragColor = texture1D(cmap, lum);\n"
"}"
これらのエラーです:
FRAGMENT glCompileShader "" FAILED
FRAGMENT Shader "" infolog:
0:7(2): error: initializer of type vec4 cannot be assigned to variable of type float
0:8(2): error: initializer of type vec4 cannot be assigned to variable of type float
0:9(6): error: operands to relational operators must be scalar and numeric
0:9(6): error: if-statement condition must be scalar boolean
0:9(17): error: value of type float cannot be assigned to variable of type vec4
0:10(11): error: operands to relational operators must be scalar and numeric
"* GLSL 4.0では正常にコンパイルできますが、GLSL 3.0では失敗します。*" GLSL 3.0はありません。 GLSL *** ES *** 3.00がありますが、それは異なっています。 –
GLSL 3.5 *どこでも*ありません。 –