When adding a float attribute to my opengl fragment (i want to find to it later), when I compile, I get:
ERROR: 0:1: Invalid qualifiers 'attribute' in global variable context
Here’s my code:
const char * sChromaKeyFragment = _STRINGIFY(
attribute float threshold;
varying highp vec2 coordinate;
precision mediump float;
uniform sampler2D videoframe;
uniform sampler2D videosprite;
uniform vec4 mask;
vec3 normalize(vec3 color, float meanr)
{
return color*vec3(0.75 + meanr, 1., 1. - meanr);
}
void main()
{
}
New to OpenGL. Any help would be great. Thanks!
Is that a fragment shader? Attribute’s can be use only in vertex shader. You need to pass all needed information in varying’s from vertex shader to fragment shader.