Generally, question is in header.
I cannot understand how to use GetActiveUniform
function.
public void GetActiveUniform(uint program,
uint index,
int bufSize,
int[] length,
int[] size,
uint[] type,
string name);
My attempt looks like this (everything is compiled and linked):
int[] numberOfUniforms = new int[1];
Gl.GetProgram(programId, ProgramParameter.ActiveUniforms, numberOfUniforms);
int[] uniformNameMaxLength = new int[1];
Gl.GetProgram(programId, ProgramParameter.ActiveUniformMaxLength, uniformNameMaxLength);
int unifromCount = numberOfUniforms[0];
for (uint i = 0; i < unifromCount; i++)
{
var uniformSize = new int[1];
var unifromLength = new int[1];
var uniformType = new uint[1];
string uniformName = "";
Gl.GetActiveUniform(programId, i, uniformNameMaxLength[0], unifromLength, uniformSize, uniformType, uniformName);
}
Vertex shader:
#version 150 core
in vec3 in_Position;
out vec3 pass_Color;
uniform vec3 color;
void main(void) {
gl_Position = vec4(in_Position, 1.0);
pass_Color = color;
}
After call I get proper uniformSize, length and type, but not name.