Added GetActiveAttrib, GetActiveUniform, GetActiveUniformName and GetActiveUniformBlockName overloads that return strings. Fixes issue [#1213]: "[GL] let GetUniformName() return String".

This commit is contained in:
the_fiddler 2009-10-06 08:29:12 +00:00
parent 9933bf4739
commit c6afa30b4b

View file

@ -663,6 +663,68 @@ namespace OpenTK.Graphics.OpenGL
#endregion
#region Shaders
#region GetActiveAttrib
public static string GetActiveAttrib(int program, int index, out int size, out ActiveAttribType type)
{
int length;
GetProgram(program, OpenTK.Graphics.OpenGL.ProgramParameter.ActiveAttributeMaxLength, out length);
StringBuilder sb = new StringBuilder(length == 0 ? 1 : length);
GetActiveAttrib(program, index, sb.Length, out length, out size, out type, sb);
return sb.ToString();
}
#endregion
#region GetActiveUniform
public static string GetActiveUniform(int program, int uniformIndex, out int size, out ActiveUniformType type)
{
int length;
GetProgram(program, OpenTK.Graphics.OpenGL.ProgramParameter.ActiveUniformMaxLength, out length);
StringBuilder sb = new StringBuilder(length == 0 ? 1 : length);
GetActiveUniform(program, uniformIndex, sb.Length, out length, out size, out type, sb);
return sb.ToString();
}
#endregion
#region GetActiveUniformName
public static string GetActiveUniformName(int program, int uniformIndex)
{
int length;
GetProgram(program, OpenTK.Graphics.OpenGL.ProgramParameter.ActiveUniformMaxLength, out length);
if (length == 0)
return String.Empty;
StringBuilder sb = new StringBuilder(length);
GetActiveUniformName(program, uniformIndex, sb.Length, out length, sb);
return sb.ToString();
}
#endregion
#region GetActiveUniformBlockName
public static string GetActiveUniformBlockName(int program, int uniformIndex)
{
int length;
GetProgram(program, OpenTK.Graphics.OpenGL.ProgramParameter.ActiveUniformBlockMaxNameLength, out length);
if (length == 0)
return String.Empty;
StringBuilder sb = new StringBuilder(length);
GetActiveUniformBlockName(program, uniformIndex, sb.Length, out length, sb);
return sb.ToString();
}
#endregion
#region public static void ShaderSource(Int32 shader, System.String @string)
public static void ShaderSource(Int32 shader, System.String @string)
@ -739,6 +801,8 @@ namespace OpenTK.Graphics.OpenGL
#endregion
#endregion
#region public static void PointParameter(PointSpriteCoordOriginParameter param)
/// <summary>