Merged with Bind. Added GLU bindings. Corrected OpenGL overload trimming.

This commit is contained in:
the_fiddler 2007-09-02 22:52:00 +00:00
parent 0555cc2716
commit a813684176
31 changed files with 68349 additions and 3525 deletions

View file

@ -51,14 +51,12 @@ namespace Bind.GL2
#endregion
#region IBind Members
#region public void Process()
public virtual void Process()
{
Function.endingsAddV =
new Regex(@"(Coord1|Attrib(I?)1(u?)|Stream1|Uniform2(u?)|Parameter|Fog(Coord)?.*|VertexWeight|(Fragment)?Light(Model)?|Material|ReplacementCodeu?b?|Tex(Gen|Env)|Indexu?b?)", RegexOptions.Compiled);
new Regex(@"(Coord1|Attrib(I?)1(u?)|Stream1|Uniform2(u?)|(Point|Convolution|Transform|Sprite|List|Combiner|Tex)Parameter|Fog(Coord)?.*|VertexWeight|(Fragment)?Light(Model)?|Material|ReplacementCodeu?b?|Tex(Gen|Env)|Indexu?.v)", RegexOptions.Compiled);
Bind.Structures.Type.Initialize(glTypemap, csTypemap);
@ -105,8 +103,6 @@ namespace Bind.GL2
#endregion
#endregion
#region private void Translate()
protected virtual void Translate()
@ -655,7 +651,7 @@ namespace Bind.GL2
#region void WriteImports
public void WriteImports(BindStreamWriter sw, DelegateCollection delegates)
public virtual void WriteImports(BindStreamWriter sw, DelegateCollection delegates)
{
Trace.WriteLine(String.Format("Writing imports to {0}.{1}", Settings.OutputNamespace, Settings.ImportsClass));
@ -717,7 +713,7 @@ namespace Bind.GL2
else
{
// Identifiers cannot start with a number:
sw.WriteLine("public static partial class {0}{1}", Settings.FunctionPrefix, key);
sw.WriteLine("public static partial class {0}{1}", Settings.ConstantPrefix, key);
}
sw.WriteLine("{");
sw.Indent();

View file

@ -1,4 +1,10 @@
using System;
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

View file

@ -1,4 +1,10 @@
using System;
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

View file

@ -70,7 +70,8 @@ namespace Bind
break;
case "mode":
string arg = b[1].ToLower();
mode =
mode =
arg == "gl" ? GeneratorMode.GL2 :
arg == "gl2" ? GeneratorMode.GL2 :
arg == "gl3" ? GeneratorMode.GL3 :
arg == "wgl" ? GeneratorMode.Wgl :

View file

@ -24,13 +24,10 @@ namespace Bind
public static string FunctionPrefix = "gl";
public static string ConstantPrefix = "GL_";
private static string enumsClass = "Enums";
public static string GLEnumsClass
{
get { return OutputClass + "." + enumsClass; }
set { enumsClass = value; }
public static string NestedEunmsClass = "Enums";
public static string NormalEnumsClass = OutputClass + "." + NestedEunmsClass;
public static string AuxEnumsClass = "GL." + NestedEunmsClass;
}
public static string DelegatesClass = "Delegates";
public static string ImportsClass = "Imports";

View file

@ -614,7 +614,7 @@ QueryHyperpipeAttribSGIX(dpy, timeSlice, attrib, size, returnAttribList)
param timeSlice int in value
param attrib int in value
param size int in value
param returnAttribList void in array[size]
param returnAttribList void out array[size] # Changed in to out
glxflags client-handcode server-handcode
category glx
dlflags notlistable

View file

@ -961,7 +961,7 @@ QueryHyperpipeBestAttribSGIX(dpy, timeSlice, attrib, size, attribList, returnAtt
param timeSlice int in value
param attrib int in value
param size int in value
param attribList void out array [COMPSIZE(size)]
param attribList void in array [COMPSIZE(size)] # Changed out to in
param returnAttribList void out array [COMPSIZE(size)]
glxflags client-handcode server-handcode
category SGIX_hyperpipe
@ -973,7 +973,7 @@ HyperpipeAttribSGIX(dpy, timeSlice, attrib, size, attribList)
param timeSlice int in value
param attrib int in value
param size int in value
param attribList void out array [COMPSIZE(size)]
param attribList void in array [COMPSIZE(size)] # Changed out to in
glxflags client-handcode server-handcode
category SGIX_hyperpipe
glxvendorglx ???

View file

@ -73,4 +73,14 @@ int32_t int
Display IntPtr
Window IntPtr
Pixmap IntPtr
__GLXextFuncPtr IntPtr
Colormap IntPtr
GLXWindow IntPtr
GLXContext IntPtr
GLXDrawable IntPtr
GLXPixmap IntPtr
__GLXextFuncPtr IntPtr
VLServer IntPtr
VLPath IntPtr
VLNode IntPtr

View file

@ -270,7 +270,7 @@ namespace Bind.Structures
sb.Append(".");
sb.Append(Settings.FunctionPrefix);
sb.Append(Name);
sb.Append(Parameters.CallString(Settings.Compatibility == Settings.Legacy.Tao));
sb.Append(Parameters.CallString());
return sb.ToString();
}
@ -338,7 +338,7 @@ namespace Bind.Structures
public void CreateWrappers()
{
if (this.Name.Contains("GenBuffers"))
if (this.Name.Contains("EndList"))
{
}
@ -465,30 +465,13 @@ namespace Bind.Structures
{
if (index == 0)
{
bool containsPointerParameters = false, containsReferenceParameters = false;
// Check if there are any IntPtr parameters (we may have come here from a ReturnType wrapper
// such as glGetString, which contains no IntPtr parameters)
foreach (Parameter p in function.Parameters)
{
if (p.Pointer)
{
containsPointerParameters = true;
break;
}
else if (p.Reference)
{
containsReferenceParameters = true;
break;
}
}
if (containsPointerParameters)
if (function.Parameters.HasPointerParameters)
{
wrappers.Add(DefaultWrapper(function));
}
else if (containsReferenceParameters)
{
}
//else if (containsReferenceParameters)
//{
//}
else
{
if (function.Body.Count == 0)
@ -627,6 +610,7 @@ namespace Bind.Structures
#region protected FunctionBody CreateBody(Function fun, bool wantCLSCompliance)
static List<string> handle_statements = new List<string>();
static List<string> handle_release_statements = new List<string>();
static List<string> fixed_statements = new List<string>();
static List<string> assign_statements = new List<string>();
@ -636,6 +620,7 @@ namespace Bind.Structures
f.Body.Clear();
handle_statements.Clear();
handle_release_statements.Clear();
fixed_statements.Clear();
assign_statements.Clear();
@ -644,7 +629,6 @@ namespace Bind.Structures
}
// Obtain pointers by pinning the parameters
int param = 0;
foreach (Parameter p in f.Parameters)
{
if (p.NeedsPin)
@ -654,17 +638,19 @@ namespace Bind.Structures
// Use GCHandle to obtain pointer to generic parameters and 'fixed' for arrays.
// This is because fixed can only take the address of fields, not managed objects.
handle_statements.Add(String.Format(
"{0} {1} = {0}.Alloc({2}, System.Runtime.InteropServices.GCHandleType.Pinned);",
"System.Runtime.InteropServices.GCHandle", p.Name + "_ptr", p.Name));
"{0} {1}_ptr = {0}.Alloc({1}, System.Runtime.InteropServices.GCHandleType.Pinned);",
"System.Runtime.InteropServices.GCHandle", p.Name));
handle_release_statements.Add(String.Format("{0}_ptr.Free();", p.Name));
if (p.Flow == Parameter.FlowDirection.Out)
{
assign_statements.Add(String.Format(
" {0} = ({1}){2}.Target;",
p.Name, p.CurrentType, p.Name + "_ptr"));
" {0} = ({1}){0}_ptr.Target;",
p.Name, p.CurrentType));
}
// Note! The following line modifies f.Parameters, *not* function.Parameters
// Note! The following line modifies f.Parameters, *not* this.Parameters
p.Name = "(void*)" + p.Name + "_ptr.AddrOfPinnedObject()";
}
else if (p.WrapperType == WrapperTypes.PointerParameter ||
@ -734,6 +720,7 @@ namespace Bind.Structures
f.Body.Add("return retval;");
}
// Free all allocated GCHandles
if (handle_statements.Count > 0)
{
f.Body.Unindent();
@ -741,14 +728,9 @@ namespace Bind.Structures
f.Body.Add("finally");
f.Body.Add("{");
f.Body.Indent();
// Free all allocated GCHandles
foreach (Parameter p in this.Parameters)
{
if (p.NeedsPin && p.WrapperType == WrapperTypes.GenericParameter)
{
f.Body.Add(String.Format(" {0}_ptr.Free();", p.Name));
}
}
f.Body.AddRange(handle_release_statements);
f.Body.Unindent();
f.Body.Add("}");
}
@ -817,7 +799,7 @@ namespace Bind.Structures
if (Settings.Compatibility == Settings.Legacy.None)
ReturnType.CurrentType =
String.Format("{0}.{1}",
Settings.GLEnumsClass,
Settings.NormalEnumsClass,
Settings.CompleteEnumName);
else
ReturnType.CurrentType = "int";

View file

@ -24,7 +24,7 @@ namespace Bind.Structures
{
Initialize(enumFile, enumextFile);
using (System.IO.StreamReader sr = new System.IO.StreamReader(Path.Combine(Settings.InputPath, "GL2\\enum.spec")))
using (System.IO.StreamReader sr = new System.IO.StreamReader(Path.Combine(Settings.InputPath, auxFile)))
{
AuxEnums = Bind.MainClass.Generator.ReadEnums(sr);
}

View file

@ -31,8 +31,8 @@ namespace Bind.Structures
#endregion
static Regex endings = new Regex(@"([df]|u?[isb])v?", RegexOptions.Compiled | RegexOptions.RightToLeft);
static Regex endingsNotToTrim = new Regex("(ib|[tdr]s|nd)", RegexOptions.Compiled | RegexOptions.RightToLeft);
static Regex endings = new Regex(@"((([df]|u?[isb])v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft);
static Regex endingsNotToTrim = new Regex("(ib|[tdre]s|[eE]n[vd])", RegexOptions.Compiled | RegexOptions.RightToLeft);
/// <summary>
/// Add a trailing v to functions matching this regex. Used to differntiate between overloads taking both
@ -172,22 +172,29 @@ namespace Bind.Structures
}
*/
if (!endingsNotToTrim.IsMatch(Name))
//if (Name.Contains("BooleanIndexed"))
{
}
Match m = endingsNotToTrim.Match(TrimmedName);
if ((m.Index + m.Length) != TrimmedName.Length)
{
// Some endings should not be trimmed, for example: 'b' from Attrib
Match m = endings.Match(TrimmedName);
m = endings.Match(TrimmedName);
if (m.Index + m.Length == TrimmedName.Length)
if (m.Length > 0 && m.Index + m.Length == TrimmedName.Length)
{ // Only trim endings, not internal matches.
if (m.Value[m.Length - 1] == 'v' && endingsAddV.IsMatch(Name))
if (m.Value[m.Length - 1] == 'v' && endingsAddV.IsMatch(Name) &&
!Name.StartsWith("Get") && !Name.StartsWith("MatrixIndex"))
{ // Only trim ending 'v' when there is a number
TrimmedName = TrimmedName.Substring(0, m.Index) + "v";
}
else
{
TrimmedName = TrimmedName.Substring(0, m.Index);
if (!TrimmedName.EndsWith("xedv"))
TrimmedName = TrimmedName.Substring(0, m.Index);
else
TrimmedName = TrimmedName.Substring(0, m.Index + 1);
}
}
}

View file

@ -250,16 +250,33 @@ namespace Bind.Structures
Enum @enum;
string s;
Parameter p = new Parameter(par);
// Try to find out if it is an enum. If the type exists in the normal GLEnums list, use this.
// Otherwise, try to find it in the aux enums list. If it exists in neither, it is not an enum.
bool normal = false;
bool aux = false;
normal = Enum.GLEnums.TryGetValue(p.CurrentType, out @enum);
if (!normal)
aux = Enum.AuxEnums != null && Enum.AuxEnums.TryGetValue(p.CurrentType, out @enum);
// Translate enum types
if ((Enum.GLEnums.TryGetValue(p.CurrentType, out @enum) ||
(Enum.AuxEnums != null && Enum.AuxEnums.TryGetValue(p.CurrentType, out @enum))) &&
@enum.Name != "GLenum")
if ((normal || aux) && @enum.Name != "GLenum")
{
if (Settings.Compatibility == Settings.Legacy.Tao)
{
p.CurrentType = "int";
}
else
p.CurrentType = p.CurrentType.Insert(0, String.Format("{0}.", Settings.GLEnumsClass));
{
if (normal)
{
p.CurrentType = p.CurrentType.Insert(0, String.Format("{0}.", Settings.NormalEnumsClass));
}
else if (aux)
{
p.CurrentType = p.CurrentType.Insert(0, String.Format("{0}.", Settings.AuxEnumsClass));
}
}
}
else if (Bind.Structures.Type.GLTypes.TryGetValue(p.CurrentType, out s))
{
@ -272,11 +289,11 @@ namespace Bind.Structures
// Better match: enum.Name == function.Category (e.g. GL_VERSION_1_1 etc)
if (Enum.GLEnums.ContainsKey(Category))
{
p.CurrentType = String.Format("{0}.{1}", Settings.GLEnumsClass, Category);
p.CurrentType = String.Format("{0}.{1}", Settings.NormalEnumsClass, Category);
}
else
{
p.CurrentType = String.Format("{0}.{1}", Settings.GLEnumsClass, Settings.CompleteEnumName);
p.CurrentType = String.Format("{0}.{1}", Settings.NormalEnumsClass, Settings.CompleteEnumName);
}
}
else
@ -304,6 +321,12 @@ namespace Bind.Structures
p.CurrentType = "GlyphMetricsFloat";
}
}
else if (p.CurrentType == "XVisualInfo")
{
//p.Pointer = false;
//p.Reference = true;
}
else
{
p.CurrentType = s;
@ -311,6 +334,11 @@ namespace Bind.Structures
p.CurrentType =
Bind.Structures.Type.CSTypes.ContainsKey(p.CurrentType) ?
Bind.Structures.Type.CSTypes[p.CurrentType] : p.CurrentType;
if (p.CurrentType == "IntPtr")
{
p.Pointer = false;
}
}
}
@ -356,8 +384,6 @@ namespace Bind.Structures
#endregion
}
#region ParameterCollection class
/// <summary>
/// Holds the parameter list of an opengl function.
/// </summary>
@ -365,7 +391,17 @@ namespace Bind.Structures
{
string cache = String.Empty;
string callStringCache = String.Empty;
bool rebuild = true;
private bool rebuild = true;
bool hasPointerParameters;
bool hasReferenceParameters;
private bool Rebuild
{
get { return rebuild; }
set
{
rebuild = value;
}
}
#region Constructors
@ -383,12 +419,68 @@ namespace Bind.Structures
#endregion
void BuildCache()
{
BuildCallStringCache();
BuildToStringCache();
BuildReferenceAndPointerParametersCache();
Rebuild = false;
}
public bool HasPointerParameters
{
get
{
if (!rebuild)
{
return hasPointerParameters;
}
else
{
BuildCache();
return hasPointerParameters;
}
}
}
public bool HasReferenceParameters
{
get
{
if (!Rebuild)
{
return hasReferenceParameters;
}
else
{
BuildCache();
return hasReferenceParameters;
}
}
}
void BuildReferenceAndPointerParametersCache()
{
foreach (Parameter p in this)
{
if (p.Pointer)
hasPointerParameters = true;
if (p.Reference)
hasReferenceParameters = true;
}
}
#region new public void Add(Parameter p)
new public void Add(Parameter p)
{
rebuild = true;
Rebuild = true;
base.Add(p);
}
#endregion
#region override public string ToString()
/// <summary>
@ -412,109 +504,129 @@ namespace Bind.Structures
/// <returns>The parameter list of an opengl function in the form ( [parameters] )</returns>
public string ToString(bool taoCompatible)
{
if (!rebuild)
if (!Rebuild)
{
return cache;
}
else
{
StringBuilder sb = new StringBuilder();
sb.Append("(");
if (this.Count > 0)
{
foreach (Parameter p in this)
{
if (taoCompatible)
{
sb.Append(p.ToString(true));
}
else
{
sb.Append(p.ToString());
}
sb.Append(", ");
}
sb.Replace(", ", ")", sb.Length - 2, 2);
}
else
sb.Append(")");
cache = sb.ToString();
BuildCache();
return cache;
}
}
#endregion
public string CallString()
#region void BuildToStringCache()
void BuildToStringCache()
{
return CallString(false);
StringBuilder sb = new StringBuilder();
sb.Append("(");
if (this.Count > 0)
{
foreach (Parameter p in this)
{
if (Settings.Compatibility == Settings.Legacy.Tao)
{
sb.Append(p.ToString(true));
}
else
{
sb.Append(p.ToString());
}
sb.Append(", ");
}
sb.Replace(", ", ")", sb.Length - 2, 2);
}
else
sb.Append(")");
cache = sb.ToString();
}
public string CallString(bool taoCompatible)
#endregion
#region public string CallString()
public string CallString()
{
if (!rebuild)
if (!Rebuild)
{
return callStringCache;
}
else
{
StringBuilder sb = new StringBuilder();
sb.Append("(");
if (this.Count > 0)
{
foreach (Parameter p in this)
{
if (p.Unchecked)
sb.Append("unchecked((" + p.CurrentType + ")");
if (p.CurrentType != "object")
{
if (p.CurrentType.ToLower().Contains("string"))
{
sb.Append(String.Format("({0}{1})",
p.CurrentType, (p.Array > 0) ? "[]" : ""));
}
else if (p.Pointer || p.Array > 0 || p.Reference)
{
sb.Append(String.Format("({0}*)",
p.CurrentType /*, (p.Pointer || p.Array > 0) ? "*" : ""*/));
}
//else if (p.Reference)
//{
// sb.Append(String.Format("{0} ({1})",
// p.Flow == Parameter.FlowDirection.Out ? "out" : "ref", p.CurrentType));
//}
else
{
sb.Append(String.Format("({0})", p.CurrentType));
}
}
sb.Append(
Utilities.Keywords.Contains(p.Name) ? "@" + p.Name : p.Name
);
if (p.Unchecked)
sb.Append(")");
sb.Append(", ");
}
sb.Replace(", ", ")", sb.Length - 2, 2);
}
else
{
sb.Append(")");
}
callStringCache = sb.ToString();
BuildCache();
return callStringCache;
}
}
#endregion
#region private void BuildCallStringCache()
/// <summary>
/// Builds a call string instance and caches it.
/// </summary>
private void BuildCallStringCache()
{
StringBuilder sb = new StringBuilder();
sb.Append("(");
if (this.Count > 0)
{
foreach (Parameter p in this)
{
if (p.Unchecked)
sb.Append("unchecked((" + p.CurrentType + ")");
if (p.CurrentType != "object")
{
if (p.CurrentType.ToLower().Contains("string"))
{
sb.Append(String.Format("({0}{1})",
p.CurrentType, (p.Array > 0) ? "[]" : ""));
}
else if (p.Pointer || p.Array > 0 || p.Reference)
{
sb.Append(String.Format("({0}*)",
p.CurrentType /*, (p.Pointer || p.Array > 0) ? "*" : ""*/));
}
//else if (p.Reference)
//{
// sb.Append(String.Format("{0} ({1})",
// p.Flow == Parameter.FlowDirection.Out ? "out" : "ref", p.CurrentType));
//}
else
{
sb.Append(String.Format("({0})", p.CurrentType));
}
}
sb.Append(
Utilities.Keywords.Contains(p.Name) ? "@" + p.Name : p.Name
);
if (p.Unchecked)
sb.Append(")");
sb.Append(", ");
}
sb.Replace(", ", ")", sb.Length - 2, 2);
}
else
{
sb.Append(")");
}
callStringCache = sb.ToString();
}
#endregion
public bool ContainsType(string type)
{
foreach (Parameter p in this)
@ -523,6 +635,4 @@ namespace Bind.Structures
return false;
}
}
#endregion
}

