diff --git a/Source/OpenTK/GLControl.Designer.cs b/Source/OpenTK/GLControl.Designer.cs index 092b00f1..8ef3fc05 100644 --- a/Source/OpenTK/GLControl.Designer.cs +++ b/Source/OpenTK/GLControl.Designer.cs @@ -30,8 +30,16 @@ namespace OpenTK /// private void InitializeComponent() { - components = new System.ComponentModel.Container(); + this.SuspendLayout(); + // + // GLControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Black; + this.Name = "GLControl"; + this.ResumeLayout(false); + } #endregion diff --git a/Source/OpenTK/OpenGL/Bindings/GL.cs b/Source/OpenTK/OpenGL/Bindings/GL.cs index a8f6e97f..997a4723 100644 --- a/Source/OpenTK/OpenGL/Bindings/GL.cs +++ b/Source/OpenTK/OpenGL/Bindings/GL.cs @@ -5871,7 +5871,7 @@ namespace OpenTK.OpenGL } public static - void DrawArray(GL.Enums.BeginMode mode, Int32 first, Int32 count) + void DrawArrays(GL.Enums.BeginMode mode, Int32 first, Int32 count) { Delegates.glDrawArrays((GL.Enums.BeginMode)mode, (Int32)first, (Int32)count); } @@ -5980,13 +5980,13 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void InterleavedArray(GL.Enums.InterleavedArrayFormat format, Int32 stride, void* pointer) + unsafe void InterleavedArrays(GL.Enums.InterleavedArrayFormat format, Int32 stride, void* pointer) { unsafe { Delegates.glInterleavedArrays((GL.Enums.InterleavedArrayFormat)format, (Int32)stride, (void*)pointer); } } public static - void InterleavedArray(GL.Enums.InterleavedArrayFormat format, Int32 stride, [In, Out] object pointer) + void InterleavedArrays(GL.Enums.InterleavedArrayFormat format, Int32 stride, [In, Out] object pointer) { unsafe { @@ -8594,14 +8594,14 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] Int32* count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] Int32* count, Int32 primcount) { unsafe { Delegates.glMultiDrawArrays((GL.Enums.BeginMode)mode, (Int32*)first, (Int32*)count, (Int32)primcount); } } [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] Int32[] count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] Int32[] count, Int32 primcount) { unsafe { @@ -8614,7 +8614,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] out Int32 count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] out Int32 count, Int32 primcount) { unsafe { @@ -8628,7 +8628,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] Int32* count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] Int32* count, Int32 primcount) { unsafe { @@ -8640,7 +8640,7 @@ namespace OpenTK.OpenGL } public static - void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] Int32[] count, Int32 primcount) + void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] Int32[] count, Int32 primcount) { unsafe { @@ -8653,7 +8653,7 @@ namespace OpenTK.OpenGL } public static - void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] out Int32 count, Int32 primcount) + void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] out Int32 count, Int32 primcount) { unsafe { @@ -8668,7 +8668,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] Int32* count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] Int32* count, Int32 primcount) { unsafe { @@ -8681,7 +8681,7 @@ namespace OpenTK.OpenGL } public static - void MultiDrawArray(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] Int32[] count, Int32 primcount) + void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] Int32[] count, Int32 primcount) { unsafe { @@ -8695,7 +8695,7 @@ namespace OpenTK.OpenGL } public static - void MultiDrawArray(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] out Int32 count, Int32 primcount) + void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] out Int32 count, Int32 primcount) { unsafe { @@ -23925,7 +23925,7 @@ namespace OpenTK.OpenGL } public static - void DrawArray(GL.Enums.BeginMode mode, Int32 first, Int32 count) + void DrawArrays(GL.Enums.BeginMode mode, Int32 first, Int32 count) { Delegates.glDrawArraysEXT((GL.Enums.BeginMode)mode, (Int32)first, (Int32)count); } @@ -24255,13 +24255,13 @@ namespace OpenTK.OpenGL } public static - void LockArray(Int32 first, Int32 count) + void LockArrays(Int32 first, Int32 count) { Delegates.glLockArraysEXT((Int32)first, (Int32)count); } public static - void UnlockArray() + void UnlockArrays() { Delegates.glUnlockArraysEXT(); } @@ -24817,14 +24817,14 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] Int32* count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] Int32* count, Int32 primcount) { unsafe { Delegates.glMultiDrawArraysEXT((GL.Enums.BeginMode)mode, (Int32*)first, (Int32*)count, (Int32)primcount); } } [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] Int32[] count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] Int32[] count, Int32 primcount) { unsafe { @@ -24837,7 +24837,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] out Int32 count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32* first, [Out] out Int32 count, Int32 primcount) { unsafe { @@ -24851,7 +24851,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] Int32* count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] Int32* count, Int32 primcount) { unsafe { @@ -24863,7 +24863,7 @@ namespace OpenTK.OpenGL } public static - void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] Int32[] count, Int32 primcount) + void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] Int32[] count, Int32 primcount) { unsafe { @@ -24876,7 +24876,7 @@ namespace OpenTK.OpenGL } public static - void MultiDrawArray(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] out Int32 count, Int32 primcount) + void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] Int32[] first, [Out] out Int32 count, Int32 primcount) { unsafe { @@ -24891,7 +24891,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiDrawArray(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] Int32* count, Int32 primcount) + unsafe void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] Int32* count, Int32 primcount) { unsafe { @@ -24904,7 +24904,7 @@ namespace OpenTK.OpenGL } public static - void MultiDrawArray(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] Int32[] count, Int32 primcount) + void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] Int32[] count, Int32 primcount) { unsafe { @@ -24918,7 +24918,7 @@ namespace OpenTK.OpenGL } public static - void MultiDrawArray(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] out Int32 count, Int32 primcount) + void MultiDrawArrays(GL.Enums.BeginMode mode, [Out] out Int32 first, [Out] out Int32 count, Int32 primcount) { unsafe { @@ -29176,6 +29176,16 @@ namespace OpenTK.OpenGL unsafe { Delegates.glGetBooleanIndexedvEXT((GL.Enums.EXT_draw_buffers2)target, (UInt32)index, (GL.Enums.Boolean*)data); } } + [System.CLSCompliant(false)] + public static + unsafe void GetBooleanIndexed(GL.Enums.EXT_draw_buffers2 target, Int32 index, [Out] GL.Enums.Boolean* data) + { + unsafe + { + Delegates.glGetBooleanIndexedvEXT((GL.Enums.EXT_draw_buffers2)target, (UInt32)index, (GL.Enums.Boolean*)data); + } + } + [System.CLSCompliant(false)] public static unsafe void GetIntegerIndexed(GL.Enums.EXT_draw_buffers2 target, UInt32 index, [Out] Int32* data) @@ -29183,6 +29193,16 @@ namespace OpenTK.OpenGL unsafe { Delegates.glGetIntegerIndexedvEXT((GL.Enums.EXT_draw_buffers2)target, (UInt32)index, (Int32*)data); } } + [System.CLSCompliant(false)] + public static + unsafe void GetIntegerIndexed(GL.Enums.EXT_draw_buffers2 target, Int32 index, [Out] Int32* data) + { + unsafe + { + Delegates.glGetIntegerIndexedvEXT((GL.Enums.EXT_draw_buffers2)target, (UInt32)index, (Int32*)data); + } + } + [System.CLSCompliant(false)] public static void GetIntegerIndexed(GL.Enums.EXT_draw_buffers2 target, UInt32 index, [Out] Int32[] data) @@ -29196,6 +29216,18 @@ namespace OpenTK.OpenGL } } + public static + void GetIntegerIndexed(GL.Enums.EXT_draw_buffers2 target, Int32 index, [Out] Int32[] data) + { + unsafe + { + fixed (Int32* data_ptr = data) + { + Delegates.glGetIntegerIndexedvEXT((GL.Enums.EXT_draw_buffers2)target, (UInt32)index, (Int32*)data_ptr); + } + } + } + [System.CLSCompliant(false)] public static void GetIntegerIndexed(GL.Enums.EXT_draw_buffers2 target, UInt32 index, [Out] out Int32 data) @@ -29210,6 +29242,19 @@ namespace OpenTK.OpenGL } } + public static + void GetIntegerIndexed(GL.Enums.EXT_draw_buffers2 target, Int32 index, [Out] out Int32 data) + { + unsafe + { + fixed (Int32* data_ptr = &data) + { + Delegates.glGetIntegerIndexedvEXT((GL.Enums.EXT_draw_buffers2)target, (UInt32)index, (Int32*)data_ptr); + data = *data_ptr; + } + } + } + [System.CLSCompliant(false)] public static void EnableIndexe(GL.Enums.EXT_draw_buffers2 target, UInt32 index) @@ -51785,7 +51830,7 @@ namespace OpenTK.OpenGL } public static - void DrawMeshArray(GL.Enums.BeginMode mode, Int32 first, Int32 count, Int32 width) + void DrawMeshArrays(GL.Enums.BeginMode mode, Int32 first, Int32 count, Int32 width) { Delegates.glDrawMeshArraysSUN((GL.Enums.BeginMode)mode, (Int32)first, (Int32)count, (Int32)width); } @@ -61798,14 +61843,14 @@ namespace OpenTK.OpenGL { [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode* mode, Int32* first, Int32* count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode* mode, Int32* first, Int32* count, Int32 primcount, Int32 modestride) { unsafe { Delegates.glMultiModeDrawArraysIBM((GL.Enums.BeginMode*)mode, (Int32*)first, (Int32*)count, (Int32)primcount, (Int32)modestride); } } [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode* mode, Int32* first, Int32[] count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode* mode, Int32* first, Int32[] count, Int32 primcount, Int32 modestride) { unsafe { @@ -61818,7 +61863,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode* mode, Int32* first, ref Int32 count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode* mode, Int32* first, ref Int32 count, Int32 primcount, Int32 modestride) { unsafe { @@ -61831,7 +61876,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode* mode, Int32[] first, Int32* count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode* mode, Int32[] first, Int32* count, Int32 primcount, Int32 modestride) { unsafe { @@ -61844,7 +61889,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode* mode, Int32[] first, Int32[] count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode* mode, Int32[] first, Int32[] count, Int32 primcount, Int32 modestride) { unsafe { @@ -61858,7 +61903,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode* mode, Int32[] first, ref Int32 count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode* mode, Int32[] first, ref Int32 count, Int32 primcount, Int32 modestride) { unsafe { @@ -61872,7 +61917,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode* mode, ref Int32 first, Int32* count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode* mode, ref Int32 first, Int32* count, Int32 primcount, Int32 modestride) { unsafe { @@ -61885,7 +61930,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode* mode, ref Int32 first, Int32[] count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode* mode, ref Int32 first, Int32[] count, Int32 primcount, Int32 modestride) { unsafe { @@ -61899,7 +61944,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode* mode, ref Int32 first, ref Int32 count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode* mode, ref Int32 first, ref Int32 count, Int32 primcount, Int32 modestride) { unsafe { @@ -61913,7 +61958,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode[] mode, Int32* first, Int32* count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode[] mode, Int32* first, Int32* count, Int32 primcount, Int32 modestride) { unsafe { @@ -61926,7 +61971,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode[] mode, Int32* first, Int32[] count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode[] mode, Int32* first, Int32[] count, Int32 primcount, Int32 modestride) { unsafe { @@ -61940,7 +61985,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode[] mode, Int32* first, ref Int32 count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode[] mode, Int32* first, ref Int32 count, Int32 primcount, Int32 modestride) { unsafe { @@ -61954,7 +61999,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode[] mode, Int32[] first, Int32* count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode[] mode, Int32[] first, Int32* count, Int32 primcount, Int32 modestride) { unsafe { @@ -61967,7 +62012,7 @@ namespace OpenTK.OpenGL } public static - void MultiModeDrawArray(GL.Enums.BeginMode[] mode, Int32[] first, Int32[] count, Int32 primcount, Int32 modestride) + void MultiModeDrawArrays(GL.Enums.BeginMode[] mode, Int32[] first, Int32[] count, Int32 primcount, Int32 modestride) { unsafe { @@ -61981,7 +62026,7 @@ namespace OpenTK.OpenGL } public static - void MultiModeDrawArray(GL.Enums.BeginMode[] mode, Int32[] first, ref Int32 count, Int32 primcount, Int32 modestride) + void MultiModeDrawArrays(GL.Enums.BeginMode[] mode, Int32[] first, ref Int32 count, Int32 primcount, Int32 modestride) { unsafe { @@ -61996,7 +62041,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(GL.Enums.BeginMode[] mode, ref Int32 first, Int32* count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(GL.Enums.BeginMode[] mode, ref Int32 first, Int32* count, Int32 primcount, Int32 modestride) { unsafe { @@ -62009,7 +62054,7 @@ namespace OpenTK.OpenGL } public static - void MultiModeDrawArray(GL.Enums.BeginMode[] mode, ref Int32 first, Int32[] count, Int32 primcount, Int32 modestride) + void MultiModeDrawArrays(GL.Enums.BeginMode[] mode, ref Int32 first, Int32[] count, Int32 primcount, Int32 modestride) { unsafe { @@ -62023,7 +62068,7 @@ namespace OpenTK.OpenGL } public static - void MultiModeDrawArray(GL.Enums.BeginMode[] mode, ref Int32 first, ref Int32 count, Int32 primcount, Int32 modestride) + void MultiModeDrawArrays(GL.Enums.BeginMode[] mode, ref Int32 first, ref Int32 count, Int32 primcount, Int32 modestride) { unsafe { @@ -62038,7 +62083,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(ref GL.Enums.BeginMode mode, Int32* first, Int32* count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(ref GL.Enums.BeginMode mode, Int32* first, Int32* count, Int32 primcount, Int32 modestride) { unsafe { @@ -62051,7 +62096,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(ref GL.Enums.BeginMode mode, Int32* first, Int32[] count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(ref GL.Enums.BeginMode mode, Int32* first, Int32[] count, Int32 primcount, Int32 modestride) { unsafe { @@ -62065,7 +62110,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(ref GL.Enums.BeginMode mode, Int32* first, ref Int32 count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(ref GL.Enums.BeginMode mode, Int32* first, ref Int32 count, Int32 primcount, Int32 modestride) { unsafe { @@ -62079,7 +62124,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(ref GL.Enums.BeginMode mode, Int32[] first, Int32* count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(ref GL.Enums.BeginMode mode, Int32[] first, Int32* count, Int32 primcount, Int32 modestride) { unsafe { @@ -62092,7 +62137,7 @@ namespace OpenTK.OpenGL } public static - void MultiModeDrawArray(ref GL.Enums.BeginMode mode, Int32[] first, Int32[] count, Int32 primcount, Int32 modestride) + void MultiModeDrawArrays(ref GL.Enums.BeginMode mode, Int32[] first, Int32[] count, Int32 primcount, Int32 modestride) { unsafe { @@ -62106,7 +62151,7 @@ namespace OpenTK.OpenGL } public static - void MultiModeDrawArray(ref GL.Enums.BeginMode mode, Int32[] first, ref Int32 count, Int32 primcount, Int32 modestride) + void MultiModeDrawArrays(ref GL.Enums.BeginMode mode, Int32[] first, ref Int32 count, Int32 primcount, Int32 modestride) { unsafe { @@ -62121,7 +62166,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void MultiModeDrawArray(ref GL.Enums.BeginMode mode, ref Int32 first, Int32* count, Int32 primcount, Int32 modestride) + unsafe void MultiModeDrawArrays(ref GL.Enums.BeginMode mode, ref Int32 first, Int32* count, Int32 primcount, Int32 modestride) { unsafe { @@ -62134,7 +62179,7 @@ namespace OpenTK.OpenGL } public static - void MultiModeDrawArray(ref GL.Enums.BeginMode mode, ref Int32 first, Int32[] count, Int32 primcount, Int32 modestride) + void MultiModeDrawArrays(ref GL.Enums.BeginMode mode, ref Int32 first, Int32[] count, Int32 primcount, Int32 modestride) { unsafe { @@ -62148,7 +62193,7 @@ namespace OpenTK.OpenGL } public static - void MultiModeDrawArray(ref GL.Enums.BeginMode mode, ref Int32 first, ref Int32 count, Int32 primcount, Int32 modestride) + void MultiModeDrawArrays(ref GL.Enums.BeginMode mode, ref Int32 first, ref Int32 count, Int32 primcount, Int32 modestride) { unsafe { @@ -65211,14 +65256,14 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void DeleteVertexArray(Int32 n, UInt32* arrays) + unsafe void DeleteVertexArrays(Int32 n, UInt32* arrays) { unsafe { Delegates.glDeleteVertexArraysAPPLE((Int32)n, (UInt32*)arrays); } } [System.CLSCompliant(false)] public static - unsafe void DeleteVertexArray(Int32 n, Int32* arrays) + unsafe void DeleteVertexArrays(Int32 n, Int32* arrays) { unsafe { @@ -65228,7 +65273,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - void DeleteVertexArray(Int32 n, UInt32[] arrays) + void DeleteVertexArrays(Int32 n, UInt32[] arrays) { unsafe { @@ -65240,7 +65285,7 @@ namespace OpenTK.OpenGL } public static - void DeleteVertexArray(Int32 n, Int32[] arrays) + void DeleteVertexArrays(Int32 n, Int32[] arrays) { unsafe { @@ -65253,7 +65298,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - void DeleteVertexArray(Int32 n, ref UInt32 arrays) + void DeleteVertexArrays(Int32 n, ref UInt32 arrays) { unsafe { @@ -65265,7 +65310,7 @@ namespace OpenTK.OpenGL } public static - void DeleteVertexArray(Int32 n, ref Int32 arrays) + void DeleteVertexArrays(Int32 n, ref Int32 arrays) { unsafe { @@ -65278,14 +65323,14 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - unsafe void GenVertexArray(Int32 n, [Out] UInt32* arrays) + unsafe void GenVertexArrays(Int32 n, [Out] UInt32* arrays) { unsafe { Delegates.glGenVertexArraysAPPLE((Int32)n, (UInt32*)arrays); } } [System.CLSCompliant(false)] public static - unsafe void GenVertexArray(Int32 n, [Out] Int32* arrays) + unsafe void GenVertexArrays(Int32 n, [Out] Int32* arrays) { unsafe { @@ -65295,7 +65340,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - void GenVertexArray(Int32 n, [Out] UInt32[] arrays) + void GenVertexArrays(Int32 n, [Out] UInt32[] arrays) { unsafe { @@ -65307,7 +65352,7 @@ namespace OpenTK.OpenGL } public static - void GenVertexArray(Int32 n, [Out] Int32[] arrays) + void GenVertexArrays(Int32 n, [Out] Int32[] arrays) { unsafe { @@ -65320,7 +65365,7 @@ namespace OpenTK.OpenGL [System.CLSCompliant(false)] public static - void GenVertexArray(Int32 n, [Out] out UInt32 arrays) + void GenVertexArrays(Int32 n, [Out] out UInt32 arrays) { unsafe { @@ -65333,7 +65378,7 @@ namespace OpenTK.OpenGL } public static - void GenVertexArray(Int32 n, [Out] out Int32 arrays) + void GenVertexArrays(Int32 n, [Out] out Int32 arrays) { unsafe { diff --git a/Source/OpenTK/OpenGL/Bindings/GLCore.cs b/Source/OpenTK/OpenGL/Bindings/GLCore.cs index 8bf3aa72..2b4db72e 100644 --- a/Source/OpenTK/OpenGL/Bindings/GLCore.cs +++ b/Source/OpenTK/OpenGL/Bindings/GLCore.cs @@ -6,9 +6,8 @@ namespace OpenTK.OpenGL partial class GL { - internal static class Imports + internal static partial class Imports { - static Imports() { } [System.Security.SuppressUnmanagedCodeSecurity()] [System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glNewList", ExactSpelling = true)] diff --git a/Source/OpenTK/OpenGL/Bindings/GLDelegates.cs b/Source/OpenTK/OpenGL/Bindings/GLDelegates.cs index c009b277..83aa5943 100644 --- a/Source/OpenTK/OpenGL/Bindings/GLDelegates.cs +++ b/Source/OpenTK/OpenGL/Bindings/GLDelegates.cs @@ -6,11 +6,8 @@ namespace OpenTK.OpenGL partial class GL { - internal static class Delegates + internal static partial class Delegates { - static Delegates() - { - } [System.Security.SuppressUnmanagedCodeSecurity()] internal delegate void NewList(UInt32 list, GL.Enums.ListMode mode); diff --git a/Source/OpenTK/OpenGL/GLHelper.cs b/Source/OpenTK/OpenGL/GLHelper.cs index b2742f3b..1ae55045 100644 --- a/Source/OpenTK/OpenGL/GLHelper.cs +++ b/Source/OpenTK/OpenGL/GLHelper.cs @@ -13,6 +13,7 @@ using System.Runtime.InteropServices; using System.Reflection; using OpenTK.Platform; using System.Diagnostics; +using System.Reflection.Emit; #endregion @@ -52,18 +53,14 @@ namespace OpenTK.OpenGL /// formats. /// /// - /// You may retrieve the entry point for an OpenGL extension using the Gl.GetDelegateForExtensionMethod - /// and Gl.GetFunctionPointerForExtensionMethod methods. You may retrieve the entry point for an OpenGL - /// function using the Gl.GetDelegateForMethod method. All three methods are cross-platform. + /// You may retrieve the entry point for an OpenGL function using the GL.GetDelegate method. /// /// /// - /// - /// - /// - /// - /// - /// + /// + /// + /// + /// /// /// public static partial class GL @@ -76,18 +73,34 @@ namespace OpenTK.OpenGL importsClass = glClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic); } + partial class Imports + { + internal static SortedList import; // This is faster than either Dictionary or SortedDictionary + static Imports() + { + MethodInfo[] methods = importsClass.GetMethods(BindingFlags.Static | BindingFlags.NonPublic); + import = new SortedList(methods.Length); + foreach (MethodInfo m in methods) + { + import.Add(m.Name, m); + } + } + } + #region --- Fields --- internal const string Library = "opengl32.dll"; - private static System.Collections.Generic.Dictionary AvailableExtensions = new Dictionary(); + //private static Dictionary AvailableExtensions = new Dictionary(); + private static SortedList AvailableExtensions = new SortedList(); private static bool rebuildExtensionList; private static Assembly assembly; private static Type glClass; private static Type delegatesClass; private static Type importsClass; - + private static FieldInfo[] delegates; + #endregion #region public static bool SupportsExtension(string name) @@ -109,7 +122,8 @@ namespace OpenTK.OpenGL // strings "1.0" to "2.1" with "GL_VERSION_1_0" to "GL_VERSION_2_1" if (AvailableExtensions.ContainsKey(name)) { - return AvailableExtensions[name]; + //return AvailableExtensions[name]; + return true; } return false; @@ -125,7 +139,7 @@ namespace OpenTK.OpenGL private static void BuildExtensionList() { // Assumes there is an opengl context current. - + AvailableExtensions.Clear(); string version_string = GL.GetString(OpenTK.OpenGL.GL.Enums.StringName.VERSION); if (String.IsNullOrEmpty(version_string)) { @@ -202,11 +216,11 @@ namespace OpenTK.OpenGL /// public static Delegate GetDelegate(string name, Type signature) { - //MethodInfo m = importsClass.GetMethod(name.Substring(2), BindingFlags.Static | BindingFlags.NonPublic); MethodInfo m; return Utilities.GetExtensionDelegate(name, signature) ?? - ((m = importsClass.GetMethod(name.Substring(2), BindingFlags.Static | BindingFlags.NonPublic)) != null ? + /*((m = importsClass.GetMethod(name.Substring(2), BindingFlags.Static | BindingFlags.NonPublic)) != null ?*/ + (Imports.import.TryGetValue((name.Substring(2)), out m) ? Delegate.CreateDelegate(signature, m) : null); } @@ -229,39 +243,41 @@ namespace OpenTK.OpenGL /// public static void LoadAll() { - FieldInfo[] v = delegatesClass.GetFields(BindingFlags.Static | BindingFlags.NonPublic); int supported = 0; + if (delegates == null) + { + delegates = delegatesClass.GetFields(BindingFlags.Static | BindingFlags.NonPublic); + } - Debug.Print("Will now try to load all {0} opengl functions.", v.Length); + Debug.Print("GL.LoadAll(): Loading all {0} OpenGL functions.", delegates.Length); System.Diagnostics.Stopwatch time = new System.Diagnostics.Stopwatch(); time.Reset(); time.Start(); - foreach (FieldInfo f in v) + foreach (FieldInfo f in delegates) { Delegate d = GetDelegate(f.Name, f.FieldType); if (d != null) { ++supported; } - - f.SetValue(null, d); - //Type type = f.ReflectedType; - //TypedReference t = __makeref(type); - //f.SetValueDirect(t, d); + f.SetValue(null, d); } time.Stop(); - Trace.WriteLine(String.Format("OpenGL extensions loaded in {0} milliseconds.", time.ElapsedMilliseconds)); - Debug.Print("Total supported functions: {0}.", supported); + Trace.WriteLine(String.Format("{0} OpenGL extensions loaded in {1} milliseconds.", supported, time.ElapsedMilliseconds)); time.Reset(); - AvailableExtensions.Clear(); rebuildExtensionList = true; } + static void set(object d, Delegate value) + { + d = value; + } + #endregion #region public static bool Load(string function) @@ -294,10 +310,15 @@ namespace OpenTK.OpenGL if (f == null) return false; - f.SetValue(null, GetDelegate(f.Name, f.FieldType)); - rebuildExtensionList = true; - - return f.GetValue(null) != null; + Delegate old = f.GetValue(null) as Delegate; + Delegate @new = f.GetValue(null) as Delegate; + if (old.Target != @new.Target) + { + f.SetValue(null, @new); + rebuildExtensionList = true; + return true; + } + return false; } #endregion @@ -320,7 +341,7 @@ namespace OpenTK.OpenGL public static void ClearColor(System.Drawing.Color color) { - ClearColor(color.R/255.0f, color.G/255.0f, color.B/255.0f, color.A/255.0f); + GL.ClearColor(color.R/255.0f, color.G/255.0f, color.B/255.0f, color.A/255.0f); } #endregion