2
我收到以下錯誤:GLSL制服初始化從GLSL版本允許1.20
WARNING: uniforms initializing is allowed from GLSL version 1.20
WARNING: Only GLSL version > 110 allows postfix "F" or "f" for float
雖然我知道如何解決這個問題,我不知道爲什麼這可能發生,因爲這發生在機器有OpenGL 3.1和因此具有GLSL 1.4:
12:40:58 [INFO] Intel(R) HD Graphics Family
12:40:58 [INFO] OpenGL 3.1.0 - Build 8.15.10.2509
編輯: 有問題的遮影器爲fragement着色器(沒有頂點着色器):
uniform sampler2D sampler;
uniform sampler2D bump;
uniform float imageSize;
uniform float range = 50;
void main() {
vec2 pos = gl_TexCoord[0].xy;
float height = texture2D(bump, gl_TexCoord[0].xy).r - 0.5;
pos.y += height * range/imageSize;
gl_FragColor = texture2D(sampler, pos);
//gl_FragColor = texture2D(sampler, pos) * (1 + (height - 0.3f) * 25);
}
您是否指定了#version指令?您必須聲明每個着色器要使用的版本。 – Tim 2012-08-01 21:53:21
務必提供有關的相關信息。在這種情況下,就像着色器一樣。 – 2012-08-01 22:03:15
@Tim不,謝謝你,我正在嘗試。 – DiddiZ 2012-08-01 22:32:04