View file

@ -34,7 +34,7 @@ namespace Examples.Tests
{
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT);
GL.GetFloatv(GL.Enums.GetPName.PROJECTION_MATRIX, proj);
GL.GetFloat(GL.Enums.GetPName.PROJECTION_MATRIX, proj);
float sum = 0.0f;
for (int i = 0; i < 16; i++)
@ -44,7 +44,7 @@ namespace Examples.Tests
if (sum == 0)
{
throw new Exception("GetFloatv did not return anything!");
throw new Exception("GetFloat did not return anything!");
}

View file

@ -0,0 +1,39 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK;
using OpenTK.OpenGL;
namespace Examples.Tutorial
{
class T04_Lit_Cube : GameWindow, IExample
{
public T04_Lit_Cube()
{
CreateWindow(new DisplayMode(800, 600));
}
protected override void OnResize(OpenTK.Platform.ResizeEventArgs e)
{
base.OnResize(e);
//GL.ARB.
}
#region IExample Members
public void Launch()
{
this.Run();
}
#endregion
}
}

View file

@ -188,7 +188,7 @@ namespace Examples.Tutorial
private void LoadCube()
{
int size; // To check whether the buffers were uploaded correctly.
//GL.
// First, generate the buffer objects
GL.GenBuffers(1, out vbo);
GL.GenBuffers(1, out ibo);
@ -200,7 +200,7 @@ namespace Examples.Tutorial
(IntPtr)(vdata.Length * 4),
vdata,
GL.Enums.VERSION_1_5.STATIC_DRAW);
GL.GetBufferParameterv(
GL.GetBufferParameter(
GL.Enums.VERSION_1_5.ARRAY_BUFFER,
GL.Enums.VERSION_1_5.BUFFER_SIZE,
out size);
@ -217,7 +217,7 @@ namespace Examples.Tutorial
idata,
GL.Enums.VERSION_1_5.STATIC_DRAW
);
GL.GetBufferParameterv(
GL.GetBufferParameter(
GL.Enums.VERSION_1_5.ELEMENT_ARRAY_BUFFER,
GL.Enums.VERSION_1_5.BUFFER_SIZE,
out size);

View file

@ -66,7 +66,7 @@ namespace Examples.Tutorial
public override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// Check for necessary capabilities:
if (!GL.SupportsExtension("VERSION_2_0"))
{

View file

@ -1,4 +1,10 @@
using System;
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;

View file

@ -12,6 +12,7 @@ using System.Diagnostics;
using OpenTK.Platform;
using OpenTK.Input;
using System.Threading;
using OpenTK.OpenGL;
namespace OpenTK
{

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,189 @@
namespace OpenTK.OpenGL
{
using System;
using System.Runtime.InteropServices;
partial class Glu
{
internal static class Imports
{
static Imports() { }
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginCurve", ExactSpelling = true)]
internal extern static void BeginCurve(int nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginPolygon", ExactSpelling = true)]
internal extern static void BeginPolygon(int tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginSurface", ExactSpelling = true)]
internal extern static void BeginSurface(int nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginTrim", ExactSpelling = true)]
internal extern static void BeginTrim(int nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild1DMipmapLevels", ExactSpelling = true)]
internal extern static unsafe Int32 Build1DMipmapLevels(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, GL.Enums.PixelFormat format, GL.Enums.PixelType type, Int32 level, Int32 @base, Int32 max, void* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild1DMipmaps", ExactSpelling = true)]
internal extern static unsafe Int32 Build1DMipmaps(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, GL.Enums.PixelFormat format, GL.Enums.PixelType type, void* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild2DMipmapLevels", ExactSpelling = true)]
internal extern static unsafe Int32 Build2DMipmapLevels(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, GL.Enums.PixelFormat format, GL.Enums.PixelType type, Int32 level, Int32 @base, Int32 max, void* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild2DMipmaps", ExactSpelling = true)]
internal extern static unsafe Int32 Build2DMipmaps(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, GL.Enums.PixelFormat format, GL.Enums.PixelType type, void* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild3DMipmapLevels", ExactSpelling = true)]
internal extern static unsafe Int32 Build3DMipmapLevels(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, GL.Enums.PixelFormat format, GL.Enums.PixelType type, Int32 level, Int32 @base, Int32 max, void* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild3DMipmaps", ExactSpelling = true)]
internal extern static unsafe Int32 Build3DMipmaps(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, GL.Enums.PixelFormat format, GL.Enums.PixelType type, void* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluCheckExtension", ExactSpelling = true)]
internal extern static unsafe Boolean CheckExtension(Byte* extName, Byte* extString);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluCylinder", ExactSpelling = true)]
internal extern static void Cylinder(int quad, double @base, double top, double height, Int32 slices, Int32 stacks);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDeleteNurbsRenderer", ExactSpelling = true)]
internal extern static void DeleteNurbsRenderer(int nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDeleteQuadric", ExactSpelling = true)]
internal extern static void DeleteQuadric(int quad);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDeleteTess", ExactSpelling = true)]
internal extern static void DeleteTess(int tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDisk", ExactSpelling = true)]
internal extern static void Disk(int quad, double inner, double outer, Int32 slices, Int32 loops);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndCurve", ExactSpelling = true)]
internal extern static void EndCurve(int nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndPolygon", ExactSpelling = true)]
internal extern static void EndPolygon(int tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndSurface", ExactSpelling = true)]
internal extern static void EndSurface(int nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndTrim", ExactSpelling = true)]
internal extern static void EndTrim(int nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluErrorString", ExactSpelling = true)]
internal extern static IntPtr ErrorString(Glu.Enums.ErrorCode error);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluGetString", ExactSpelling = true)]
internal extern static IntPtr GetString(Glu.Enums.StringName name);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluGetNurbsProperty", ExactSpelling = true)]
internal extern static unsafe void GetNurbsProperty(int nurb, Glu.Enums.NurbsProperty property, [Out] float* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluGetTessProperty", ExactSpelling = true)]
internal extern static unsafe void GetTessProperty(int tess, Glu.Enums.TessProperty which, [Out] double* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluLoadSamplingMatrices", ExactSpelling = true)]
internal extern static unsafe void LoadSamplingMatrices(int nurb, float* model, float* perspective, Int32* view);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluLookAt", ExactSpelling = true)]
internal extern static void LookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNewNurbsRenderer", ExactSpelling = true)]
internal extern static int NewNurbsRenderer();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNewQuadric", ExactSpelling = true)]
internal extern static int NewQuadric();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNewTess", ExactSpelling = true)]
internal extern static int NewTess();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNextContour", ExactSpelling = true)]
internal extern static void NextContour(int tess, Glu.Enums.TessContour type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsCallback", ExactSpelling = true)]
internal extern static void NurbsCallback(int nurb, Glu.Enums.NurbsCallback which, IntPtr CallBackFunc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsCallbackData", ExactSpelling = true)]
internal extern static unsafe void NurbsCallbackData(int nurb, void* userData);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsCurve", ExactSpelling = true)]
internal extern static unsafe void NurbsCurve(int nurb, Int32 knotCount, [Out] float* knots, Int32 stride, [Out] float* control, Int32 order, GL.Enums.MapTarget type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsProperty", ExactSpelling = true)]
internal extern static void NurbsProperty(int nurb, Glu.Enums.NurbsProperty property, float value);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsSurface", ExactSpelling = true)]
internal extern static unsafe void NurbsSurface(int nurb, Int32 sKnotCount, float* sKnots, Int32 tKnotCount, float* tKnots, Int32 sStride, Int32 tStride, float* control, Int32 sOrder, Int32 tOrder, GL.Enums.MapTarget type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluOrtho2D", ExactSpelling = true)]
internal extern static void Ortho2D(double left, double right, double bottom, double top);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPartialDisk", ExactSpelling = true)]
internal extern static void PartialDisk(int quad, double inner, double outer, Int32 slices, Int32 loops, double start, double sweep);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPerspective", ExactSpelling = true)]
internal extern static void Perspective(double fovy, double aspect, double zNear, double zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPickMatrix", ExactSpelling = true)]
internal extern static unsafe void PickMatrix(double x, double y, double delX, double delY, [Out] Int32* viewport);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluProject", ExactSpelling = true)]
internal extern static unsafe Int32 Project(double objX, double objY, double objZ, double* model, double* proj, Int32* view, double* winX, double* winY, double* winZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPwlCurve", ExactSpelling = true)]
internal extern static unsafe void PwlCurve(int nurb, Int32 count, float* data, Int32 stride, Glu.Enums.NurbsTrim type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricCallback", ExactSpelling = true)]
internal extern static void QuadricCallback(int quad, Glu.Enums.QuadricCallback which, IntPtr CallBackFunc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricDrawStyle", ExactSpelling = true)]
internal extern static void QuadricDrawStyle(int quad, Glu.Enums.QuadricDrawStyle draw);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricNormals", ExactSpelling = true)]
internal extern static void QuadricNormals(int quad, Glu.Enums.QuadricNormal normal);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricOrientation", ExactSpelling = true)]
internal extern static void QuadricOrientation(int quad, Glu.Enums.QuadricOrientation orientation);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricTexture", ExactSpelling = true)]
internal extern static void QuadricTexture(int quad, Glu.Enums.Boolean texture);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluScaleImage", ExactSpelling = true)]
internal extern static unsafe Int32 ScaleImage(GL.Enums.PixelFormat format, Int32 wIn, Int32 hIn, GL.Enums.PixelType typeIn, void* dataIn, Int32 wOut, Int32 hOut, GL.Enums.PixelType typeOut, [Out] void* dataOut);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluSphere", ExactSpelling = true)]
internal extern static void Sphere(int quad, double radius, Int32 slices, Int32 stacks);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessBeginContour", ExactSpelling = true)]
internal extern static void TessBeginContour(int tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessBeginPolygon", ExactSpelling = true)]
internal extern static unsafe void TessBeginPolygon(int tess, void* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessCallback", ExactSpelling = true)]
internal extern static void TessCallback(int tess, Glu.Enums.TessCallback which, IntPtr CallBackFunc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessEndContour", ExactSpelling = true)]
internal extern static void TessEndContour(int tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessEndPolygon", ExactSpelling = true)]
internal extern static void TessEndPolygon(int tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessNormal", ExactSpelling = true)]
internal extern static void TessNormal(int tess, double valueX, double valueY, double valueZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessProperty", ExactSpelling = true)]
internal extern static void TessProperty(int tess, Glu.Enums.TessProperty which, double data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessVertex", ExactSpelling = true)]
internal extern static unsafe void TessVertex(int tess, [Out] double* location, void* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluUnProject", ExactSpelling = true)]
internal extern static unsafe Int32 UnProject(double winX, double winY, double winZ, double* model, double* proj, Int32* view, double* objX, double* objY, double* objZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluUnProject4", ExactSpelling = true)]
internal extern static unsafe Int32 UnProject4(double winX, double winY, double winZ, double clipW, double* model, double* proj, Int32* view, double near, double far, double* objX, double* objY, double* objZ, double* objW);
}
}
}

View file

@ -0,0 +1,197 @@
namespace OpenTK.OpenGL
{
using System;
using System.Runtime.InteropServices;
partial class Glu
{
internal static class Delegates
{
static Delegates()
{
}
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginCurve(int nurb);
internal static BeginCurve gluBeginCurve = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginPolygon(int tess);
internal static BeginPolygon gluBeginPolygon = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginSurface(int nurb);
internal static BeginSurface gluBeginSurface = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginTrim(int nurb);
internal static BeginTrim gluBeginTrim = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 Build1DMipmapLevels(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, GL.Enums.PixelFormat format, GL.Enums.PixelType type, Int32 level, Int32 @base, Int32 max, void* data);
internal unsafe static Build1DMipmapLevels gluBuild1DMipmapLevels = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 Build1DMipmaps(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, GL.Enums.PixelFormat format, GL.Enums.PixelType type, void* data);
internal unsafe static Build1DMipmaps gluBuild1DMipmaps = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 Build2DMipmapLevels(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, GL.Enums.PixelFormat format, GL.Enums.PixelType type, Int32 level, Int32 @base, Int32 max, void* data);
internal unsafe static Build2DMipmapLevels gluBuild2DMipmapLevels = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 Build2DMipmaps(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, GL.Enums.PixelFormat format, GL.Enums.PixelType type, void* data);
internal unsafe static Build2DMipmaps gluBuild2DMipmaps = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 Build3DMipmapLevels(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, GL.Enums.PixelFormat format, GL.Enums.PixelType type, Int32 level, Int32 @base, Int32 max, void* data);
internal unsafe static Build3DMipmapLevels gluBuild3DMipmapLevels = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 Build3DMipmaps(GL.Enums.TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, GL.Enums.PixelFormat format, GL.Enums.PixelType type, void* data);
internal unsafe static Build3DMipmaps gluBuild3DMipmaps = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Boolean CheckExtension(Byte* extName, Byte* extString);
internal unsafe static CheckExtension gluCheckExtension = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Cylinder(int quad, double @base, double top, double height, Int32 slices, Int32 stacks);
internal static Cylinder gluCylinder = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteNurbsRenderer(int nurb);
internal static DeleteNurbsRenderer gluDeleteNurbsRenderer = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteQuadric(int quad);
internal static DeleteQuadric gluDeleteQuadric = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteTess(int tess);
internal static DeleteTess gluDeleteTess = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Disk(int quad, double inner, double outer, Int32 slices, Int32 loops);
internal static Disk gluDisk = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndCurve(int nurb);
internal static EndCurve gluEndCurve = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndPolygon(int tess);
internal static EndPolygon gluEndPolygon = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndSurface(int nurb);
internal static EndSurface gluEndSurface = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndTrim(int nurb);
internal static EndTrim gluEndTrim = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr ErrorString(Glu.Enums.ErrorCode error);
internal static ErrorString gluErrorString = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetString(Glu.Enums.StringName name);
internal static GetString gluGetString = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetNurbsProperty(int nurb, Glu.Enums.NurbsProperty property, [Out] float* data);
internal unsafe static GetNurbsProperty gluGetNurbsProperty = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetTessProperty(int tess, Glu.Enums.TessProperty which, [Out] double* data);
internal unsafe static GetTessProperty gluGetTessProperty = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LoadSamplingMatrices(int nurb, float* model, float* perspective, Int32* view);
internal unsafe static LoadSamplingMatrices gluLoadSamplingMatrices = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ);
internal static LookAt gluLookAt = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int NewNurbsRenderer();
internal static NewNurbsRenderer gluNewNurbsRenderer = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int NewQuadric();
internal static NewQuadric gluNewQuadric = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int NewTess();
internal static NewTess gluNewTess = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NextContour(int tess, Glu.Enums.TessContour type);
internal static NextContour gluNextContour = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsCallback(int nurb, Glu.Enums.NurbsCallback which, IntPtr CallBackFunc);
internal static NurbsCallback gluNurbsCallback = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void NurbsCallbackData(int nurb, void* userData);
internal unsafe static NurbsCallbackData gluNurbsCallbackData = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void NurbsCallbackDataEXT(int nurb, void* userData);
internal unsafe static NurbsCallbackDataEXT gluNurbsCallbackDataEXT = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void NurbsCurve(int nurb, Int32 knotCount, [Out] float* knots, Int32 stride, [Out] float* control, Int32 order, GL.Enums.MapTarget type);
internal unsafe static NurbsCurve gluNurbsCurve = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsProperty(int nurb, Glu.Enums.NurbsProperty property, float value);
internal static NurbsProperty gluNurbsProperty = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void NurbsSurface(int nurb, Int32 sKnotCount, float* sKnots, Int32 tKnotCount, float* tKnots, Int32 sStride, Int32 tStride, float* control, Int32 sOrder, Int32 tOrder, GL.Enums.MapTarget type);
internal unsafe static NurbsSurface gluNurbsSurface = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Ortho2D(double left, double right, double bottom, double top);
internal static Ortho2D gluOrtho2D = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PartialDisk(int quad, double inner, double outer, Int32 slices, Int32 loops, double start, double sweep);
internal static PartialDisk gluPartialDisk = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Perspective(double fovy, double aspect, double zNear, double zFar);
internal static Perspective gluPerspective = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void PickMatrix(double x, double y, double delX, double delY, [Out] Int32* viewport);
internal unsafe static PickMatrix gluPickMatrix = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 Project(double objX, double objY, double objZ, double* model, double* proj, Int32* view, double* winX, double* winY, double* winZ);
internal unsafe static Project gluProject = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void PwlCurve(int nurb, Int32 count, float* data, Int32 stride, Glu.Enums.NurbsTrim type);
internal unsafe static PwlCurve gluPwlCurve = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricCallback(int quad, Glu.Enums.QuadricCallback which, IntPtr CallBackFunc);
internal static QuadricCallback gluQuadricCallback = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricDrawStyle(int quad, Glu.Enums.QuadricDrawStyle draw);
internal static QuadricDrawStyle gluQuadricDrawStyle = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricNormals(int quad, Glu.Enums.QuadricNormal normal);
internal static QuadricNormals gluQuadricNormals = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricOrientation(int quad, Glu.Enums.QuadricOrientation orientation);
internal static QuadricOrientation gluQuadricOrientation = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricTexture(int quad, Glu.Enums.Boolean texture);
internal static QuadricTexture gluQuadricTexture = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 ScaleImage(GL.Enums.PixelFormat format, Int32 wIn, Int32 hIn, GL.Enums.PixelType typeIn, void* dataIn, Int32 wOut, Int32 hOut, GL.Enums.PixelType typeOut, [Out] void* dataOut);
internal unsafe static ScaleImage gluScaleImage = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Sphere(int quad, double radius, Int32 slices, Int32 stacks);
internal static Sphere gluSphere = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessBeginContour(int tess);
internal static TessBeginContour gluTessBeginContour = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void TessBeginPolygon(int tess, void* data);
internal unsafe static TessBeginPolygon gluTessBeginPolygon = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessCallback(int tess, Glu.Enums.TessCallback which, IntPtr CallBackFunc);
internal static TessCallback gluTessCallback = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessEndContour(int tess);
internal static TessEndContour gluTessEndContour = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessEndPolygon(int tess);
internal static TessEndPolygon gluTessEndPolygon = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessNormal(int tess, double valueX, double valueY, double valueZ);
internal static TessNormal gluTessNormal = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessProperty(int tess, Glu.Enums.TessProperty which, double data);
internal static TessProperty gluTessProperty = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void TessVertex(int tess, [Out] double* location, void* data);
internal unsafe static TessVertex gluTessVertex = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 TexFilterFuncSGI(GL.Enums.TextureTarget target, Glu.Enums.Filter4TypeSGIS filtertype, float* parms, Int32 n, [Out] float* weights);
internal unsafe static TexFilterFuncSGI gluTexFilterFuncSGI = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 UnProject(double winX, double winY, double winZ, double* model, double* proj, Int32* view, double* objX, double* objY, double* objZ);
internal unsafe static UnProject gluUnProject = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 UnProject4(double winX, double winY, double winZ, double clipW, double* model, double* proj, Int32* view, double near, double far, double* objX, double* objY, double* objZ, double* objW);
internal unsafe static UnProject4 gluUnProject4 = null;
}
}
}

View file

@ -0,0 +1,402 @@
namespace OpenTK.OpenGL
{
public static partial class Glu
{
public class Enums
{
public enum Boolean
{
TRUE = ((int)1),
FALSE = ((int)0),
}
public enum Version
{
VERSION_1_1 = ((int)1),
VERSION_1_2 = ((int)1),
VERSION_1_3 = ((int)1),
}
public enum StringName
{
VERSION = ((int)100800),
EXTENSIONS = ((int)100801),
}
public enum ErrorCode
{
INVALID_ENUM = ((int)100900),
OUT_OF_MEMORY = ((int)100902),
INVALID_OPERATION = ((int)100904),
INVALID_VALUE = ((int)100901),
}
public enum Filter4TypeSGIS
{
LAGRANGIAN_SGI = ((int)100300),
MITCHELL_NETRAVALI_SGI = ((int)100301),
}
public enum NurbsDisplay
{
FILL = ((int)QuadricDrawStyle.FILL),
OUTLINE_POLYGON = ((int)100240),
OUTLINE_PATCH = ((int)100241),
}
public enum NurbsCallback
{
NURBS_END_DATA_EXT = ((int)100175),
NURBS_TEXTURE_COORD_DATA = ((int)100174),
NURBS_ERROR = ((int)100103),
NURBS_END = ((int)100169),
NURBS_NORMAL_DATA_EXT = ((int)100172),
NURBS_BEGIN_EXT = ((int)100164),
NURBS_BEGIN_DATA_EXT = ((int)100170),
NURBS_NORMAL_DATA = ((int)100172),
NURBS_BEGIN = ((int)100164),
NURBS_END_EXT = ((int)100169),
NURBS_VERTEX_DATA_EXT = ((int)100171),
NURBS_COLOR_DATA = ((int)100173),
NURBS_TEXTURE_COORD_DATA_EXT = ((int)100174),
NURBS_NORMAL_EXT = ((int)100166),
ERROR = ((int)100103),
NURBS_TEXTURE_COORD_EXT = ((int)100168),
NURBS_VERTEX = ((int)100165),
NURBS_BEGIN_DATA = ((int)100170),
NURBS_COLOR_DATA_EXT = ((int)100173),
NURBS_COLOR = ((int)100167),
NURBS_NORMAL = ((int)100166),
NURBS_VERTEX_DATA = ((int)100171),
NURBS_VERTEX_EXT = ((int)100165),
NURBS_END_DATA = ((int)100175),
NURBS_TEXTURE_COORD = ((int)100168),
NURBS_COLOR_EXT = ((int)100167),
}
public enum NurbsError
{
NURBS_ERROR3 = ((int)100253),
NURBS_ERROR9 = ((int)100259),
NURBS_ERROR4 = ((int)100254),
NURBS_ERROR10 = ((int)100260),
NURBS_ERROR11 = ((int)100261),
NURBS_ERROR12 = ((int)100262),
NURBS_ERROR13 = ((int)100263),
NURBS_ERROR14 = ((int)100264),
NURBS_ERROR15 = ((int)100265),
NURBS_ERROR16 = ((int)100266),
NURBS_ERROR17 = ((int)100267),
NURBS_ERROR18 = ((int)100268),
NURBS_ERROR19 = ((int)100269),
NURBS_ERROR5 = ((int)100255),
NURBS_ERROR1 = ((int)100251),
NURBS_ERROR20 = ((int)100270),
NURBS_ERROR21 = ((int)100271),
NURBS_ERROR22 = ((int)100272),
NURBS_ERROR23 = ((int)100273),
NURBS_ERROR24 = ((int)100274),
NURBS_ERROR25 = ((int)100275),
NURBS_ERROR26 = ((int)100276),
NURBS_ERROR27 = ((int)100277),
NURBS_ERROR28 = ((int)100278),
NURBS_ERROR29 = ((int)100279),
NURBS_ERROR6 = ((int)100256),
NURBS_ERROR30 = ((int)100280),
NURBS_ERROR31 = ((int)100281),
NURBS_ERROR32 = ((int)100282),
NURBS_ERROR33 = ((int)100283),
NURBS_ERROR34 = ((int)100284),
NURBS_ERROR35 = ((int)100285),
NURBS_ERROR36 = ((int)100286),
NURBS_ERROR37 = ((int)100287),
NURBS_ERROR7 = ((int)100257),
NURBS_ERROR2 = ((int)100252),
NURBS_ERROR8 = ((int)100258),
}
public enum NurbsProperty
{
CULLING = ((int)100201),
U_STEP = ((int)100206),
SAMPLING_METHOD = ((int)100205),
SAMPLING_TOLERANCE = ((int)100203),
NURBS_MODE = ((int)100160),
DISPLAY_MODE = ((int)100204),
NURBS_TESSELLATOR_EXT = ((int)100161),
NURBS_TESSELLATOR = ((int)100161),
V_STEP = ((int)100207),
PARAMETRIC_TOLERANCE = ((int)100202),
NURBS_RENDERER_EXT = ((int)100162),
AUTO_LOAD_MATRIX = ((int)100200),
NURBS_MODE_EXT = ((int)100160),
NURBS_RENDERER = ((int)100162),
}
public enum NurbsSampling
{
OBJECT_PATH_LENGTH_EXT = ((int)100209),
DOMAIN_DISTANCE = ((int)100217),
OBJECT_PARAMETRIC_ERROR = ((int)100208),
OBJECT_PATH_LENGTH = ((int)100209),
PATH_LENGTH = ((int)100215),
PARAMETRIC_ERROR = ((int)100216),
OBJECT_PARAMETRIC_ERROR_EXT = ((int)100208),
}
public enum NurbsTrim
{
MAP1_TRIM_3 = ((int)100211),
MAP1_TRIM_2 = ((int)100210),
}
public enum QuadricDrawStyle
{
FILL = ((int)100012),
SILHOUETTE = ((int)100013),
POINT = ((int)100010),
LINE = ((int)100011),
}
public enum QuadricCallback
{
ERROR = ((int)NurbsCallback.ERROR),
}
public enum QuadricNormal
{
FLAT = ((int)100001),
NONE = ((int)100002),
SMOOTH = ((int)100000),
}
public enum QuadricOrientation
{
INSIDE = ((int)100021),
OUTSIDE = ((int)100020),
}
public enum TessCallback
{
TESS_EDGE_FLAG_DATA = ((int)100110),
ERROR = ((int)100103),
TESS_COMBINE = ((int)100105),
TESS_BEGIN_DATA = ((int)100106),
TESS_ERROR_DATA = ((int)100109),
BEGIN = ((int)100100),
TESS_ERROR = ((int)100103),
TESS_EDGE_FLAG = ((int)100104),
TESS_END = ((int)100102),
TESS_BEGIN = ((int)100100),
TESS_VERTEX_DATA = ((int)100107),
TESS_VERTEX = ((int)100101),
END = ((int)100102),
VERTEX = ((int)100101),
EDGE_FLAG = ((int)100104),
TESS_END_DATA = ((int)100108),
TESS_COMBINE_DATA = ((int)100111),
}
public enum TessContour
{
CW = ((int)100120),
INTERIOR = ((int)100122),
EXTERIOR = ((int)100123),
UNKNOWN = ((int)100124),
CCW = ((int)100121),
}
public enum TessProperty
{
TESS_BOUNDARY_ONLY = ((int)100141),
TESS_TOLERANCE = ((int)100142),
TESS_WINDING_RULE = ((int)100140),
}
public enum TessError
{
TESS_MISSING_END_CONTOUR = ((int)100154),
TESS_COORD_TOO_LARGE = ((int)100155),
TESS_MISSING_BEGIN_POLYGON = ((int)100151),
TESS_MISSING_END_POLYGON = ((int)100153),
TESS_ERROR8 = ((int)100158),
TESS_ERROR7 = ((int)100157),
TESS_ERROR6 = ((int)100156),
TESS_ERROR5 = ((int)100155),
TESS_ERROR4 = ((int)100154),
TESS_ERROR3 = ((int)100153),
TESS_ERROR2 = ((int)100152),
TESS_ERROR1 = ((int)100151),
TESS_NEED_COMBINE_CALLBACK = ((int)100156),
TESS_MISSING_BEGIN_CONTOUR = ((int)100152),
}
public enum TessWinding
{
TESS_WINDING_NONZERO = ((int)100131),
TESS_WINDING_POSITIVE = ((int)100132),
TESS_WINDING_ODD = ((int)100130),
TESS_WINDING_ABS_GEQ_TWO = ((int)100134),
TESS_WINDING_NEGATIVE = ((int)100133),
}
public enum All
{
INTERIOR = ((int)100122),
NURBS_ERROR3 = ((int)100253),
TESS_WINDING_RULE = ((int)100140),
CCW = ((int)100121),
FALSE = ((int)0),
NURBS_BEGIN_DATA = ((int)100170),
UNKNOWN = ((int)100124),
NURBS_ERROR6 = ((int)100256),
NURBS_COLOR_DATA_EXT = ((int)100173),
NONE = ((int)100002),
NURBS_MODE = ((int)100160),
AUTO_LOAD_MATRIX = ((int)100200),
OBJECT_PATH_LENGTH = ((int)100209),
FILL = ((int)100012),
TESS_MISSING_BEGIN_POLYGON = ((int)100151),
V_STEP = ((int)100207),
NURBS_ERROR10 = ((int)100260),
NURBS_ERROR11 = ((int)100261),
NURBS_ERROR12 = ((int)100262),
NURBS_ERROR13 = ((int)100263),
NURBS_ERROR14 = ((int)100264),
NURBS_ERROR15 = ((int)100265),
NURBS_ERROR16 = ((int)100266),
NURBS_ERROR17 = ((int)100267),
NURBS_ERROR18 = ((int)100268),
NURBS_ERROR19 = ((int)100269),
OBJECT_PARAMETRIC_ERROR_EXT = ((int)100208),
NURBS_END_EXT = ((int)100169),
NURBS_NORMAL_EXT = ((int)100166),
MAP1_TRIM_3 = ((int)100211),
NURBS_RENDERER = ((int)100162),
TESS_BOUNDARY_ONLY = ((int)100141),
TESS_COORD_TOO_LARGE = ((int)100155),
NURBS_TEXTURE_COORD_DATA = ((int)100174),
NURBS_NORMAL = ((int)100166),
PATH_LENGTH = ((int)100215),
TESS_ERROR = ((int)100103),
NURBS_ERROR2 = ((int)100252),
NURBS_TEXTURE_COORD = ((int)100168),
TESS_ERROR8 = ((int)100158),
NURBS_TEXTURE_COORD_DATA_EXT = ((int)100174),
TESS_ERROR6 = ((int)100156),
TESS_ERROR5 = ((int)100155),
TESS_ERROR4 = ((int)100154),
TESS_ERROR3 = ((int)100153),
TESS_BEGIN = ((int)100100),
TESS_ERROR1 = ((int)100151),
SMOOTH = ((int)100000),
TESS_MISSING_END_POLYGON = ((int)100153),
NURBS_ERROR9 = ((int)100259),
NURBS_COLOR_DATA = ((int)100173),
BEGIN = ((int)100100),
OUTSIDE = ((int)100020),
PARAMETRIC_TOLERANCE = ((int)100202),
OUT_OF_MEMORY = ((int)100902),
TESS_WINDING_NEGATIVE = ((int)100133),
TESS_END = ((int)100102),
NURBS_ERROR30 = ((int)100280),
NURBS_ERROR31 = ((int)100281),
NURBS_ERROR32 = ((int)100282),
NURBS_ERROR33 = ((int)100283),
NURBS_ERROR34 = ((int)100284),
NURBS_ERROR35 = ((int)100285),
NURBS_ERROR36 = ((int)100286),
NURBS_ERROR37 = ((int)100287),
INSIDE = ((int)100021),
TESS_TOLERANCE = ((int)100142),
NURBS_ERROR27 = ((int)100277),
NURBS_END_DATA_EXT = ((int)100175),
SAMPLING_TOLERANCE = ((int)100203),
MITCHELL_NETRAVALI_SGI = ((int)100301),
NURBS_TESSELLATOR_EXT = ((int)100161),
ERROR = ((int)100103),
OUTLINE_POLYGON = ((int)100240),
POINT = ((int)100010),
TESS_COMBINE_DATA = ((int)100111),
NURBS_END = ((int)100169),
NURBS_ERROR5 = ((int)100255),
TESS_VERTEX = ((int)100101),
TESS_EDGE_FLAG = ((int)100104),
NURBS_NORMAL_DATA = ((int)100172),
INVALID_VALUE = ((int)100901),
VERSION = ((int)100800),
MAP1_TRIM_2 = ((int)100210),
NURBS_ERROR8 = ((int)100258),
NURBS_VERTEX_DATA = ((int)100171),
TESS_WINDING_ABS_GEQ_TWO = ((int)100134),
LINE = ((int)100011),
TESS_BEGIN_DATA = ((int)100106),
SAMPLING_METHOD = ((int)100205),
END = ((int)100102),
CW = ((int)100120),
DISPLAY_MODE = ((int)100204),
EDGE_FLAG = ((int)100104),
TESS_MISSING_BEGIN_CONTOUR = ((int)100152),
NURBS_COLOR = ((int)100167),
NURBS_TEXTURE_COORD_EXT = ((int)100168),
NURBS_ERROR20 = ((int)100270),
NURBS_ERROR21 = ((int)100271),
NURBS_ERROR22 = ((int)100272),
NURBS_ERROR23 = ((int)100273),
NURBS_ERROR24 = ((int)100274),
NURBS_ERROR25 = ((int)100275),
NURBS_ERROR26 = ((int)100276),
INVALID_OPERATION = ((int)100904),
NURBS_ERROR28 = ((int)100278),
NURBS_ERROR29 = ((int)100279),
NURBS_TESSELLATOR = ((int)100161),
OBJECT_PARAMETRIC_ERROR = ((int)100208),
NURBS_BEGIN_DATA_EXT = ((int)100170),
TESS_WINDING_NONZERO = ((int)100131),
OUTLINE_PATCH = ((int)100241),
VERSION_1_1 = ((int)1),
VERSION_1_2 = ((int)1),
VERSION_1_3 = ((int)1),
LAGRANGIAN_SGI = ((int)100300),
NURBS_ERROR1 = ((int)100251),
NURBS_VERTEX = ((int)100165),
SILHOUETTE = ((int)100013),
DOMAIN_DISTANCE = ((int)100217),
VERTEX = ((int)100101),
NURBS_ERROR4 = ((int)100254),
TESS_NEED_COMBINE_CALLBACK = ((int)100156),
NURBS_COLOR_EXT = ((int)100167),
NURBS_NORMAL_DATA_EXT = ((int)100172),
CULLING = ((int)100201),
NURBS_ERROR7 = ((int)100257),
NURBS_VERTEX_EXT = ((int)100165),
TESS_EDGE_FLAG_DATA = ((int)100110),
NURBS_BEGIN_EXT = ((int)100164),
OBJECT_PATH_LENGTH_EXT = ((int)100209),
NURBS_MODE_EXT = ((int)100160),
TESS_MISSING_END_CONTOUR = ((int)100154),
NURBS_VERTEX_DATA_EXT = ((int)100171),
NURBS_BEGIN = ((int)100164),
FLAT = ((int)100001),
NURBS_END_DATA = ((int)100175),
TESS_END_DATA = ((int)100108),
TESS_WINDING_POSITIVE = ((int)100132),
PARAMETRIC_ERROR = ((int)100216),
NURBS_RENDERER_EXT = ((int)100162),
NURBS_ERROR = ((int)100103),
TRUE = ((int)1),
EXTENSIONS = ((int)100801),
TESS_COMBINE = ((int)100105),
TESS_ERROR_DATA = ((int)100109),
INVALID_ENUM = ((int)100900),
U_STEP = ((int)100206),
TESS_VERTEX_DATA = ((int)100107),
TESS_ERROR7 = ((int)100157),
EXTERIOR = ((int)100123),
TESS_ERROR2 = ((int)100152),
TESS_WINDING_ODD = ((int)100130),
}
}
}
}

View file

@ -14,7 +14,8 @@ namespace OpenTK.OpenGL
/// <summary>
/// Provides access to GLU functions.
/// </summary>
public static partial class Glu
[Obsolete]
public static partial class GluOld
{
#region GLU functions

View file

@ -0,0 +1,207 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using OpenTK.Platform;
namespace OpenTK.OpenGL
{
public static partial class Glu
{
private const string Library = "glu32.dll";
private static Dictionary<string, bool> AvailableExtensions = new Dictionary<string, bool>();
private static bool rebuildExtensionList = true;
private static Assembly assembly;
private static Type glClass;
private static Type delegatesClass;
private static Type importsClass;
static Glu()
{
assembly = Assembly.GetExecutingAssembly();//Assembly.Load("OpenTK.OpenGL");
glClass = assembly.GetType("OpenTK.OpenGL.Glu");
delegatesClass = glClass.GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic);
importsClass = glClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic);
}
#region private static Delegate GetDelegate(string name, Type signature)
/// <summary>
/// Creates a System.Delegate that can be used to call a GLU function, core or extension.
/// </summary>
/// <param name="name">The name of the GLU function (eg. "gluBuild2DMipmaps")</param>
/// <param name="signature">The signature of the GLU function.</param>
/// <returns>
/// A System.Delegate that can be used to call this GLU function, or null if the specified
/// function name did not correspond to an GLU function.
/// </returns>
private static Delegate GetDelegate(string name, Type signature)
{
MethodInfo m = importsClass.GetMethod(name.Substring(3), BindingFlags.Static | BindingFlags.NonPublic);
return
Utilities.GetExtensionDelegate(name, signature) ??
(m != null ? Delegate.CreateDelegate(signature, m) : null);
}
#endregion
#region public static void LoadAll()
/// <summary>
/// Loads all GLU functions (core and extensions).
/// </summary>
/// <remarks>
/// <para>
/// Call this function manually whenever you need to update GLU entry points.
/// This need will never arise under normal usage patterns.
/// </para>
/// </remarks>
public static void LoadAll()
{
FieldInfo[] v = delegatesClass.GetFields(BindingFlags.Static | BindingFlags.NonPublic);
foreach (FieldInfo f in v)
{
f.SetValue(null, GetDelegate(f.Name, f.FieldType));
}
AvailableExtensions.Clear();
rebuildExtensionList = true;
}
#endregion
#region public static bool Load(string function)
/// <summary>
/// Tries to reload the given GLU function (core or extension).
/// </summary>
/// <param name="name">The name of the GLU function.</param>
/// <returns>True if the function was found and reloaded, false otherwise.</returns>
/// <remarks>
/// <para>
/// While the automatic initialisation will load all GLU entry points, in some cases
/// the initialization can take place before a render context has been established.
/// In this case, use this function to load the entry points for the GLU functions
/// you will need, or use LoadAll() to load all available entry points.
/// </para>
/// <para>
/// This function returns true if the given GLU function is supported, false otherwise.
/// </para>
/// <para>
/// To query for supported extensions use the IsExtensionSupported() function instead.
/// </para>
/// </remarks>
public static bool Load(string function)
{
FieldInfo f = delegatesClass.GetField(function);
if (f == null)
return false;
f.SetValue(null, GetDelegate(f.Name, f.FieldType));
rebuildExtensionList = true;
return f.GetValue(null) != null;
}
#endregion
#region public static bool SupportsExtension(string name)
/// <summary>
/// Determines whether the specified GLU extension is available in
/// the current GLU context.
/// </summary>
/// <param name="name">The string for the GLU extension.</param>
/// <returns>True if the specified extension is available, false otherwise.</returns>
public static bool SupportsExtension(string name)
{
if (rebuildExtensionList)
{
BuildExtensionList();
}
// Search the cache for the string. Note that the cache substitutes
// strings "1.0" to "2.1" with "GL_VERSION_1_0" to "GL_VERSION_2_1"
if (AvailableExtensions.ContainsKey(name))
{
return AvailableExtensions[name];
}
return false;
}
#endregion
#region private static void BuildExtensionList()
/// <summary>
/// Builds a cache of the supported extensions to speed up searches.
/// </summary>
private static void BuildExtensionList()
{
// Assumes there is an opengl context current.
AvailableExtensions.Clear();
string version_string = Glu.GetString(Enums.StringName.VERSION);
if (String.IsNullOrEmpty(version_string))
{
throw new ApplicationException("Failed to build extension list. Is there an opengl context current?");
}
string version = version_string.Trim(' ');
if (version.StartsWith("1.0"))
{
AvailableExtensions.Add("VERSION_1_0", true);
}
else if (version.StartsWith("1.1"))
{
AvailableExtensions.Add("VERSION_1_0", true);
AvailableExtensions.Add("VERSION_1_1", true);
}
else if (version.StartsWith("1.2"))
{
AvailableExtensions.Add("VERSION_1_0", true);
AvailableExtensions.Add("VERSION_1_1", true);
AvailableExtensions.Add("VERSION_1_2", true);
}
else if (version.StartsWith("1.3"))
{
AvailableExtensions.Add("VERSION_1_0", true);
AvailableExtensions.Add("VERSION_1_1", true);
AvailableExtensions.Add("VERSION_1_2", true);
AvailableExtensions.Add("VERSION_1_3", true);
}
string extension_string = Glu.GetString(Enums.StringName.EXTENSIONS);
if (String.IsNullOrEmpty(extension_string))
{ // no extensions are available
return;
}
string[] extensions = extension_string.Split(' ');
foreach (string ext in extensions)
{
AvailableExtensions.Add(ext, true);
}
rebuildExtensionList = false;
}
#endregion
public class GLUnurbs
{
}
public class GLUtesselator
{
}
public class GLUquadric
{
}
}
}

View file

@ -1,4 +1,10 @@
using System;
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

File diff suppressed because it is too large Load diff

View file

@ -274,7 +274,7 @@ namespace OpenTK.Platform.Windows
internal unsafe delegate Boolean DestroyImageBufferI3D(IntPtr hDC, void* pAddress);
internal unsafe static DestroyImageBufferI3D wglDestroyImageBufferI3D = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Boolean AssociateImageBufferEventsI3D(IntPtr hDC, IntPtr* pEvent, void* pAddress, Int32* pSize, UInt32 count);
internal unsafe delegate Boolean AssociateImageBufferEventsI3D(IntPtr hDC, IntPtr pEvent, void* pAddress, Int32* pSize, UInt32 count);
internal unsafe static AssociateImageBufferEventsI3D wglAssociateImageBufferEventsI3D = null;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Boolean ReleaseImageBufferEventsI3D(IntPtr hDC, void* pAddress, UInt32 count);

View file

@ -12,6 +12,7 @@ using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Diagnostics;
using OpenTK.OpenGL;
#endregion
@ -305,6 +306,8 @@ namespace OpenTK.Platform.Windows
Debug.Print("Could not create opengl context, error: {0}", expt.ToString());
throw;
}
GL.LoadAll();
Glu.LoadAll();
if (this.Create != null)
{

View file

@ -1,4 +1,10 @@
using System;
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
@ -12,11 +18,19 @@ namespace OpenTK.Platform.X11
static Glx() { }
}
public struct GLXDrawable
public struct Status
{
}
public struct GLXContext
public struct GLXFBConfig
{
}
public struct GLXPbuffer
{
}
public struct GLXContextID
{
}
@ -28,7 +42,31 @@ namespace OpenTK.Platform.X11
{
}
public struct GLXHyperpipeConfigSGIX
{
}
public struct GLXHyperpipeConfigPointer
{
}
public struct GLXVideoSourceSGIX
{
}
public struct GLXFBConfigSGIX
{
}
public struct GLXPbufferSGIX
{
}
public struct DMparams
{
}
public struct DMbuffer
{
}
}

View file

@ -74,7 +74,7 @@ namespace OpenTK.Platform.X11
{
// Define the bare essentials - needed for compatibility with Mono's System.Windows.Forms
Debug.Print("Preparing visual for System.Windows.Forms (compatibility mode)");
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
visualAttributes.Add((int)1);