我正在尝试传递一个变量 timeVar(一个最初设置为 0.0 的 float ),它在我的 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
。
关于c++ - 警告 : Variable cannot be bound (it either doesn't exist or has been optimized away),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32750181/