顶点着色器看起来像这样:
uniform mat4 projectionMatrix;
uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
attribute vec4 vPosition;
attribute vec4 vColor;
varying vec4 vDestinationColor;
void main(void)
{
gl_Position = projectionMatrix * modelMatrix * viewMatrix * vPosition;
vDestinationColor = vColor;
}
Objective-C代码:
_projectionMatrixSlot = glGetUniformLocation(_programHandle, "projectionMatrix");
_modelMatrixSlot = glGetUniformLocation(_programHandle, "modelMatrix");
_viewMatrixSlot = glGetUniformLocation(_programHandle, "viewMatrix");
_positionAttribSlot = glGetAttribLocation(_programHandle, "vPosition");
_colorAttribSlot = glGetAttribLocation(_programHandle, "vColor");
这里_projectionMatrixSlot _viewMatrixSlot _modelMatrixSlot等于4294967295 虽然_positionAttribSlot和_colorAttribSlot很好
答案 0 :(得分:0)
编译器可以自由地丢弃代码中未使用的变量。因此,即使在着色器中声明了一个uniform,只要它不被使用,它的报告位置可以是-1或max int或unsigned int。
您可能附加了错误的顶点着色器,而不是您在此处发布的那个。