add more helper overloads
This commit is contained in:
parent
103fea5218
commit
c242935a3c
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace PortableGL
|
||||
{
|
||||
|
@ -44,6 +45,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glDeleteBuffers(int n, ref int buffers)
|
||||
{
|
||||
fixed (void* ptr = &buffers)
|
||||
{
|
||||
glDeleteBuffers(n, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glDeleteFramebuffers(int n, int[] framebuffers)
|
||||
{
|
||||
fixed (void* ptr = framebuffers)
|
||||
|
@ -52,6 +61,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glDeleteFramebuffers(int n, ref int framebuffers)
|
||||
{
|
||||
fixed (void* ptr = &framebuffers)
|
||||
{
|
||||
glDeleteFramebuffers(n, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glDeleteRenderbuffers(int n, int[] renderbuffers)
|
||||
{
|
||||
fixed (void* ptr = renderbuffers)
|
||||
|
@ -60,6 +77,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glDeleteRenderbuffers(int n, ref int renderbuffers)
|
||||
{
|
||||
fixed (void* ptr = &renderbuffers)
|
||||
{
|
||||
glDeleteRenderbuffers(n, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glDeleteTextures(int n, int[] textures)
|
||||
{
|
||||
fixed (void* ptr = textures)
|
||||
|
@ -68,6 +93,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glDeleteTextures(int n, ref int textures)
|
||||
{
|
||||
fixed (void* ptr = &textures)
|
||||
{
|
||||
glDeleteTextures(n, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glDrawElements<T>(int mode, int count, int type, T[] indices) where T : struct
|
||||
{
|
||||
fixed (void *ptr = indices)
|
||||
|
@ -84,6 +117,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGenBuffers(int n, ref int buffers)
|
||||
{
|
||||
fixed (void *ptr = &buffers)
|
||||
{
|
||||
glGenBuffers(n, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGenFramebuffers(int n, int[] framebuffers)
|
||||
{
|
||||
fixed (void *ptr = framebuffers)
|
||||
|
@ -92,6 +133,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGenFramebuffers(int n, ref int framebuffers)
|
||||
{
|
||||
fixed (void *ptr = &framebuffers)
|
||||
{
|
||||
glGenFramebuffers(n, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGenRenderbuffers(int n, int[] renderbuffers)
|
||||
{
|
||||
fixed (void *ptr = renderbuffers)
|
||||
|
@ -100,6 +149,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGenRenderbuffers(int n, ref int renderbuffers)
|
||||
{
|
||||
fixed (void *ptr = &renderbuffers)
|
||||
{
|
||||
glGenRenderbuffers(n, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGenTextures(int n, int[] textures)
|
||||
{
|
||||
fixed (void *ptr = textures)
|
||||
|
@ -108,6 +165,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGenTextures(int n, ref int textures)
|
||||
{
|
||||
fixed (void *ptr = &textures)
|
||||
{
|
||||
glGenTextures(n, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetBooleanv(int pname, bool[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -124,6 +189,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetFloatv(int pname, ref float parameters)
|
||||
{
|
||||
fixed (void *ptr = ¶meters)
|
||||
{
|
||||
glGetFloatv(pname, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetIntegerv(int pname, int[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -132,38 +205,56 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetActiveAttrib(int program, int index, int bufSize, out int length, out int size, out int type, System.Text.StringBuilder name)
|
||||
public unsafe void glGetActiveAttrib(int program, int index, int bufSize, out int length, out int size, out int type, StringBuilder name)
|
||||
{
|
||||
fixed (int* lengthPtr = &length,
|
||||
sizePtr = &size,
|
||||
typePtr = &type)
|
||||
{
|
||||
glGetActiveAttrib(program, index, bufSize, new IntPtr((int)lengthPtr), new IntPtr((int)sizePtr), new IntPtr((int)typePtr), name);
|
||||
glGetActiveAttrib(program, index, bufSize, new IntPtr((long)lengthPtr), new IntPtr((long)sizePtr), new IntPtr((long)typePtr), name);
|
||||
length = *lengthPtr;
|
||||
size = *sizePtr;
|
||||
type = *typePtr;
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetActiveUniform(int program, int index, int bufSize, out int length, out int size, out int type, System.Text.StringBuilder name)
|
||||
public string glGetActiveAttrib(int program, int index, out int size, out int type)
|
||||
{
|
||||
int length = 0;
|
||||
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, ref length);
|
||||
StringBuilder sb = new StringBuilder(length == 0 ? 1 : length * 2);
|
||||
glGetActiveAttrib(program, index, sb.Capacity, out length, out size, out type, sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public unsafe void glGetActiveUniform(int program, int index, int bufSize, out int length, out int size, out int type, StringBuilder name)
|
||||
{
|
||||
fixed (int* lengthPtr = &length,
|
||||
sizePtr = &size,
|
||||
typePtr = &type)
|
||||
{
|
||||
glGetActiveUniform(program, index, bufSize, new IntPtr((int)lengthPtr), new IntPtr((int)sizePtr), new IntPtr((int)typePtr), name);
|
||||
glGetActiveUniform(program, index, bufSize, new IntPtr((long)lengthPtr), new IntPtr((long)sizePtr), new IntPtr((long)typePtr), name);
|
||||
length = *lengthPtr;
|
||||
size = *sizePtr;
|
||||
type = *typePtr;
|
||||
}
|
||||
}
|
||||
|
||||
public string glGetActiveUniform(int program, int index, out int size, out int type)
|
||||
{
|
||||
int length = 0;
|
||||
glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, ref length);
|
||||
StringBuilder sb = new StringBuilder(length == 0 ? 1 : length * 2);
|
||||
glGetActiveUniform(program, index, sb.Capacity, out length, out size, out type, sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public unsafe void glGetAttachedShaders(int program, int maxCount, out int count, int[] shaders)
|
||||
{
|
||||
fixed (int* countPtr = &count,
|
||||
shadersPtr = shaders)
|
||||
{
|
||||
glGetAttachedShaders(program, maxCount, new IntPtr((int)countPtr), new IntPtr((int)shadersPtr));
|
||||
glGetAttachedShaders(program, maxCount, new IntPtr((long)countPtr), new IntPtr((long)shadersPtr));
|
||||
count = *countPtr;
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +275,7 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetProgramInfoLog(int program, int maxLength, out int length, System.Text.StringBuilder infoLog)
|
||||
public unsafe void glGetProgramInfoLog(int program, int maxLength, out int length, StringBuilder infoLog)
|
||||
{
|
||||
fixed (int* lengthPtr = &length)
|
||||
{
|
||||
|
@ -193,6 +284,17 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public string glGetProgramInfoLog(int program)
|
||||
{
|
||||
int length = 0;
|
||||
glGetProgramiv(program, GL_INFO_LOG_LENGTH, ref length);
|
||||
if (length == 0)
|
||||
return String.Empty;
|
||||
StringBuilder sb = new StringBuilder(length * 2);
|
||||
glGetProgramInfoLog(program, sb.Capacity, out length, sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public unsafe void glGetProgramiv(int program, int pname, int[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -201,6 +303,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetProgramiv(int program, int pname, ref int parameters)
|
||||
{
|
||||
fixed (void *ptr = ¶meters)
|
||||
{
|
||||
glGetProgramiv(program, pname, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetRenderbufferParameteriv(int target, int pname, int[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -209,7 +319,7 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetShaderInfoLog(int shader, int maxLength, out int length, System.Text.StringBuilder infoLog)
|
||||
public unsafe void glGetShaderInfoLog(int shader, int maxLength, out int length, StringBuilder infoLog)
|
||||
{
|
||||
fixed (int* lengthPtr = &length)
|
||||
{
|
||||
|
@ -218,6 +328,17 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public string glGetShaderInfoLog(int shader)
|
||||
{
|
||||
int length = 0;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, ref length);
|
||||
if (length == 0)
|
||||
return String.Empty;
|
||||
StringBuilder sb = new StringBuilder(length * 2);
|
||||
glGetShaderInfoLog(shader, sb.Capacity, out length, sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public unsafe void glGetShaderPrecisionFormat(int shaderType, int precisionType, int[] range, out int precision)
|
||||
{
|
||||
fixed (void* rangePtr = range)
|
||||
|
@ -228,7 +349,7 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetShaderSource(int shader, int maxLength, out int length, System.Text.StringBuilder source)
|
||||
public unsafe void glGetShaderSource(int shader, int maxLength, out int length, StringBuilder source)
|
||||
{
|
||||
fixed (int* lengthPtr = &length)
|
||||
{
|
||||
|
@ -237,6 +358,17 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public string glGetShaderSource(int shader)
|
||||
{
|
||||
int length = 0;
|
||||
glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, ref length);
|
||||
if (length == 0)
|
||||
return String.Empty;
|
||||
StringBuilder sb = new StringBuilder(length * 2);
|
||||
glGetShaderSource(shader, sb.Capacity, out length, sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public unsafe void glGetShaderiv(int shader, int pname, int[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -245,6 +377,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetShaderiv(int shader, int pname, ref int parameters)
|
||||
{
|
||||
fixed (void *ptr = ¶meters)
|
||||
{
|
||||
glGetShaderiv(shader, pname, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetTexParameterfv(int target, int pname, float[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -253,6 +393,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetTexParameterfv(int target, int pname, ref float parameters)
|
||||
{
|
||||
fixed (void *ptr = ¶meters)
|
||||
{
|
||||
glGetTexParameterfv(target, pname, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetTexParameteriv(int target, int pname, int[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -261,6 +409,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetTexParameteriv(int target, int pname, ref int parameters)
|
||||
{
|
||||
fixed (void *ptr = ¶meters)
|
||||
{
|
||||
glGetTexParameteriv(target, pname, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetUniformfv(int program, int location, float[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -269,6 +425,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetUniformfv(int program, int location, ref float parameters)
|
||||
{
|
||||
fixed (void *ptr = ¶meters)
|
||||
{
|
||||
glGetUniformfv(program, location, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetUniformiv(int program, int location, int[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -277,6 +441,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetUniformiv(int program, int location, ref int parameters)
|
||||
{
|
||||
fixed (void *ptr = ¶meters)
|
||||
{
|
||||
glGetUniformiv(program, location, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetVertexAttribfv(int index, int pname, float[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -285,6 +457,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetVertexAttribfv(int index, int pname, ref float parameters)
|
||||
{
|
||||
fixed (void *ptr = ¶meters)
|
||||
{
|
||||
glGetVertexAttribfv(index, pname, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetVertexAttribiv(int index, int pname, int[] parameters)
|
||||
{
|
||||
fixed (void *ptr = parameters)
|
||||
|
@ -293,6 +473,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glGetVertexAttribiv(int index, int pname, ref int parameters)
|
||||
{
|
||||
fixed (void *ptr = ¶meters)
|
||||
{
|
||||
glGetVertexAttribiv(index, pname, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glReadPixels<T>(int x, int y, int width, int height, int format, int type, T[] pixels) where T : struct
|
||||
{
|
||||
fixed (void *ptr = pixels)
|
||||
|
@ -318,6 +506,11 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public void glShaderSource(int shader, string str)
|
||||
{
|
||||
glShaderSource(shader, 1, new string[] { str }, new int[] { str.Length });
|
||||
}
|
||||
|
||||
public unsafe void glTexImage2D<T>(int target, int level, int internalformat, int width, int height, int border, int format, int type, T[] data) where T : struct
|
||||
{
|
||||
fixed (void *ptr = data)
|
||||
|
@ -374,6 +567,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform2fv(int location, int count, ref float value)
|
||||
{
|
||||
fixed (void *ptr = &value)
|
||||
{
|
||||
glUniform2fv(location, count, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform2iv(int location, int count, int[] value)
|
||||
{
|
||||
fixed (void *ptr = value)
|
||||
|
@ -382,6 +583,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform2iv(int location, int count, ref int value)
|
||||
{
|
||||
fixed (void *ptr = &value)
|
||||
{
|
||||
glUniform2iv(location, count, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform3fv(int location, int count, float[] value)
|
||||
{
|
||||
fixed (void *ptr = value)
|
||||
|
@ -390,6 +599,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform3fv(int location, int count, ref float value)
|
||||
{
|
||||
fixed (void *ptr = &value)
|
||||
{
|
||||
glUniform3fv(location, count, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform3iv(int location, int count, int[] value)
|
||||
{
|
||||
fixed (void *ptr = value)
|
||||
|
@ -398,6 +615,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform3iv(int location, int count, ref int value)
|
||||
{
|
||||
fixed (void *ptr = &value)
|
||||
{
|
||||
glUniform3iv(location, count, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform4fv(int location, int count, float[] value)
|
||||
{
|
||||
fixed (void *ptr = value)
|
||||
|
@ -406,6 +631,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform4fv(int location, int count, ref float value)
|
||||
{
|
||||
fixed (void *ptr = &value)
|
||||
{
|
||||
glUniform4fv(location, count, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform4iv(int location, int count, int[] value)
|
||||
{
|
||||
fixed (void *ptr = value)
|
||||
|
@ -414,6 +647,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniform4iv(int location, int count, ref int value)
|
||||
{
|
||||
fixed (void *ptr = &value)
|
||||
{
|
||||
glUniform4iv(location, count, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniformMatrix2fv(int location, int count, bool transpose, float[] value)
|
||||
{
|
||||
fixed (void *ptr = value)
|
||||
|
@ -422,6 +663,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniformMatrix2fv(int location, int count, bool transpose, ref float value)
|
||||
{
|
||||
fixed (void *ptr = &value)
|
||||
{
|
||||
glUniformMatrix2fv(location, count, transpose, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniformMatrix3fv(int location, int count, bool transpose, float[] value)
|
||||
{
|
||||
fixed (void *ptr = value)
|
||||
|
@ -430,6 +679,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniformMatrix3fv(int location, int count, bool transpose, ref float value)
|
||||
{
|
||||
fixed (void *ptr = &value)
|
||||
{
|
||||
glUniformMatrix3fv(location, count, transpose, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniformMatrix4fv(int location, int count, bool transpose, float[] value)
|
||||
{
|
||||
fixed (void *ptr = value)
|
||||
|
@ -438,6 +695,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glUniformMatrix4fv(int location, int count, bool transpose, ref float value)
|
||||
{
|
||||
fixed (void *ptr = &value)
|
||||
{
|
||||
glUniformMatrix4fv(location, count, transpose, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glVertexAttrib1fv(int index, float[] v)
|
||||
{
|
||||
fixed (void *ptr = v)
|
||||
|
@ -454,6 +719,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glVertexAttrib2fv(int index, ref float v)
|
||||
{
|
||||
fixed (void *ptr = &v)
|
||||
{
|
||||
glVertexAttrib2fv(index, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glVertexAttrib3fv(int index, float[] v)
|
||||
{
|
||||
fixed (void *ptr = v)
|
||||
|
@ -462,6 +735,14 @@ namespace PortableGL
|
|||
}
|
||||
}
|
||||
|
||||
public unsafe void glVertexAttrib3fv(int index, ref float v)
|
||||
{
|
||||
fixed (void *ptr = &v)
|
||||
{
|
||||
glVertexAttrib3fv(index, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glVertexAttrib4fv(int index, float[] v)
|
||||
{
|
||||
fixed (void *ptr = v)
|
||||
|
@ -469,6 +750,14 @@ namespace PortableGL
|
|||
glVertexAttrib4fv(index, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void glVertexAttrib4fv(int index, ref float v)
|
||||
{
|
||||
fixed (void *ptr = &v)
|
||||
{
|
||||
glVertexAttrib4fv(index, new IntPtr((long)ptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue