private void Uniform3i(int location, int v0, int v1, int v2) { if (location < 0) { return; } ShaderProgram program = this.currentShaderProgram; if (program == null) { SetLastError(ErrorCode.InvalidOperation); return; } UniformVariable v = program.GetUniformVariable(location); if (v == null) { SetLastError(ErrorCode.InvalidOperation); return; } FieldInfo fieldInfo = v.fieldInfo; if (fieldInfo.FieldType.IsArray) { SetLastError(ErrorCode.InvalidOperation); return; } // TODO: not sure about this line. program.SetUniform3i(location, v0, v1, v2); }
private void UniformMatrix4fv(int location, int count, bool transpose, float[] value) { if (location < 0 || value == null || value.Length != 16) { return; } ShaderProgram program = this.currentShaderProgram; if (program == null) { SetLastError(ErrorCode.InvalidOperation); return; } // TODO:GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command. if (count < 0) { SetLastError(ErrorCode.InvalidValue); return; } UniformVariable v = program.GetUniformVariable(location); if (v == null) { SetLastError(ErrorCode.InvalidOperation); return; } FieldInfo fieldInfo = v.fieldInfo; if ((count > 1) && (!fieldInfo.FieldType.IsArray)) { SetLastError(ErrorCode.InvalidOperation); return; } program.SetUniform4fv(location, count, transpose, value); }
private void Uniform1fv(int location, int count, float[] value) { if (location < 0 || value == null || value.Length != 1) { return; } ShaderProgram program = this.currentShaderProgram; if (program == null) { SetLastError(ErrorCode.InvalidOperation); return; } // TODO:GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command. if (count < 0) { SetLastError(ErrorCode.InvalidValue); return; } UniformVariable v = program.GetUniformVariable(location); if (v == null) { SetLastError(ErrorCode.InvalidOperation); return; } FieldInfo fieldInfo = v.fieldInfo; if ((count > 1) && (!fieldInfo.FieldType.IsArray)) { SetLastError(ErrorCode.InvalidOperation); return; } var copy = new float[count]; for (int i = 0; i < count; i++) { copy[i] = value[i]; } program.SetUniform(location, copy); }