diff --git a/Source/Bind/Glu/Generator.cs b/Source/Bind/Glu/Generator.cs index 71634f30..bc64113b 100644 --- a/Source/Bind/Glu/Generator.cs +++ b/Source/Bind/Glu/Generator.cs @@ -1,10 +1,62 @@ using System; using System.Collections.Generic; using System.Text; +using System.Diagnostics; +using System.IO; namespace Bind.Glu { - class Generator + class Generator : Bind.GL2.Generator { + #region --- Constructors --- + + public Generator() + : base() + { + glTypemap = "Glu\\glu.tm"; + csTypemap = "csharp.tm"; + enumSpec = "Glu\\enumglu.spec"; + enumSpecExt = ""; + glSpec = "Glu\\glu.spec"; + glSpecExt = ""; + + importsFile = "GluCore.cs"; + delegatesFile = "GluDelegates.cs"; + enumsFile = "GluEnums.cs"; + wrappersFile = "Glu.cs"; + + Settings.OutputClass = "Glu"; + Settings.FunctionPrefix = "glu"; + Settings.ConstantPrefix = "GLU_"; + + if (Settings.Compatibility == Settings.Legacy.Tao) + { + Settings.OutputNamespace = "Tao.OpenGl"; + //Settings.WindowsGDI = "Tao.Platform.Windows.Gdi"; + } + else + { + Settings.OutputNamespace = "OpenTK.OpenGL"; + } + } + + #endregion + + public override void Process() + { + Bind.Structures.Type.Initialize(glTypemap, csTypemap); + Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt); + Bind.Structures.Function.Initialize(); + Bind.Structures.Delegate.Initialize(glSpec, glSpecExt); + + // Process enums and delegates - create wrappers. + Trace.WriteLine("Processing specs, please wait..."); + this.Translate(); + + this.WriteBindings( + Bind.Structures.Delegate.Delegates, + Bind.Structures.Function.Wrappers, + Bind.Structures.Enum.GLEnums); + } } } diff --git a/Source/Bind/Glx/Generator.cs b/Source/Bind/Glx/Generator.cs index 2602477d..16ed9dd1 100644 --- a/Source/Bind/Glx/Generator.cs +++ b/Source/Bind/Glx/Generator.cs @@ -1,10 +1,62 @@ using System; using System.Collections.Generic; using System.Text; +using System.Diagnostics; namespace Bind.Glx { - class Generator + class Generator : Bind.GL2.Generator { + #region --- Constructors --- + + public Generator() + : base() + { + glTypemap = "Glx\\glx.tm"; + csTypemap = "csharp.tm"; + enumSpec = "Glx\\glxenum.spec"; + enumSpecExt = "Glx\\glxenumext.spec"; + glSpec = "Glx\\glx.spec"; + glSpecExt = "Glx\\glxext.spec"; + + importsFile = "GlxCore.cs"; + delegatesFile = "GlxDelegates.cs"; + enumsFile = "GlxEnums.cs"; + wrappersFile = "Glx.cs"; + + Settings.OutputClass = "Glx"; + Settings.FunctionPrefix = "glX"; + Settings.ConstantPrefix = "GLX_"; + + + if (Settings.Compatibility == Settings.Legacy.Tao) + { + Settings.OutputNamespace = "Tao.Platform.Glx"; + //Settings.WindowsGDI = "Tao.Platform.Windows.Gdi"; + } + else + { + Settings.OutputNamespace = "OpenTK.Platform.X11"; + } + } + + #endregion + + public override void Process() + { + Bind.Structures.Type.Initialize(glTypemap, csTypemap); + Bind.Structures.Enum.Initialize(enumSpec, enumSpecExt); + Bind.Structures.Function.Initialize(); + Bind.Structures.Delegate.Initialize(glSpec, glSpecExt); + + // Process enums and delegates - create wrappers. + Trace.WriteLine("Processing specs, please wait..."); + this.Translate(); + + this.WriteBindings( + Bind.Structures.Delegate.Delegates, + Bind.Structures.Function.Wrappers, + Bind.Structures.Enum.GLEnums); + } } } diff --git a/Source/Bind/Main.cs b/Source/Bind/Main.cs index f7d17f77..a6ec5ff2 100644 --- a/Source/Bind/Main.cs +++ b/Source/Bind/Main.cs @@ -18,11 +18,12 @@ namespace Bind { enum GeneratorMode { + Unknown, GL2, GL3, Wgl, Glx, - Glu + Glu, } static class MainClass @@ -73,8 +74,12 @@ namespace Bind arg == "gl2" ? GeneratorMode.GL2 : arg == "gl3" ? GeneratorMode.GL3 : arg == "wgl" ? GeneratorMode.Wgl : - arg == "glu" ? GeneratorMode.Glu : - arg == "glx" ? GeneratorMode.Glx : GeneratorMode.GL2; + arg == "glu" ? GeneratorMode.Glu : + arg == "glx" ? GeneratorMode.Glx : GeneratorMode.Unknown; + if (mode == GeneratorMode.Unknown) + { + throw new ArgumentException(String.Format("Mode {0} unknown.", arg)); + } break; case "namespace": case "ns": @@ -126,11 +131,11 @@ namespace Bind break; case GeneratorMode.Glu: - + Generator = new Bind.Glu.Generator(); break; case GeneratorMode.Glx: - + Generator = new Bind.Glx.Generator(); break; case GeneratorMode.GL3: