using System; using System.Diagnostics; #if !MINIMAL using System.Drawing; using System.Numerics; #endif using System.Runtime.InteropServices; using StgSharp.Math; using StgSharp.Graphic.GL; namespace StgSharp.Graphic.OpenGL4 { /// /// Provides access to OpenGL 4.x methods for the core profile. /// public sealed partial class GLLib : BindingsBase { private const string Library = "opengl32.dll"; private static readonly IntPtr[] EntryPoints; private static readonly string[] EntryPointNames; /// /// Loads all the available bindings for the current context. /// /// The context used to query the available bindings. /// /// Loads all available entry points for the current OpenGL context. /// public static void LoadBindings(IBindingsContext context) { Debug.Print("Loading entry points for {0}", typeof(GLLib).FullName); if (context == null) { throw new ArgumentNullException(nameof(context)); } for (int i = 0; i < EntryPoints.Length; i++) { EntryPoints[i] = context.GetProcAddress(EntryPointNames[i]); } } #pragma warning disable 3019 #pragma warning disable 1591 #pragma warning disable 1572 #pragma warning disable 1573 public static void ClearColor(Color color) { GLLib.ClearColor(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f); } public static void ClearColor(Color4 color) { GLLib.ClearColor(color.R, color.G, color.B, color.A); } public static void BlendColor(Color color) { GLLib.BlendColor(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, color.A / 255.0f); } public static void BlendColor(Color4 color) { GLLib.BlendColor(color.R, color.G, color.B, color.A); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform2(int location, ref Vector2 vector) { GLLib.Uniform2(location, vector.X, vector.Y); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform3(int location, ref Vector3 vector) { GLLib.Uniform3(location, vector.X, vector.Y, vector.Z); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform4(int location, ref vec4d vector) { GLLib.Uniform4(location, vector.X, vector.Y, vector.Z, vector.W); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform2(int location, Vector2 vector) { GLLib.Uniform2(location, vector.X, vector.Y); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform3(int location, Vector3 vector) { GLLib.Uniform3(location, vector.X, vector.Y, vector.Z); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform4(int location, vec4d vector) { GLLib.Uniform4(location, vector.X, vector.Y, vector.Z, vector.W); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform2(int location, ref vec2dInt vector) { GLLib.Uniform2(location, vector.X, vector.Y); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform3(int location, ref vec3dInt vector) { GLLib.Uniform3(location, vector.X, vector.Y, vector.Z); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform4(int location, ref vec4dInt vector) { GLLib.Uniform4(location, vector.X, vector.Y, vector.Z, vector.W); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform2(int location, vec2dInt vector) { GLLib.Uniform2(location, vector.X, vector.Y); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform3(int location, vec3dInt vector) { GLLib.Uniform3(location, vector.X, vector.Y, vector.Z); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform4(int location, vec4dInt vector) { GLLib.Uniform4(location, vector.X, vector.Y, vector.Z, vector.W); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// In shader code, this is represented as a . /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform4(int location, Color4 color) { GLLib.Uniform4(location, color.R, color.G, color.B, color.A); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// In shader code, this is represented as a . /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void Uniform4(int location, Quaternion quaternion) { GLLib.Uniform4(location, quaternion.X, quaternion.Y, quaternion.Z, quaternion.W); } /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix2(int location, bool transpose, ref matrix2x2 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.UniformMatrix2(location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.0 or ARB_gpu_shader_fp64|VERSION_4_0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix2(int location, bool transpose, ref Matrix2d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.UniformMatrix2(location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix2x3(int location, bool transpose, ref matrix2x3 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.UniformMatrix2x3(location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.0 or ARB_gpu_shader_fp64|VERSION_4_0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix2x3(int location, bool transpose, ref Matrix2x3d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.UniformMatrix2x3(location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v2.1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix2x4(int location, bool transpose, ref matrix2x4 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.UniformMatrix2x4(location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.0 or ARB_gpu_shader_fp64|VERSION_4_0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix2x4(int location, bool transpose, ref Matrix2x4d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.UniformMatrix2x4(location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v2.1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix3x2(int location, bool transpose, ref matrix3x2 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.UniformMatrix3x2(location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.0 or ARB_gpu_shader_fp64|VERSION_4_0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix3x2(int location, bool transpose, ref Matrix3x2d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.UniformMatrix3x2(location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix3(int location, bool transpose, ref matrix3x3 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.UniformMatrix3(location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.0 or ARB_gpu_shader_fp64|VERSION_4_0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix3(int location, bool transpose, ref Matrix3d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.UniformMatrix3(location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v2.1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix3x4(int location, bool transpose, ref matrix3x4 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.UniformMatrix3x4(location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.0 or ARB_gpu_shader_fp64|VERSION_4_0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix3x4(int location, bool transpose, ref Matrix3x4d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.UniformMatrix3x4(location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v2.1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix4x2(int location, bool transpose, ref matrix4x2 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.UniformMatrix4x2(location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.0 or ARB_gpu_shader_fp64|VERSION_4_0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix4x2(int location, bool transpose, ref Matrix4x2d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.UniformMatrix4x2(location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v2.1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix4x3(int location, bool transpose, ref matrix4x3 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.UniformMatrix4x3(location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.0 or ARB_gpu_shader_fp64|VERSION_4_0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix4x3(int location, bool transpose, ref Matrix4x3d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.UniformMatrix4x3(location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v2.0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix4(int location, bool transpose, ref matrix4x4 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.UniformMatrix4(location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.0 or ARB_gpu_shader_fp64|VERSION_4_0] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void UniformMatrix4(int location, bool transpose, ref Matrix4d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.UniformMatrix4(location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform2(int program, int location, ref vec2d vector) { GLLib.ProgramUniform2(program, location, vector.X, vector.Y); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform3(int program, int location, ref vec3d vector) { GLLib.ProgramUniform3(program, location, vector.X, vector.Y, vector.Z); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform4(int program, int location, ref vec4d vector) { GLLib.ProgramUniform4(program, location, vector.X, vector.Y, vector.Z, vector.W); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform2(int program, int location, vec2d vector) { GLLib.ProgramUniform2(program, location, vector.X, vector.Y); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform3(int program, int location, vec2d vector) { GLLib.ProgramUniform3(program, location, vector.X, vector.Y, vector.Z); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform4(int program, int location, vec4d vector) { GLLib.ProgramUniform4(program, location, vector.X, vector.Y, vector.Z, vector.W); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform2(int program, int location, ref vec2dInt vector) { GLLib.ProgramUniform2(program, location, vector.X, vector.Y); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform3(int program, int location, ref vec3dInt vector) { GLLib.ProgramUniform3(program, location, vector.X, vector.Y, vector.Z); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform4(int program, int location, ref vec4dInt vector) { GLLib.ProgramUniform4(program, location, vector.X, vector.Y, vector.Z, vector.W); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform2(int program, int location, vec2dInt vector) { GLLib.ProgramUniform2(program, location, vector.X, vector.Y); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform3(int program, int location, vec3dInt vector) { GLLib.ProgramUniform3(program, location, vector.X, vector.Y, vector.Z); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform4(int program, int location, vec4dInt vector) { GLLib.ProgramUniform4(program, location, vector.X, vector.Y, vector.Z, vector.W); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// In shader code, this is represented as a . /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform4(int program, int location, Color4 color) { GLLib.ProgramUniform4(program, location, color.R, color.G, color.B, color.A); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the specified program object. /// In shader code, this is represented as a . /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniform4(int program, int location, Quaternion quaternion) { GLLib.ProgramUniform4(program, location, quaternion.X, quaternion.Y, quaternion.Z, quaternion.W); } /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix2(int program, int location, bool transpose, ref matrix2x2 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix2(program, location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix2(int program, int location, bool transpose, ref Matrix2d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.ProgramUniformMatrix2(program, location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix2x3(int program, int location, bool transpose, ref matrix2x3 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix2x3(program, location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix2x3(int program, int location, bool transpose, ref Matrix2x3d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.ProgramUniformMatrix2x3(program, location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix2x4(int program, int location, bool transpose, ref matrix2x4 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix2x4(program, location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix2x4(int program, int location, bool transpose, ref Matrix2x4d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.ProgramUniformMatrix2x4(program, location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix3x2(int program, int location, bool transpose, ref matrix3x2 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix3x2(program, location, 1, transpose, matrix_ptr); } } } /* StgSharp dose not support /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix3x2(int program, int location, bool transpose, ref matrix3x2d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.ProgramUniformMatrix3x2(program, location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix3(int program, int location, bool transpose, ref matrix3x3 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix3(program, location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix3(int program, int location, bool transpose, ref matrix3x3 matrix) { unsafe { fixed (double* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix3(program, location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix3x4(int program, int location, bool transpose, ref matrix3x4 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix3x4(program, location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix3x4(int program, int location, bool transpose, ref Matrix3x4d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.ProgramUniformMatrix3x4(program, location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix4x2(int program, int location, bool transpose, ref matrix4x2 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix4x2(program, location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix4x2(int program, int location, bool transpose, ref Matrix4x2d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.ProgramUniformMatrix4x2(program, location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix4x3(int program, int location, bool transpose, ref matrix4x3 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix4x3(program, location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix4x3(int program, int location, bool transpose, ref Matrix4x3d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.ProgramUniformMatrix4x3(program, location, 1, transpose, matrix_ptr); } } } */ /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix4(int program, int location, bool transpose, ref matrix4x4 matrix) { unsafe { fixed (float* matrix_ptr = &matrix.row0.X) { GLLib.ProgramUniformMatrix4(program, location, 1, transpose, matrix_ptr); } } } /* /// /// [requires: v4.1 or ARB_separate_shader_objects|VERSION_4_1] /// Specify the value of a uniform variable for the current program object. /// /// /// Specifies the handle of the program containing the uniform variable to be modified. /// /// /// Specifies the location of the uniform variable to be modified. /// /// /// Whether or not the matrix should be transposed. /// /// Specifies the new vector to be used for the specified uniform variable. /// public static void ProgramUniformMatrix4(int program, int location, bool transpose, ref Matrix4d matrix) { unsafe { fixed (double* matrix_ptr = &matrix.Row0.X) { GLLib.ProgramUniformMatrix4(program, location, 1, transpose, matrix_ptr); } } } */ public static string GetActiveAttrib(int program, int index, out int size, out ActiveAttribType type) { int length; GetProgram(program, OpenGL4.GetProgramParameterName.ActiveAttributeMaxLength, out length); string str; GetActiveAttrib(program, index, length == 0 ? 1 : length * 2, out length, out size, out type, out str); return str; } public static string GetActiveUniform(int program, int uniformIndex, out int size, out ActiveUniformType type) { int length; GetProgram(program, OpenGL4.GetProgramParameterName.ActiveUniformMaxLength, out length); string str; GetActiveUniform(program, uniformIndex, length == 0 ? 1 : length, out length, out size, out type, out str); return str; } public static void ShaderSource(int shader, string @string) { unsafe { int length = @string.Length; GLLib.ShaderSource((uint)shader, 1, new string[] { @string }, &length); } } public static string GetShaderInfoLog(int shader) { string info; GetShaderInfoLog(shader, out info); return info; } public static void GetShaderInfoLog(int shader, out string info) { unsafe { int length; GLLib.GetShader(shader, ShaderParameter.InfoLogLength, out length); if (length == 0) { info = string.Empty; return; } GLLib.GetShaderInfoLog((uint)shader, length * 2, &length, out info); } } public static string GetProgramInfoLog(int program) { string info; GetProgramInfoLog(program, out info); return info; } public static void GetProgramInfoLog(int program, out string info) { unsafe { int length; GLLib.GetProgram(program, OpenGL4.GetProgramParameterName.InfoLogLength, out length); if (length == 0) { info = string.Empty; return; } GLLib.GetProgramInfoLog((uint)program, length * 2, &length, out info); } } public static void VertexAttrib2(int index, ref Vector2 v) { GLLib.VertexAttrib2(index, v.X, v.Y); } public static void VertexAttrib3(int index, ref Vector3 v) { GLLib.VertexAttrib3(index, v.X, v.Y, v.Z); } public static void VertexAttrib4(int index, ref vec4d v) { GLLib.VertexAttrib4(index, v.X, v.Y, v.Z, v.W); } public static void VertexAttrib2(int index, Vector2 v) { GLLib.VertexAttrib2(index, v.X, v.Y); } public static void VertexAttrib3(int index, Vector3 v) { GLLib.VertexAttrib3(index, v.X, v.Y, v.Z); } public static void VertexAttrib4(int index, vec4d v) { GLLib.VertexAttrib4(index, v.X, v.Y, v.Z, v.W); } public static void VertexAttribPointer(int index, int size, VertexAttribPointerType type, bool normalized, int stride, int offset) { VertexAttribPointer(index, size, type, normalized, stride, (IntPtr)offset); } public static void VertexAttribPointer(uint index, int size, VertexAttribPointerType type, bool normalized, int stride, int offset) { VertexAttribPointer(index, size, type, normalized, stride, (IntPtr)offset); } public static void DrawElements(BeginMode mode, int count, DrawElementsType type, int offset) { DrawElements((PrimitiveType)mode, count, type, new IntPtr(offset)); } public static void GetFloat(GetPName pname, out Vector2 vector) { unsafe { fixed (Vector2* ptr = &vector) { GetFloat(pname, (float*)ptr); } } } public static void GetFloat(GetPName pname, out Vector3 vector) { unsafe { fixed (Vector3* ptr = &vector) { GetFloat(pname, (float*)ptr); } } } public static void GetFloat(GetPName pname, out vec4d vector) { unsafe { fixed (vec4d* ptr = &vector) { GetFloat(pname, (float*)ptr); } } } public static void GetFloat(GetPName pname, out Matrix4 matrix) { unsafe { fixed (Matrix4* ptr = &matrix) { GetFloat(pname, (float*)ptr); } } } public static void Viewport(Size size) { GLLib.Viewport(0, 0, size.Width, size.Height); } public static void Viewport(Point location, Size size) { GLLib.Viewport(location.X, location.Y, size.Width, size.Height); } public static void Viewport(Rectangle rectangle) { GLLib.Viewport(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } public static void Viewport(Box2i box) { GLLib.Viewport(box.Min.X, box.Min.Y, box.Size.X, box.Size.Y); } #if MINIMAL public static void Viewport(OpenTK.Point location, OpenTK.Size size) { GLLib.Viewport(location.X, location.Y, size.Width, size.Height); } public static void Viewport(OpenTK.Rectangle rectangle) { GLLib.Viewport(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } #endif #pragma warning restore 3019 #pragma warning restore 1591 #pragma warning restore 1572 #pragma warning restore 1573 } #pragma warning disable 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0 /// /// Defines the signature of a debug callback for /// . /// /// The for this debug message. /// The for this debug message. /// The id of this debug message. /// The for this debug message. /// The length of this debug message. /// A pointer to a null-terminated ASCII C string, representing the content of this debug message. /// A pointer to a user-specified parameter. [UnmanagedFunctionPointer(CallingConvention.Winapi)] public delegate void DebugProcArb( DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr userParam); /// /// Defines the signature of a debug callback for /// . /// /// The for this debug message. /// The for this debug message. /// The id of this debug message. /// The for this debug message. /// The length of this debug message. /// A pointer to a null-terminated ASCII C string, representing the content of this debug message. /// A pointer to a user-specified parameter. [UnmanagedFunctionPointer(CallingConvention.Winapi)] public delegate void DebugProc( DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr userParam); /// /// Defines the signature of a debug callback for /// . /// /// The for this debug message. /// The for this debug message. /// The id of this debug message. /// The for this debug message. /// The length of this debug message. /// A pointer to a null-terminated ASCII C string, representing the content of this debug message. /// A pointer to a user-specified parameter. [UnmanagedFunctionPointer(CallingConvention.Winapi)] public delegate void DebugProcKhr( DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr userParam); #pragma warning restore 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0 }