警告:无法绑定变量(它不存在或已被优化掉)
WARN: Variable cannot be bound (it either doesn't exist or has been optimized away)
我正在尝试传递一个变量 timeVar(一个最初设置为 0.0 的浮点数),该变量在我的 display() 方法中发生了变化
timeVar = time(0);
到我的片段着色器。然后我这样做
safe_glUniform1f(h_uTime, timeVar);
然后像这样将它传递给我的着色器程序
h_uTime = safe_glGetAttribLocation(h_program, "uTime");
但是我一直收到这个错误。请帮忙!
WARN: uTime cannot be bound (it either doesn't exist or has been optimized
away). safe_glAttrib calls will silently ignore it.
因为 uTime
是统一的而不是属性,使用 glGetAttribLocation
总是会导致错误。必须改用 glGetUniformLocation
。
我正在尝试传递一个变量 timeVar(一个最初设置为 0.0 的浮点数),该变量在我的 display() 方法中发生了变化
timeVar = time(0);
到我的片段着色器。然后我这样做
safe_glUniform1f(h_uTime, timeVar);
然后像这样将它传递给我的着色器程序
h_uTime = safe_glGetAttribLocation(h_program, "uTime");
但是我一直收到这个错误。请帮忙!
WARN: uTime cannot be bound (it either doesn't exist or has been optimized
away). safe_glAttrib calls will silently ignore it.
因为 uTime
是统一的而不是属性,使用 glGetAttribLocation
总是会导致错误。必须改用 glGetUniformLocation
。