Merged with gl3 branch. Resolved conflicts. Added IMouseDriver.cs
This commit is contained in:
parent
6812739418
commit
c855420287
15 changed files with 4151 additions and 4078 deletions
|
@ -12,7 +12,14 @@ namespace Bind.GL2
|
|||
internal static SpecReader specReader;
|
||||
internal static SpecWriter specWriter;
|
||||
|
||||
string specFolder;
|
||||
protected static string glTypemap = "gl.tm";
|
||||
protected static string csTypemap = "csharp.tm";
|
||||
protected static string enumSpec = "enum.spec";
|
||||
protected static string enumSpecExt = "enumext.spec";
|
||||
protected static string glSpec = "gl.spec";
|
||||
protected static string glSpecExt = "";
|
||||
|
||||
protected string specFolder;
|
||||
|
||||
public Generator(string folder)
|
||||
{
|
||||
|
@ -25,12 +32,12 @@ namespace Bind.GL2
|
|||
|
||||
#region public void Process()
|
||||
|
||||
public void Process()
|
||||
public virtual void Process()
|
||||
{
|
||||
Bind.Structures.Type.Initialize();
|
||||
Bind.Structures.Enum.Initialize();
|
||||
Bind.Structures.Type.Initialize(glTypemap, csTypemap);
|
||||
Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt);
|
||||
Bind.Structures.Function.Initialize();
|
||||
Bind.Structures.Delegate.Initialize();
|
||||
Bind.Structures.Delegate.Initialize(glSpec, glSpecExt);
|
||||
|
||||
// Process enums and delegates - create wrappers.
|
||||
Trace.WriteLine("Processing specs, please wait...");
|
||||
|
|
|
@ -24,9 +24,11 @@ namespace Bind.GL2
|
|||
// Disable BeforeFieldInit
|
||||
sw.WriteLine("static {0}()", Settings.DelegatesClass);
|
||||
sw.WriteLine("{");
|
||||
//sw.Indent();
|
||||
//sw.WriteLine("{0}.ReloadFunctions();", Settings.GLClass);
|
||||
//sw.Unindent();
|
||||
// --- Workaround for mono gmcs 1.2.4 issue, where static initalization fails. ---
|
||||
sw.Indent();
|
||||
sw.WriteLine("{0}.ReloadFunctions();", Settings.GLClass);
|
||||
sw.Unindent();
|
||||
// --- End workaround ---
|
||||
sw.WriteLine("}");
|
||||
sw.WriteLine();
|
||||
foreach (Bind.Structures.Delegate d in delegates.Values)
|
||||
|
@ -35,13 +37,19 @@ namespace Bind.GL2
|
|||
sw.WriteLine("internal {0};", d.ToString());
|
||||
if (d.Extension == "Core")
|
||||
{
|
||||
sw.WriteLine(
|
||||
/*sw.WriteLine(
|
||||
"internal {0}static {1} gl{1} = ({1}){2}.{3}(\"gl{1}\", typeof({1})) ?? new {1}({4}.{1});",
|
||||
d.Unsafe ? "unsafe " : "",
|
||||
d.Name,
|
||||
Settings.GLClass,
|
||||
"GetDelegateForExtensionMethod",
|
||||
Settings.ImportsClass);
|
||||
Settings.ImportsClass);*/
|
||||
// --- Workaround for mono gmcs 1.2.4 issue, where static initalization fails. ---
|
||||
sw.WriteLine(
|
||||
"internal {0}static {1} gl{1} = null;",
|
||||
d.Unsafe ? "unsafe " : "",
|
||||
d.Name);
|
||||
// --- End workaround ---
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -174,7 +182,7 @@ namespace Bind.GL2
|
|||
else if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||
{
|
||||
// Tao legacy mode: dump all enums as constants in GLClass.
|
||||
foreach (Bind.Structures.Constant c in enums["GLenum"].ConstantCollection.Values)
|
||||
foreach (Bind.Structures.Constant c in enums[Settings.CompleteEnumName].ConstantCollection.Values)
|
||||
{
|
||||
// Print constants avoiding circular definitions
|
||||
if (c.Name != c.Value)
|
||||
|
|
|
@ -91,9 +91,11 @@ namespace Bind
|
|||
Settings.OutputPath = b[1];
|
||||
break;
|
||||
case "mode":
|
||||
string arg = b[1].ToLower();
|
||||
mode =
|
||||
b[1].ToLower() == "gl2" ? GeneratorMode.GL2 :
|
||||
b[1].ToLower() == "gl3" ? GeneratorMode.GL3 : GeneratorMode.GL2;
|
||||
arg == "gl2" ? GeneratorMode.GL2 :
|
||||
arg == "gl3" ? GeneratorMode.GL3 :
|
||||
arg == "wgl" ? GeneratorMode.Wgl : GeneratorMode.GL2;
|
||||
break;
|
||||
case "namespace":
|
||||
case "ns":
|
||||
|
@ -144,6 +146,10 @@ namespace Bind
|
|||
Generator = new Bind.GL2.Generator(Settings.InputPath);
|
||||
break;
|
||||
|
||||
case GeneratorMode.Wgl:
|
||||
Generator = new Bind.Wgl.Generator(Settings.InputPath);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException(String.Format("Mode {0} not implemented.", mode));
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Bind
|
|||
{
|
||||
static class Settings
|
||||
{
|
||||
public static string InputPath = "..\\..\\..\\Source\\Bind\\Specifications";
|
||||
public static string InputPath = "..\\..\\..\\Source\\Bind\\Specifications\\gl2";
|
||||
public static string OutputPath = "..\\..\\..\\Source\\OpenTK\\OpenGL\\Bindings";
|
||||
public static string OutputNamespace = "OpenTK.OpenGL";
|
||||
public static string GLClass = "GL";
|
||||
|
|
|
@ -22,15 +22,25 @@ namespace Bind.Structures
|
|||
internal static DelegateCollection Delegates;
|
||||
|
||||
private static bool delegatesLoaded;
|
||||
internal static void Initialize()
|
||||
internal static void Initialize(string glSpec, string glSpecExt)
|
||||
{
|
||||
if (!delegatesLoaded)
|
||||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, "gl2\\gl.spec"))
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, glSpec))
|
||||
{
|
||||
Delegates = Bind.MainClass.Generator.ReadDelegates(sr);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(glSpecExt))
|
||||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, glSpecExt))
|
||||
{
|
||||
foreach (Delegate d in Bind.MainClass.Generator.ReadDelegates(sr).Values)
|
||||
{
|
||||
Utilities.Merge(Delegates, d);
|
||||
}
|
||||
}
|
||||
}
|
||||
delegatesLoaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +54,7 @@ namespace Bind.Structures
|
|||
|
||||
public Delegate(Delegate d)
|
||||
{
|
||||
this.Category = new string(d.Category.ToCharArray());
|
||||
this.Category = !String.IsNullOrEmpty(d.Category) ? new string(d.Category.ToCharArray()) : "";
|
||||
//this.Extension = !String.IsNullOrEmpty(d.Extension) ? new string(d.Extension.ToCharArray()) : "";
|
||||
this.Name = new string(d.Name.ToCharArray());
|
||||
//this.NeedsWrapper = d.NeedsWrapper;
|
||||
|
|
|
@ -18,16 +18,16 @@ namespace Bind.Structures
|
|||
|
||||
private static bool enumsLoaded;
|
||||
|
||||
internal static void Initialize()
|
||||
internal static void Initialize(string enumFile, string enumextFile)
|
||||
{
|
||||
if (!enumsLoaded)
|
||||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, "gl2\\enum.spec"))
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, enumFile))
|
||||
{
|
||||
GLEnums = Bind.MainClass.Generator.ReadEnums(sr);
|
||||
}
|
||||
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, "gl2\\enumext.spec"))
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, enumextFile))
|
||||
{
|
||||
foreach (Bind.Structures.Enum e in Bind.MainClass.Generator.ReadEnums(sr).Values)
|
||||
{
|
||||
|
|
|
@ -151,13 +151,19 @@ namespace Bind.Structures
|
|||
// Remove overload
|
||||
if (endings.Contains(trimmedName.Substring(trimmedName.Length - 3)))
|
||||
{
|
||||
TrimmedName = trimmedName.Substring(0, trimmedName.Length - 3);
|
||||
if (!trimmedName.EndsWith("v"))
|
||||
TrimmedName = trimmedName.Substring(0, trimmedName.Length - 3);
|
||||
else
|
||||
TrimmedName = trimmedName.Substring(0, trimmedName.Length - 3) + "v";
|
||||
return;
|
||||
}
|
||||
|
||||
if (endings.Contains(trimmedName.Substring(trimmedName.Length - 2)))
|
||||
{
|
||||
TrimmedName = trimmedName.Substring(0, trimmedName.Length - 2);
|
||||
if (!trimmedName.EndsWith("v"))
|
||||
TrimmedName = trimmedName.Substring(0, trimmedName.Length - 2);
|
||||
else
|
||||
TrimmedName = trimmedName.Substring(0, trimmedName.Length - 2) + "v";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -167,8 +173,10 @@ namespace Bind.Structures
|
|||
// do not want to change, or an actual overload (glColor3s). We assume
|
||||
// (perhaps incorrectly), that an 's' preceeded be a digit indicates an
|
||||
// overload. If there is no digit, we assume a plural form (no change).
|
||||
if (Char.IsDigit(trimmedName[trimmedName.Length - 2]))
|
||||
TrimmedName = trimmedName.Substring(0, trimmedName.Length - 1);
|
||||
if (!trimmedName.EndsWith("v"))
|
||||
if (Char.IsDigit(trimmedName[trimmedName.Length - 2]))
|
||||
TrimmedName = trimmedName.Substring(0, trimmedName.Length - 1);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,20 +12,20 @@ namespace Bind.Structures
|
|||
|
||||
private static bool typesLoaded;
|
||||
|
||||
internal static void Initialize()
|
||||
internal static void Initialize(string glTypes, string csTypes)
|
||||
{
|
||||
if (!typesLoaded)
|
||||
{
|
||||
if (GLTypes == null)
|
||||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, "gl2\\gl.tm"))
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, glTypes))
|
||||
{
|
||||
GLTypes = Bind.MainClass.Generator.ReadTypeMap(sr);
|
||||
}
|
||||
}
|
||||
if (CSTypes == null)
|
||||
{
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, "gl2\\csharp.tm"))
|
||||
using (StreamReader sr = Utilities.OpenSpecFile(Settings.InputPath, csTypes))
|
||||
{
|
||||
CSTypes = Bind.MainClass.Generator.ReadCSTypeMap(sr);
|
||||
}
|
||||
|
|
|
@ -157,6 +157,24 @@ namespace Bind
|
|||
|
||||
#endregion
|
||||
|
||||
#region internal static void Merge(EnumCollection enums, Bind.Structures.Enum t)
|
||||
|
||||
/// <summary>
|
||||
/// Merges the given enum into the enum list. If an enum of the same name exists,
|
||||
/// it merges their respective constants.
|
||||
/// </summary>
|
||||
/// <param name="enums"></param>
|
||||
/// <param name="t"></param>
|
||||
internal static void Merge(DelegateCollection delegates, Bind.Structures.Delegate t)
|
||||
{
|
||||
if (!delegates.ContainsKey(t.Name))
|
||||
{
|
||||
delegates.Add(t.Name, t);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region internal static string GetGL2Extension(string name)
|
||||
|
||||
internal static string GetGL2Extension(string name)
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace Examples.Tests
|
|||
while (!stop)
|
||||
{
|
||||
GL.Vertex2(0.0f, 0.0f);
|
||||
GL.Vertex2(v);
|
||||
GL.Vertex2v(v);
|
||||
//GL.ARB.ActiveTexture(GL.Enums.ARB_multitexture.TEXTURE0_ARB);
|
||||
//dummy();
|
||||
GL.ColorPointer(2, GL.Enums.ColorPointerType.FLOAT, 0, v);
|
||||
|
|
|
@ -184,7 +184,7 @@ namespace Examples.Tutorial
|
|||
(IntPtr)(vdata.Length * 4),
|
||||
vdata,
|
||||
GL.Enums.VERSION_1_5.STATIC_DRAW);
|
||||
GL.GetBufferParameter(
|
||||
GL.GetBufferParameterv(
|
||||
GL.Enums.VERSION_1_5.ARRAY_BUFFER,
|
||||
GL.Enums.VERSION_1_5.BUFFER_SIZE,
|
||||
out size);
|
||||
|
@ -201,7 +201,7 @@ namespace Examples.Tutorial
|
|||
idata,
|
||||
GL.Enums.VERSION_1_5.STATIC_DRAW
|
||||
);
|
||||
GL.GetBufferParameter(
|
||||
GL.GetBufferParameterv(
|
||||
GL.Enums.VERSION_1_5.ELEMENT_ARRAY_BUFFER,
|
||||
GL.Enums.VERSION_1_5.BUFFER_SIZE,
|
||||
out size);
|
||||
|
|
|
@ -70,22 +70,26 @@ namespace Examples.Tutorial
|
|||
|
||||
GL.ShaderSource(vertex_shader_object, vertex_shader_source.Length, vertex_shader_source, (int[])null);
|
||||
GL.CompileShader(vertex_shader_object);
|
||||
GL.GetShader(vertex_shader_object, GL.Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)GL.Enums.Boolean.TRUE)
|
||||
GL.GetShaderv(vertex_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)Enums.Boolean.TRUE)
|
||||
{
|
||||
StringBuilder info = new StringBuilder(1024);
|
||||
GL.GetShaderInfoLog(vertex_shader_object, info.MaxCapacity, (int[])null, info);
|
||||
int length = 0;
|
||||
GL.GetShaderv(vertex_shader_object, Enums.VERSION_2_0.INFO_LOG_LENGTH, out length);
|
||||
StringBuilder info = new StringBuilder(length);
|
||||
GL.GetShaderInfoLog(vertex_shader_object, info.Capacity, out length, info);
|
||||
|
||||
throw new Exception(info.ToString());
|
||||
}
|
||||
|
||||
GL.ShaderSource(fragment_shader_object, fragment_shader_source.Length, fragment_shader_source, (int[])null);
|
||||
GL.CompileShader(fragment_shader_object);
|
||||
GL.GetShader(fragment_shader_object, GL.Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)GL.Enums.Boolean.TRUE)
|
||||
GL.GetShaderv(fragment_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, out status);
|
||||
if (status != (int)Enums.Boolean.TRUE)
|
||||
{
|
||||
StringBuilder info = new StringBuilder(1024);
|
||||
GL.GetShaderInfoLog(fragment_shader_object, 1024, (int[])null, info);
|
||||
int length;
|
||||
GL.GetShaderv(vertex_shader_object, Enums.VERSION_2_0.INFO_LOG_LENGTH, out length);
|
||||
StringBuilder info = new StringBuilder(length);
|
||||
GL.GetShaderInfoLog(fragment_shader_object, info.Capacity, out length, info);
|
||||
|
||||
throw new Exception(info.ToString());
|
||||
}
|
||||
|
|
11
Source/OpenTK/Input/IMouseDriver.cs
Normal file
11
Source/OpenTK/Input/IMouseDriver.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
public interface IMouseDriver
|
||||
{
|
||||
IList<Keyboard> Mouse { get; }
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue