[require] GLSL >= 1.10 [vertex shader] /* VS array access (read-only) from temps using a varying * array index per vert. */ uniform float one; varying vec4 color; void main() { vec4 colors[4]; colors[0] = vec4(one, 0.0, 0.0, 0.0); colors[1] = vec4(0.0, one, 0.0, 0.0); colors[2] = vec4(0.0, 0.0, one, 0.0); colors[3] = vec4(one, 0.0, one, 0.0); gl_Position = gl_Vertex; int index = int((gl_Vertex.x + 1.0) * 0.5 + (gl_Vertex.y + 1.0)); color = colors[index]; } [fragment shader] varying vec4 color; void main() { gl_FragColor = color; } [test] uniform float one 1.0 draw rect -1 -1 2 2 relative probe rgb (0.0, 0.0) (1.0, 0.0, 0.0, 0.0) relative probe rgb (1.0, 0.0) (0.0, 1.0, 0.0, 0.0) relative probe rgb (0.0, 1.0) (0.0, 0.0, 1.0, 0.0) relative probe rgb (1.0, 1.0) (1.0, 0.0, 1.0, 0.0)