Ara Hakobyan
Ara Hakobyan

Reputation: 1692

openGl glGetUniformLocation returns -1

**it's always returns -1 , here is the code

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;
}

why aColorLocation = glGetUniformLocation(program, A_COLOR) retuns -1

where private val A_COLOR = "a_Color"

and program = 3

Upvotes: 0

Views: 79

Answers (1)

Reaper
Reaper

Reputation: 757

a_Color is an attribute. Either make it a uniform or use glGetAttribLocation.

Upvotes: 2

Related Questions