openGl glGetUniformLocation返回-1

时间:2018-03-30 10:22:49

标签: android opengl-es-2.0

**它始终返回-1,这是代码

simple_fragment_shader

precision mediump float;
varying vec4 v_Color;
void main()
{
    gl_FragColor = v_Color;
}

simple_vertex_shader

attribute vec4 a_Position;
attribute vec4 a_Color;
varying vec4 v_Color;
void main()
{
    v_Color = a_Color;
    gl_Position = a_Position;
    gl_PointSize = 10.0;
}

为什么aColorLocation = glGetUniformLocation(program, A_COLOR)返回-1

其中private val A_COLOR = "a_Color"

program = 3

1 个答案:

答案 0 :(得分:2)

a_Color是一个属性。要么使它成为制服,要么使用glGetAttribLocation