mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 14:25:35 +00:00
Synced OpenTK.OpenGL.Bind and OpenTK.OpenGL.GL to latest Tao beta (2.1.3.6 and 2.1.0.7 respectively).
Added Enums.GLenum which contains all OpenGL enumerants. Functions with GLenum parameters now do not take ints but Enums.GLenum. Added ref/out overloads.
This commit is contained in:
parent
82e3e6aae1
commit
a68b57f3d2
BIN
Build/Build.exe
BIN
Build/Build.exe
Binary file not shown.
|
@ -124,7 +124,7 @@ namespace OpenTK.Examples.OpenGL.GLSL
|
||||||
GL.Enable(Enums.EnableCap.DEPTH_TEST);
|
GL.Enable(Enums.EnableCap.DEPTH_TEST);
|
||||||
|
|
||||||
int vertex_shader_object, fragment_shader_object;
|
int vertex_shader_object, fragment_shader_object;
|
||||||
int[] status = new int[1];
|
int status;
|
||||||
int shader_program;
|
int shader_program;
|
||||||
|
|
||||||
vertex_shader_object = GL.CreateShader(Enums.VERSION_2_0.VERTEX_SHADER);
|
vertex_shader_object = GL.CreateShader(Enums.VERSION_2_0.VERTEX_SHADER);
|
||||||
|
@ -132,8 +132,8 @@ namespace OpenTK.Examples.OpenGL.GLSL
|
||||||
|
|
||||||
GL.ShaderSource(vertex_shader_object, vertex_shader_source.Length, vertex_shader_source, null);
|
GL.ShaderSource(vertex_shader_object, vertex_shader_source.Length, vertex_shader_source, null);
|
||||||
GL.CompileShader(vertex_shader_object);
|
GL.CompileShader(vertex_shader_object);
|
||||||
GL.GetShaderiv(vertex_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, status);
|
GL.GetShaderiv(vertex_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||||
if (status[0] != (int)Enums.Boolean.TRUE)
|
if (status != (int)Enums.Boolean.TRUE)
|
||||||
{
|
{
|
||||||
StringBuilder info = new StringBuilder(1024);
|
StringBuilder info = new StringBuilder(1024);
|
||||||
GL.GetShaderInfoLog(vertex_shader_object, info.MaxCapacity, null, info);
|
GL.GetShaderInfoLog(vertex_shader_object, info.MaxCapacity, null, info);
|
||||||
|
@ -143,8 +143,8 @@ namespace OpenTK.Examples.OpenGL.GLSL
|
||||||
|
|
||||||
GL.ShaderSource(fragment_shader_object, fragment_shader_source.Length, fragment_shader_source, null);
|
GL.ShaderSource(fragment_shader_object, fragment_shader_source.Length, fragment_shader_source, null);
|
||||||
GL.CompileShader(fragment_shader_object);
|
GL.CompileShader(fragment_shader_object);
|
||||||
GL.GetShaderiv(fragment_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, status);
|
GL.GetShaderiv(fragment_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||||
if (status[0] != (int)Enums.Boolean.TRUE)
|
if (status != (int)Enums.Boolean.TRUE)
|
||||||
{
|
{
|
||||||
StringBuilder info = new StringBuilder(1024);
|
StringBuilder info = new StringBuilder(1024);
|
||||||
GL.GetShaderInfoLog(fragment_shader_object, 1024, null, info);
|
GL.GetShaderInfoLog(fragment_shader_object, 1024, null, info);
|
||||||
|
|
|
@ -106,7 +106,9 @@ namespace OpenTK.OpenGL.Bind
|
||||||
function_name.EndsWith("INTEL") ||
|
function_name.EndsWith("INTEL") ||
|
||||||
function_name.EndsWith("PGI") ||
|
function_name.EndsWith("PGI") ||
|
||||||
function_name.EndsWith("INGR") ||
|
function_name.EndsWith("INGR") ||
|
||||||
function_name.EndsWith("APPLE"));
|
function_name.EndsWith("APPLE") ||
|
||||||
|
function_name.EndsWith("OML") ||
|
||||||
|
function_name.EndsWith("I3D"));
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -249,6 +251,10 @@ namespace OpenTK.OpenGL.Bind
|
||||||
public static void ReadEnumSpecs(string file, out CodeTypeDeclarationCollection enums)
|
public static void ReadEnumSpecs(string file, out CodeTypeDeclarationCollection enums)
|
||||||
{
|
{
|
||||||
enums = new CodeTypeDeclarationCollection();
|
enums = new CodeTypeDeclarationCollection();
|
||||||
|
// comple_enum contains all opengl enumerants.
|
||||||
|
CodeTypeDeclaration complete_enum = new CodeTypeDeclaration();
|
||||||
|
complete_enum.IsEnum = true;
|
||||||
|
complete_enum.Name = "GLenum";
|
||||||
|
|
||||||
StreamReader sr = OpenSpecFile(file);
|
StreamReader sr = OpenSpecFile(file);
|
||||||
Console.WriteLine("Reading constant specs from file: {0}", file);
|
Console.WriteLine("Reading constant specs from file: {0}", file);
|
||||||
|
@ -327,6 +333,9 @@ namespace OpenTK.OpenGL.Bind
|
||||||
|
|
||||||
//if (!String.IsNullOrEmpty(c.Name) && !e.Members.Contains.Contains(c))
|
//if (!String.IsNullOrEmpty(c.Name) && !e.Members.Contains.Contains(c))
|
||||||
SpecTranslator.Merge(e.Members, c);
|
SpecTranslator.Merge(e.Members, c);
|
||||||
|
|
||||||
|
// Insert the current constant in the list of all constants.
|
||||||
|
SpecTranslator.Merge(complete_enum.Members, c);
|
||||||
}
|
}
|
||||||
while (!sr.EndOfStream);
|
while (!sr.EndOfStream);
|
||||||
|
|
||||||
|
@ -335,10 +344,11 @@ namespace OpenTK.OpenGL.Bind
|
||||||
e.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, "public enum " + e.Name));
|
e.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, "public enum " + e.Name));
|
||||||
e.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, "public enum " + e.Name));
|
e.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, "public enum " + e.Name));
|
||||||
|
|
||||||
// Hack - discard Boolean enum, it fsucks up the fragile translation code ahead.
|
// (disabled) Hack - discard Boolean enum, it fsucks up the fragile translation code ahead.
|
||||||
//if (!e.Name.Contains("Bool"))
|
//if (!e.Name.Contains("Bool"))
|
||||||
SpecTranslator.Merge(enums, e);
|
SpecTranslator.Merge(enums, e);
|
||||||
}
|
}
|
||||||
|
SpecTranslator.Merge(enums, complete_enum);
|
||||||
}
|
}
|
||||||
while (!sr.EndOfStream);
|
while (!sr.EndOfStream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,10 @@ namespace OpenTK.OpenGL.Bind
|
||||||
/// </summary>
|
/// </summary>
|
||||||
UncheckedParameter,
|
UncheckedParameter,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Function that takes (in/ref/out) a naked pointer as a parameter - we pass an IntPtr.
|
||||||
|
/// </summary>
|
||||||
|
PointerParameter,
|
||||||
|
/// <summary>
|
||||||
/// Function returns string - needs manual marshalling through IntPtr to prevent the managed GC
|
/// Function returns string - needs manual marshalling through IntPtr to prevent the managed GC
|
||||||
/// from freeing memory allocated on the unmanaged side (e.g. glGetString).
|
/// from freeing memory allocated on the unmanaged side (e.g. glGetString).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -183,6 +187,11 @@ namespace OpenTK.OpenGL.Bind
|
||||||
d.ReturnType.ArrayRank = 0;
|
d.ReturnType.ArrayRank = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d.ReturnType.BaseType == "GLenum")
|
||||||
|
{
|
||||||
|
d.ReturnType.BaseType = "Enums.GLenum";
|
||||||
|
}
|
||||||
|
|
||||||
if (d.ReturnType.UserData.Contains("Wrapper"))
|
if (d.ReturnType.UserData.Contains("Wrapper"))
|
||||||
{
|
{
|
||||||
d.UserData.Add("Wrapper", null);
|
d.UserData.Add("Wrapper", null);
|
||||||
|
@ -195,25 +204,25 @@ namespace OpenTK.OpenGL.Bind
|
||||||
{
|
{
|
||||||
CodeTypeReference s;
|
CodeTypeReference s;
|
||||||
|
|
||||||
if (d.Name == "BufferDataARB")
|
if (d.Name == "CreateShader")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Translate each parameter of the function while checking for needed wrappers:
|
// Translate each parameter of the function while checking for needed wrappers:
|
||||||
foreach (CodeParameterDeclarationExpression p in d.Parameters)
|
foreach (CodeParameterDeclarationExpression p in d.Parameters)
|
||||||
{
|
{
|
||||||
// Translate parameter type
|
if (Search(enums, p.Type.BaseType) && p.Type.BaseType != "GLenum")
|
||||||
if (Search(enums, p.Type.BaseType))
|
|
||||||
{
|
{
|
||||||
|
// If there is a specific enumerant entry for this parameter, then take this.
|
||||||
p.Type.BaseType = "Enums." + p.Type.BaseType;
|
p.Type.BaseType = "Enums." + p.Type.BaseType;
|
||||||
}
|
}
|
||||||
else if (GLTypes.TryGetValue(p.Type.BaseType, out s))
|
else if (GLTypes.TryGetValue(p.Type.BaseType, out s))
|
||||||
{
|
{
|
||||||
if (s.BaseType == "GLenum" && d.UserData.Contains("Category"))
|
if (s.BaseType == "GLenum" && d.UserData.Contains("Category"))
|
||||||
{
|
{
|
||||||
bool found = false;
|
// If there isn't, try to see if any of the generic enumerants
|
||||||
// There is no enumerant with the needed name. Try to see if any of the generic enumerants
|
|
||||||
// (category: VERSION_1_1 etc) match the needed name.
|
// (category: VERSION_1_1 etc) match the needed name.
|
||||||
|
bool found = false;
|
||||||
foreach (CodeTypeDeclaration enumerant in enums)
|
foreach (CodeTypeDeclaration enumerant in enums)
|
||||||
{
|
{
|
||||||
if (enumerant.Name == (string)d.UserData["Category"])
|
if (enumerant.Name == (string)d.UserData["Category"])
|
||||||
|
@ -224,9 +233,10 @@ namespace OpenTK.OpenGL.Bind
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found || p.Type.BaseType.ToLower().Contains("bool"))
|
// If none match, then fall back to the global enum list.
|
||||||
|
if (!found)
|
||||||
{
|
{
|
||||||
p.Type.BaseType = s.BaseType;
|
p.Type.BaseType = "Enums.GLenum";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -261,6 +271,10 @@ namespace OpenTK.OpenGL.Bind
|
||||||
{
|
{
|
||||||
p.UserData.Add("Wrapper", WrapperTypes.GenericParameter);
|
p.UserData.Add("Wrapper", WrapperTypes.GenericParameter);
|
||||||
}
|
}
|
||||||
|
else if (p.Type.BaseType.Contains("IntPtr"))
|
||||||
|
{
|
||||||
|
//p.UserData.Add("Wrapper", WrapperTypes.PointerParameter);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.UserData.Add("Wrapper", WrapperTypes.ArrayParameter);
|
p.UserData.Add("Wrapper", WrapperTypes.ArrayParameter);
|
||||||
|
@ -271,6 +285,7 @@ namespace OpenTK.OpenGL.Bind
|
||||||
p.Type = new CodeTypeReference();
|
p.Type = new CodeTypeReference();
|
||||||
p.Type.BaseType = "System.IntPtr";
|
p.Type.BaseType = "System.IntPtr";
|
||||||
p.Type.ArrayRank = 0;
|
p.Type.ArrayRank = 0;
|
||||||
|
p.UserData.Add("Flow", p.Direction);
|
||||||
// The same wrapper works for either in or out parameters.
|
// The same wrapper works for either in or out parameters.
|
||||||
//p.CustomAttributes.Add(new CodeAttributeDeclaration("In, Out"));
|
//p.CustomAttributes.Add(new CodeAttributeDeclaration("In, Out"));
|
||||||
}
|
}
|
||||||
|
@ -299,7 +314,7 @@ namespace OpenTK.OpenGL.Bind
|
||||||
d.UserData.Add("Wrapper", null);
|
d.UserData.Add("Wrapper", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Direction = FieldDirection.In;
|
//p.Direction = FieldDirection.In;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -458,12 +473,12 @@ namespace OpenTK.OpenGL.Bind
|
||||||
WrapPointersMonsterFunctionMK2(w, wrappers);
|
WrapPointersMonsterFunctionMK2(w, wrappers);
|
||||||
--count;
|
--count;
|
||||||
|
|
||||||
/*w = IntPtrToReference(f, count);
|
w = IntPtrToReference(f, count);
|
||||||
wrappers.Add(w);
|
wrappers.Add(w);
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
WrapPointersMonsterFunctionMK2(w, wrappers);
|
WrapPointersMonsterFunctionMK2(w, wrappers);
|
||||||
--count;*/
|
--count;
|
||||||
}
|
}
|
||||||
else if ((WrapperTypes)f.Parameters[count].UserData["Wrapper"] == WrapperTypes.GenericParameter)
|
else if ((WrapperTypes)f.Parameters[count].UserData["Wrapper"] == WrapperTypes.GenericParameter)
|
||||||
{
|
{
|
||||||
|
@ -549,8 +564,7 @@ namespace OpenTK.OpenGL.Bind
|
||||||
|
|
||||||
#region private static CodeMemberMethod IntPtrToReference(CodeMemberMethod f, int index)
|
#region private static CodeMemberMethod IntPtrToReference(CodeMemberMethod f, int index)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function is not working yet! How can we obtain a pinned IntPtr from a ref
|
/// Obtain an IntPtr to the reference passed by the user.
|
||||||
/// without resorting to unsafe code?
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="f"></param>
|
/// <param name="f"></param>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
|
@ -563,7 +577,11 @@ namespace OpenTK.OpenGL.Bind
|
||||||
CodeParameterDeclarationExpression newp = new CodeParameterDeclarationExpression();
|
CodeParameterDeclarationExpression newp = new CodeParameterDeclarationExpression();
|
||||||
newp.Name = f.Parameters[index].Name;
|
newp.Name = f.Parameters[index].Name;
|
||||||
newp.Type.BaseType = (string)f.Parameters[index].UserData["OriginalType"];
|
newp.Type.BaseType = (string)f.Parameters[index].UserData["OriginalType"];
|
||||||
newp.Direction = FieldDirection.Ref;
|
if (f.Parameters[index].UserData.Contains("Flow") &&
|
||||||
|
(FieldDirection)f.Parameters[index].UserData["Flow"] == FieldDirection.Out)
|
||||||
|
newp.Direction = FieldDirection.Out;
|
||||||
|
else
|
||||||
|
newp.Direction = FieldDirection.Ref;
|
||||||
w.Parameters[index] = newp;
|
w.Parameters[index] = newp;
|
||||||
|
|
||||||
// In the function body we should pin all objects in memory before calling the
|
// In the function body we should pin all objects in memory before calling the
|
||||||
|
@ -651,9 +669,21 @@ namespace OpenTK.OpenGL.Bind
|
||||||
foreach (CodeParameterDeclarationExpression p in f.Parameters)
|
foreach (CodeParameterDeclarationExpression p in f.Parameters)
|
||||||
{
|
{
|
||||||
// Do manual marshalling for objects and arrays, but not strings.
|
// Do manual marshalling for objects and arrays, but not strings.
|
||||||
if (p.Type.BaseType.ToLower().Contains("object") && !p.Type.BaseType.ToLower().Contains("enums.") ||
|
if (p.Type.BaseType == "object" || p.Type.BaseType == "System.Object" ||
|
||||||
(p.Type.ArrayRank > 0 && !p.Type.BaseType.ToLower().Contains("string")))
|
(p.Type.ArrayRank > 0 && !p.Type.BaseType.ToLower().Contains("string")) ||
|
||||||
|
((p.Direction == FieldDirection.Ref || p.Direction == FieldDirection.Out) &&
|
||||||
|
!p.Type.BaseType.ToLower().Contains("string")))
|
||||||
{
|
{
|
||||||
|
if (p.Direction == FieldDirection.Out)
|
||||||
|
{
|
||||||
|
statements.Add(
|
||||||
|
new CodeAssignStatement(
|
||||||
|
new CodeVariableReferenceExpression(p.Name),
|
||||||
|
new CodeSnippetExpression("default(" + p.Type.BaseType + ")")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Pin the object and store the resulting GCHandle to h0, h1, ...
|
// Pin the object and store the resulting GCHandle to h0, h1, ...
|
||||||
CodeVariableDeclarationStatement s = new CodeVariableDeclarationStatement();
|
CodeVariableDeclarationStatement s = new CodeVariableDeclarationStatement();
|
||||||
s.Type = new CodeTypeReference("GCHandle");
|
s.Type = new CodeTypeReference("GCHandle");
|
||||||
|
@ -679,6 +709,18 @@ namespace OpenTK.OpenGL.Bind
|
||||||
|
|
||||||
// Add the h(n) variable to the list of parameters
|
// Add the h(n) variable to the list of parameters
|
||||||
parameters[i] = new CodeVariableReferenceExpression("h" + h + ".AddrOfPinnedObject()");
|
parameters[i] = new CodeVariableReferenceExpression("h" + h + ".AddrOfPinnedObject()");
|
||||||
|
|
||||||
|
// Add an assignment statement: "variable_name = (variable_type)h(n).Target" for out parameters.
|
||||||
|
if (p.Direction == FieldDirection.Out)
|
||||||
|
{
|
||||||
|
m.TryStatements.Add(
|
||||||
|
new CodeAssignStatement(
|
||||||
|
new CodeVariableReferenceExpression(p.Name),
|
||||||
|
new CodeSnippetExpression("(" + p.Type.BaseType + ")h" + h + ".Target")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
h++;
|
h++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -689,10 +731,10 @@ namespace OpenTK.OpenGL.Bind
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!f.ReturnType.BaseType.Contains("Void"))
|
if (f.ReturnType.BaseType.Contains("Void"))
|
||||||
{
|
{
|
||||||
m.TryStatements.Add(
|
m.TryStatements.Insert(0,
|
||||||
new CodeMethodReturnStatement(
|
new CodeExpressionStatement(
|
||||||
new CodeMethodInvokeExpression(
|
new CodeMethodInvokeExpression(
|
||||||
new CodeTypeReferenceExpression("Delegates"),
|
new CodeTypeReferenceExpression("Delegates"),
|
||||||
"gl" + f.Name,
|
"gl" + f.Name,
|
||||||
|
@ -703,15 +745,22 @@ namespace OpenTK.OpenGL.Bind
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m.TryStatements.Add(
|
m.TryStatements.Insert(0, new CodeVariableDeclarationStatement(f.ReturnType, "retval"));
|
||||||
new CodeMethodInvokeExpression(
|
m.TryStatements.Insert(1,
|
||||||
new CodeTypeReferenceExpression("Delegates"),
|
new CodeAssignStatement(
|
||||||
"gl" + f.Name,
|
new CodeVariableReferenceExpression("retval"),
|
||||||
parameters
|
new CodeMethodInvokeExpression(
|
||||||
|
new CodeTypeReferenceExpression("Delegates"),
|
||||||
|
"gl" + f.Name,
|
||||||
|
parameters
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
|
m.TryStatements.Add(
|
||||||
|
new CodeMethodReturnStatement(new CodeVariableReferenceExpression("retval"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
statements.Add(m);
|
statements.Add(m);
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,12 @@ namespace OpenTK.OpenGL.Bind
|
||||||
|
|
||||||
foreach (CodeTypeDelegate d in delegates)
|
foreach (CodeTypeDelegate d in delegates)
|
||||||
{
|
{
|
||||||
|
// Hack - turn FieldDirection.Out parameters to FieldDirection.In. The parameter flow
|
||||||
|
// is handle by the [In, Out()] parameter attribute.
|
||||||
|
foreach (CodeParameterDeclarationExpression p in d.Parameters)
|
||||||
|
{
|
||||||
|
p.Direction = FieldDirection.In;
|
||||||
|
}
|
||||||
delegate_class.Members.Add(d);
|
delegate_class.Members.Add(d);
|
||||||
|
|
||||||
CodeMemberField m = new CodeMemberField();
|
CodeMemberField m = new CodeMemberField();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -91,11 +91,11 @@ namespace OpenTK.OpenGL
|
||||||
|
|
||||||
#region internal static IntPtr aglGetProcAddress(string s)
|
#region internal static IntPtr aglGetProcAddress(string s)
|
||||||
// osx gets complicated
|
// osx gets complicated
|
||||||
[DllImport(GL_NATIVE_LIBRARY, EntryPoint = "NSIsSymbolNameDefined")]
|
[DllImport("libdl.dylib", EntryPoint = "NSIsSymbolNameDefined")]
|
||||||
internal static extern bool NSIsSymbolNameDefined(string s);
|
internal static extern bool NSIsSymbolNameDefined(string s);
|
||||||
[DllImport(GL_NATIVE_LIBRARY, EntryPoint = "NSLookupAndBindSymbol")]
|
[DllImport("libdl.dylib", EntryPoint = "NSLookupAndBindSymbol")]
|
||||||
internal static extern IntPtr NSLookupAndBindSymbol(string s);
|
internal static extern IntPtr NSLookupAndBindSymbol(string s);
|
||||||
[DllImport(GL_NATIVE_LIBRARY, EntryPoint = "NSAddressOfSymbol")]
|
[DllImport("libdl.dylib", EntryPoint = "NSAddressOfSymbol")]
|
||||||
internal static extern IntPtr NSAddressOfSymbol(IntPtr symbol);
|
internal static extern IntPtr NSAddressOfSymbol(IntPtr symbol);
|
||||||
|
|
||||||
internal static IntPtr aglGetProcAddress(string s)
|
internal static IntPtr aglGetProcAddress(string s)
|
||||||
|
@ -181,7 +181,10 @@ namespace OpenTK.OpenGL
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// Ack!
|
// Ack!
|
||||||
throw new NotSupportedException("Unknown platform - cannot get function pointer.");
|
throw new NotSupportedException(
|
||||||
|
@"Could not find out how to retrive function pointers for this platform.
|
||||||
|
Did you remember to copy OpenTK.OpenGL.dll.config to your binary's folder?
|
||||||
|
");
|
||||||
|
|
||||||
case Platform.Windows:
|
case Platform.Windows:
|
||||||
return Wgl.GetProcAddress(name);
|
return Wgl.GetProcAddress(name);
|
||||||
|
@ -214,7 +217,9 @@ namespace OpenTK.OpenGL
|
||||||
{
|
{
|
||||||
IntPtr address = GetFunctionPointerForExtensionMethod(name);
|
IntPtr address = GetFunctionPointerForExtensionMethod(name);
|
||||||
|
|
||||||
if (address == IntPtr.Zero)
|
if (address == IntPtr.Zero ||
|
||||||
|
address == new IntPtr(1) || // Workaround for buggy nvidia drivers which return
|
||||||
|
address == new IntPtr(2)) // 1 or 2 instead of IntPtr.Zero for some extensions.
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
GLsizei, Int32
|
GLsizei, Int32
|
||||||
GLsizeiptr, IntPtr
|
GLsizeiptr, IntPtr
|
||||||
GLintptr, IntPtr
|
GLintptr, IntPtr
|
||||||
GLenum, Int32
|
# GLenum, Int32
|
||||||
GLboolean, Boolean #Int32 #Boolean
|
GLboolean, Boolean #Int32 #Boolean
|
||||||
GLbitfield, Int32 #UInt32
|
GLbitfield, Int32 #UInt32
|
||||||
# GLvoid*, IntPtr
|
# GLvoid*, IntPtr
|
||||||
|
|
Loading…
Reference in a new issue