Sped up GL.LoadAll() and GL.Load() functions.

This commit is contained in:
the_fiddler 2007-09-05 19:53:48 +00:00
parent e74cfac148
commit 184b3cee0d
5 changed files with 172 additions and 102 deletions

View file

@ -30,8 +30,16 @@ namespace OpenTK
/// </summary> /// </summary>
private void InitializeComponent() 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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.Name = "GLControl";
this.ResumeLayout(false);
} }
#endregion #endregion

View file

@ -5871,7 +5871,7 @@ namespace OpenTK.OpenGL
} }
public static 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); Delegates.glDrawArrays((GL.Enums.BeginMode)mode, (Int32)first, (Int32)count);
} }
@ -5980,13 +5980,13 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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); } unsafe { Delegates.glInterleavedArrays((GL.Enums.InterleavedArrayFormat)format, (Int32)stride, (void*)pointer); }
} }
public static 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 unsafe
{ {
@ -8594,14 +8594,14 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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); } unsafe { Delegates.glMultiDrawArrays((GL.Enums.BeginMode)mode, (Int32*)first, (Int32*)count, (Int32)primcount); }
} }
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -8614,7 +8614,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -8628,7 +8628,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -8640,7 +8640,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -8653,7 +8653,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -8668,7 +8668,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -8681,7 +8681,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -8695,7 +8695,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -23925,7 +23925,7 @@ namespace OpenTK.OpenGL
} }
public static 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); Delegates.glDrawArraysEXT((GL.Enums.BeginMode)mode, (Int32)first, (Int32)count);
} }
@ -24255,13 +24255,13 @@ namespace OpenTK.OpenGL
} }
public static public static
void LockArray(Int32 first, Int32 count) void LockArrays(Int32 first, Int32 count)
{ {
Delegates.glLockArraysEXT((Int32)first, (Int32)count); Delegates.glLockArraysEXT((Int32)first, (Int32)count);
} }
public static public static
void UnlockArray() void UnlockArrays()
{ {
Delegates.glUnlockArraysEXT(); Delegates.glUnlockArraysEXT();
} }
@ -24817,14 +24817,14 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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); } unsafe { Delegates.glMultiDrawArraysEXT((GL.Enums.BeginMode)mode, (Int32*)first, (Int32*)count, (Int32)primcount); }
} }
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -24837,7 +24837,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -24851,7 +24851,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -24863,7 +24863,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -24876,7 +24876,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -24891,7 +24891,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -24904,7 +24904,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -24918,7 +24918,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -29176,6 +29176,16 @@ namespace OpenTK.OpenGL
unsafe { Delegates.glGetBooleanIndexedvEXT((GL.Enums.EXT_draw_buffers2)target, (UInt32)index, (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 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)] [System.CLSCompliant(false)]
public static public static
unsafe void GetIntegerIndexed(GL.Enums.EXT_draw_buffers2 target, UInt32 index, [Out] Int32* data) 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); } 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)] [System.CLSCompliant(false)]
public static public static
void GetIntegerIndexed(GL.Enums.EXT_draw_buffers2 target, UInt32 index, [Out] Int32[] data) 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)] [System.CLSCompliant(false)]
public static public static
void GetIntegerIndexed(GL.Enums.EXT_draw_buffers2 target, UInt32 index, [Out] out Int32 data) 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)] [System.CLSCompliant(false)]
public static public static
void EnableIndexe(GL.Enums.EXT_draw_buffers2 target, UInt32 index) void EnableIndexe(GL.Enums.EXT_draw_buffers2 target, UInt32 index)
@ -51785,7 +51830,7 @@ namespace OpenTK.OpenGL
} }
public static 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); Delegates.glDrawMeshArraysSUN((GL.Enums.BeginMode)mode, (Int32)first, (Int32)count, (Int32)width);
} }
@ -61798,14 +61843,14 @@ namespace OpenTK.OpenGL
{ {
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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); } unsafe { Delegates.glMultiModeDrawArraysIBM((GL.Enums.BeginMode*)mode, (Int32*)first, (Int32*)count, (Int32)primcount, (Int32)modestride); }
} }
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61818,7 +61863,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61831,7 +61876,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61844,7 +61889,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61858,7 +61903,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61872,7 +61917,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61885,7 +61930,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61899,7 +61944,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61913,7 +61958,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61926,7 +61971,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61940,7 +61985,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61954,7 +61999,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -61967,7 +62012,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -61981,7 +62026,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -61996,7 +62041,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -62009,7 +62054,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -62023,7 +62068,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -62038,7 +62083,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -62051,7 +62096,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -62065,7 +62110,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -62079,7 +62124,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -62092,7 +62137,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -62106,7 +62151,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -62121,7 +62166,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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 unsafe
{ {
@ -62134,7 +62179,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -62148,7 +62193,7 @@ namespace OpenTK.OpenGL
} }
public static 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 unsafe
{ {
@ -65211,14 +65256,14 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static public static
unsafe void DeleteVertexArray(Int32 n, UInt32* arrays) unsafe void DeleteVertexArrays(Int32 n, UInt32* arrays)
{ {
unsafe { Delegates.glDeleteVertexArraysAPPLE((Int32)n, (UInt32*)arrays); } unsafe { Delegates.glDeleteVertexArraysAPPLE((Int32)n, (UInt32*)arrays); }
} }
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static public static
unsafe void DeleteVertexArray(Int32 n, Int32* arrays) unsafe void DeleteVertexArrays(Int32 n, Int32* arrays)
{ {
unsafe unsafe
{ {
@ -65228,7 +65273,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static public static
void DeleteVertexArray(Int32 n, UInt32[] arrays) void DeleteVertexArrays(Int32 n, UInt32[] arrays)
{ {
unsafe unsafe
{ {
@ -65240,7 +65285,7 @@ namespace OpenTK.OpenGL
} }
public static public static
void DeleteVertexArray(Int32 n, Int32[] arrays) void DeleteVertexArrays(Int32 n, Int32[] arrays)
{ {
unsafe unsafe
{ {
@ -65253,7 +65298,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static public static
void DeleteVertexArray(Int32 n, ref UInt32 arrays) void DeleteVertexArrays(Int32 n, ref UInt32 arrays)
{ {
unsafe unsafe
{ {
@ -65265,7 +65310,7 @@ namespace OpenTK.OpenGL
} }
public static public static
void DeleteVertexArray(Int32 n, ref Int32 arrays) void DeleteVertexArrays(Int32 n, ref Int32 arrays)
{ {
unsafe unsafe
{ {
@ -65278,14 +65323,14 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static 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); } unsafe { Delegates.glGenVertexArraysAPPLE((Int32)n, (UInt32*)arrays); }
} }
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static public static
unsafe void GenVertexArray(Int32 n, [Out] Int32* arrays) unsafe void GenVertexArrays(Int32 n, [Out] Int32* arrays)
{ {
unsafe unsafe
{ {
@ -65295,7 +65340,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static public static
void GenVertexArray(Int32 n, [Out] UInt32[] arrays) void GenVertexArrays(Int32 n, [Out] UInt32[] arrays)
{ {
unsafe unsafe
{ {
@ -65307,7 +65352,7 @@ namespace OpenTK.OpenGL
} }
public static public static
void GenVertexArray(Int32 n, [Out] Int32[] arrays) void GenVertexArrays(Int32 n, [Out] Int32[] arrays)
{ {
unsafe unsafe
{ {
@ -65320,7 +65365,7 @@ namespace OpenTK.OpenGL
[System.CLSCompliant(false)] [System.CLSCompliant(false)]
public static public static
void GenVertexArray(Int32 n, [Out] out UInt32 arrays) void GenVertexArrays(Int32 n, [Out] out UInt32 arrays)
{ {
unsafe unsafe
{ {
@ -65333,7 +65378,7 @@ namespace OpenTK.OpenGL
} }
public static public static
void GenVertexArray(Int32 n, [Out] out Int32 arrays) void GenVertexArrays(Int32 n, [Out] out Int32 arrays)
{ {
unsafe unsafe
{ {

View file

@ -6,9 +6,8 @@ namespace OpenTK.OpenGL
partial class GL partial class GL
{ {
internal static class Imports internal static partial class Imports
{ {
static Imports() { }
[System.Security.SuppressUnmanagedCodeSecurity()] [System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glNewList", ExactSpelling = true)] [System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glNewList", ExactSpelling = true)]

View file

@ -6,11 +6,8 @@ namespace OpenTK.OpenGL
partial class GL partial class GL
{ {
internal static class Delegates internal static partial class Delegates
{ {
static Delegates()
{
}
[System.Security.SuppressUnmanagedCodeSecurity()] [System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NewList(UInt32 list, GL.Enums.ListMode mode); internal delegate void NewList(UInt32 list, GL.Enums.ListMode mode);

View file

@ -13,6 +13,7 @@ using System.Runtime.InteropServices;
using System.Reflection; using System.Reflection;
using OpenTK.Platform; using OpenTK.Platform;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection.Emit;
#endregion #endregion
@ -52,18 +53,14 @@ namespace OpenTK.OpenGL
/// formats. /// formats.
/// </para> /// </para>
/// <para> /// <para>
/// You may retrieve the entry point for an OpenGL extension using the Gl.GetDelegateForExtensionMethod /// You may retrieve the entry point for an OpenGL function using the GL.GetDelegate method.
/// 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.
/// </para> /// </para>
/// <para> /// <para>
/// <see href="http://opengl.org/registry/"/> /// <see href="http://opengl.org/registry/"/>
/// <seealso cref="Gl.IsExtensionSupported(string, bool)"/> /// <seealso cref="GL.SupportsExtension"/>
/// <seealso cref="Gl.GetDelegateForExtensionMethod"/> /// <seealso cref="GL.GetDelegate"/>
/// <seealso cref="Gl.GetFunctionPointerForExtensionMethod"/> /// <seealso cref="GL.LoadAll"/>
/// <seealso cref="Gl.GetDelegateForMethod"/> /// <seealso cref="GL.Load"/>
/// <seealso cref="Gl.ReloadFunctions"/>
/// <seealso cref="Gl.ReloadFunction"/>
/// </para> /// </para>
/// </remarks> /// </remarks>
public static partial class GL public static partial class GL
@ -76,18 +73,34 @@ namespace OpenTK.OpenGL
importsClass = glClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic); importsClass = glClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic);
} }
partial class Imports
{
internal static SortedList<string, MethodInfo> import; // This is faster than either Dictionary or SortedDictionary
static Imports()
{
MethodInfo[] methods = importsClass.GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
import = new SortedList<string, MethodInfo>(methods.Length);
foreach (MethodInfo m in methods)
{
import.Add(m.Name, m);
}
}
}
#region --- Fields --- #region --- Fields ---
internal const string Library = "opengl32.dll"; internal const string Library = "opengl32.dll";
private static System.Collections.Generic.Dictionary<string, bool> AvailableExtensions = new Dictionary<string, bool>(); //private static Dictionary<string, bool> AvailableExtensions = new Dictionary<string, bool>();
private static SortedList<string, bool> AvailableExtensions = new SortedList<string, bool>();
private static bool rebuildExtensionList; private static bool rebuildExtensionList;
private static Assembly assembly; private static Assembly assembly;
private static Type glClass; private static Type glClass;
private static Type delegatesClass; private static Type delegatesClass;
private static Type importsClass; private static Type importsClass;
private static FieldInfo[] delegates;
#endregion #endregion
#region public static bool SupportsExtension(string name) #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" // strings "1.0" to "2.1" with "GL_VERSION_1_0" to "GL_VERSION_2_1"
if (AvailableExtensions.ContainsKey(name)) if (AvailableExtensions.ContainsKey(name))
{ {
return AvailableExtensions[name]; //return AvailableExtensions[name];
return true;
} }
return false; return false;
@ -125,7 +139,7 @@ namespace OpenTK.OpenGL
private static void BuildExtensionList() private static void BuildExtensionList()
{ {
// Assumes there is an opengl context current. // Assumes there is an opengl context current.
AvailableExtensions.Clear();
string version_string = GL.GetString(OpenTK.OpenGL.GL.Enums.StringName.VERSION); string version_string = GL.GetString(OpenTK.OpenGL.GL.Enums.StringName.VERSION);
if (String.IsNullOrEmpty(version_string)) if (String.IsNullOrEmpty(version_string))
{ {
@ -202,11 +216,11 @@ namespace OpenTK.OpenGL
/// </returns> /// </returns>
public static Delegate GetDelegate(string name, Type signature) public static Delegate GetDelegate(string name, Type signature)
{ {
//MethodInfo m = importsClass.GetMethod(name.Substring(2), BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo m; MethodInfo m;
return return
Utilities.GetExtensionDelegate(name, signature) ?? 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); Delegate.CreateDelegate(signature, m) : null);
} }
@ -229,39 +243,41 @@ namespace OpenTK.OpenGL
/// </remarks> /// </remarks>
public static void LoadAll() public static void LoadAll()
{ {
FieldInfo[] v = delegatesClass.GetFields(BindingFlags.Static | BindingFlags.NonPublic);
int supported = 0; 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(); System.Diagnostics.Stopwatch time = new System.Diagnostics.Stopwatch();
time.Reset(); time.Reset();
time.Start(); time.Start();
foreach (FieldInfo f in v) foreach (FieldInfo f in delegates)
{ {
Delegate d = GetDelegate(f.Name, f.FieldType); Delegate d = GetDelegate(f.Name, f.FieldType);
if (d != null) if (d != null)
{ {
++supported; ++supported;
} }
f.SetValue(null, d);
//Type type = f.ReflectedType; f.SetValue(null, d);
//TypedReference t = __makeref(type);
//f.SetValueDirect(t, d);
} }
time.Stop(); time.Stop();
Trace.WriteLine(String.Format("OpenGL extensions loaded in {0} milliseconds.", time.ElapsedMilliseconds)); Trace.WriteLine(String.Format("{0} OpenGL extensions loaded in {1} milliseconds.", supported, time.ElapsedMilliseconds));
Debug.Print("Total supported functions: {0}.", supported);
time.Reset(); time.Reset();
AvailableExtensions.Clear();
rebuildExtensionList = true; rebuildExtensionList = true;
} }
static void set(object d, Delegate value)
{
d = value;
}
#endregion #endregion
#region public static bool Load(string function) #region public static bool Load(string function)
@ -294,10 +310,15 @@ namespace OpenTK.OpenGL
if (f == null) if (f == null)
return false; return false;
f.SetValue(null, GetDelegate(f.Name, f.FieldType)); Delegate old = f.GetValue(null) as Delegate;
rebuildExtensionList = true; Delegate @new = f.GetValue(null) as Delegate;
if (old.Target != @new.Target)
return f.GetValue(null) != null; {
f.SetValue(null, @new);
rebuildExtensionList = true;
return true;
}
return false;
} }
#endregion #endregion
@ -320,7 +341,7 @@ namespace OpenTK.OpenGL
public static void ClearColor(System.Drawing.Color color) 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 #endregion