【问题标题】:GLSL Uniforms initializing is allowed from GLSL version 1.20从 GLSL 版本 1.20 开始允许 GLSL Uniforms 初始化
【发布时间】:2012-08-01 21:51:43
【问题描述】:

我收到以下错误:

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

编辑: 有问题的着色器是一个片段着色器(没有顶点着色器):

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 不,谢谢,我正在尝试。

标签: opengl glsl intel


【解决方案1】:

GLSL 规范规定,如果着色器不提供#version directive,则假定为版本 1.10。确保始终在着色器顶部提供 #version 指令。

【讨论】:

  • 是的,就是这样。似乎只有英特尔确实严格解释了规范,至少它在没有#version 以及之前所有的 Ati 和 Nvidea 显卡的情况下运行。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-10-24
  • 1970-01-01
  • 2014-01-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多