mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 02:55:31 +00:00
This commit is contained in:
parent
79ad3e568a
commit
22fa16be89
|
@ -3,15 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 9.00
|
|||
# Visual Studio 2005
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documentation", "Documentation", "{80BD2C66-A90B-42E7-BED8-CBF7BB8C2E3F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
changelog.txt = changelog.txt
|
||||
license.txt = license.txt
|
||||
Todo.txt = Todo.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Specifications", "Specifications", "{B23A6DCD-9FE9-4523-95FB-01C8D4631555}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Specifications\cs_types.txt = Specifications\cs_types.txt
|
||||
Specifications\enum.spec = Specifications\enum.spec
|
||||
Specifications\enumext.spec = Specifications\enumext.spec
|
||||
Specifications\gl.spec = Specifications\gl.spec
|
||||
Specifications\TypeMap.txt = Specifications\TypeMap.txt
|
||||
Specifications\gl_types.txt = Specifications\gl_types.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{E9FF51BB-295E-4891-AA30-D1374F26DCE0}"
|
||||
|
|
BIN
OpenTK.suo
BIN
OpenTK.suo
Binary file not shown.
|
@ -15,7 +15,7 @@ namespace OpenTK.OpenGL.Test
|
|||
public partial class DisplayLists : Form
|
||||
{
|
||||
Context context;
|
||||
uint[] lists = new uint[2];
|
||||
int[] lists = new int[2];
|
||||
|
||||
public DisplayLists()
|
||||
{
|
||||
|
|
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.0.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.1")]
|
||||
|
|
|
@ -7,8 +7,10 @@ using System.Text;
|
|||
using System.IO;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using Settings = OpenTK.OpenGL.Bind.Properties.Bind;
|
||||
//using Settings = Tao.OpenGl.Bind.Properties.Bind;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
|
||||
[assembly:CLSCompliant(true), FileIOPermission(SecurityAction.RequestMinimum, Unrestricted = true)]
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
|
@ -21,13 +23,15 @@ namespace OpenTK.OpenGL.Bind
|
|||
System.Reflection.Assembly.GetExecutingAssembly().GetName().Name,
|
||||
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
|
||||
#region Handle Arguments
|
||||
|
||||
try
|
||||
{
|
||||
foreach (string a in arguments)
|
||||
{
|
||||
if (a.StartsWith("--") || a.StartsWith("-") || a.StartsWith("/"))
|
||||
{
|
||||
string[] b = a.Split(new char[] { '-', '/', '=' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] b = a.Split(new char[] { '-', '/', ':', '=' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
switch (b[0])
|
||||
{
|
||||
case "?":
|
||||
|
@ -36,14 +40,14 @@ namespace OpenTK.OpenGL.Bind
|
|||
return;
|
||||
case "in":
|
||||
case "input":
|
||||
Properties.Bind.Default.InputPath = b[1];
|
||||
Settings.InputPath = b[1];
|
||||
break;
|
||||
case "out":
|
||||
case "Properties.Bind.Default.OutputPath":
|
||||
Properties.Bind.Default.OutputPath = b[1];
|
||||
Settings.OutputPath = b[1];
|
||||
break;
|
||||
case "class":
|
||||
Properties.Bind.Default.OutputGLClass = b[1];
|
||||
Settings.OutputClass = b[1];
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Argument " + a + " not recognized. Use the '/?' switch for help.");
|
||||
|
@ -62,21 +66,54 @@ namespace OpenTK.OpenGL.Bind
|
|||
return;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
new Process();
|
||||
long ticks = System.DateTime.Now.Ticks;
|
||||
|
||||
List<Function> wrappers;
|
||||
List<Function> functions = SpecReader.ReadFunctionSpecs("gl.spec");
|
||||
Hashtable enums = SpecReader.ReadEnumSpecs("enum.spec");
|
||||
Hashtable enums2= SpecReader.ReadEnumSpecs("enumext.spec");
|
||||
foreach (Enum e in enums2.Values)
|
||||
if (!enums.ContainsKey(e.Name))
|
||||
enums.Add(e.Name, e);
|
||||
else
|
||||
{
|
||||
foreach (Constant c in e.ConstantCollection.Values)
|
||||
if (!((Enum)enums[e.Name]).ConstantCollection.ContainsKey(c.Name))
|
||||
((Enum)enums[e.Name]).ConstantCollection.Add(c.Name, c);
|
||||
}
|
||||
|
||||
Translation.GLtypes = SpecReader.ReadTypeMap("gl_types.txt");
|
||||
Translation.CStypes = SpecReader.ReadTypeMap("cs_types.txt");
|
||||
|
||||
Translation.TranslateFunctions(functions, enums, out wrappers);
|
||||
Translation.TranslateEnums(enums);
|
||||
|
||||
SpecWriter.WriteSpecs(Settings.OutputPath, functions, wrappers, enums);
|
||||
//SpecWriter.WriteWrappers(Properties.Bind.Default.OutputPath, wrappers);
|
||||
|
||||
ContextWriter.WriteMainContext(Settings.OutputPath, functions);
|
||||
ContextWriter.WriteDerivedContext(Settings.OutputPath, "WindowsContext", functions, "1.0", "1.1");
|
||||
ContextWriter.WriteDerivedContext(Settings.OutputPath, "WindowsVistaContext", functions, "1.0", "1.1", "1.2", "1.3", "1.4");
|
||||
ContextWriter.WriteDerivedContext(Settings.OutputPath, "X11Context", functions, "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "2.0");
|
||||
|
||||
ticks = System.DateTime.Now.Ticks - ticks;
|
||||
|
||||
Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0);
|
||||
}
|
||||
catch (SecurityException e)
|
||||
{
|
||||
Console.WriteLine("Security violation \"{0}\" in method \"{1}\".", e.Message, e.Method);
|
||||
Console.WriteLine("This application does not have permission to take the requested actions.");
|
||||
}
|
||||
/*finally
|
||||
{
|
||||
Console.WriteLine("Press any key to continue...");
|
||||
while (!Console.KeyAvailable)
|
||||
Thread.Sleep(100);
|
||||
}*/
|
||||
//finally
|
||||
//{
|
||||
// Console.WriteLine("Press any key to continue...");
|
||||
// Console.ReadKey(false);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,28 +42,18 @@
|
|||
</Target>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Compile Include="Data\Constant.cs" />
|
||||
<Compile Include="Data\Enum.cs" />
|
||||
<Compile Include="Data\Function.cs" />
|
||||
<Compile Include="Data\Parameter.cs" />
|
||||
<Compile Include="Data\ParameterCollection.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="Process\Process.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Bind.cs" />
|
||||
<Compile Include="Properties\Bind.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Bind.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Process\ReadSpecs.cs" />
|
||||
<Compile Include="Process\WriteContextLoad.cs" />
|
||||
<Compile Include="Process\WriteDelegateList.cs" />
|
||||
<Compile Include="Process\WriteEnums.cs" />
|
||||
<Compile Include="Process\WriteFunctions.cs" />
|
||||
<Compile Include="Process\WriteWrappers.cs" />
|
||||
<Compile Include="Translation.cs" />
|
||||
<Compile Include="ReadSpecs.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="Structures\Constant.cs" />
|
||||
<Compile Include="Structures\Enum.cs" />
|
||||
<Compile Include="Structures\Function.cs" />
|
||||
<Compile Include="Structures\Parameter.cs" />
|
||||
<Compile Include="Structures\ParameterCollection.cs" />
|
||||
<Compile Include="TranslateSpecs.cs" />
|
||||
<Compile Include="WriteContexts.cs" />
|
||||
<Compile Include="WriteSpecs.cs" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>$(TargetName)</PostBuildEvent>
|
||||
|
@ -83,11 +73,4 @@
|
|||
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\app.config" />
|
||||
<None Include="Properties\Bind.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Bind.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2006")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2006 Stefanos Apostolopoulos")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.7.2.2")]
|
||||
[assembly: AssemblyFileVersion("0.7.2.2")]
|
||||
[assembly: AssemblyVersion("0.7.4.0")]
|
||||
[assembly: AssemblyFileVersion("0.7.4.0")]
|
||||
|
|
363
Source/OpenGL/Bind/ReadSpecs.cs
Normal file
363
Source/OpenGL/Bind/ReadSpecs.cs
Normal file
|
@ -0,0 +1,363 @@
|
|||
/* Copyright (c) 2006 Stephen Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
static class SpecReader
|
||||
{
|
||||
#region Read function specs
|
||||
|
||||
public static List<Function> ReadFunctionSpecs(string file)
|
||||
{
|
||||
List<Function> functions = new List<Function>();
|
||||
|
||||
string path = Path.Combine(Settings.InputPath, file);
|
||||
StreamReader sr;
|
||||
|
||||
try
|
||||
{
|
||||
sr = new StreamReader(path);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Error opening spec file: {0}", path);
|
||||
Console.WriteLine("Error: {0}", e.Message);
|
||||
throw e;
|
||||
}
|
||||
Console.WriteLine("Reading function specs from file: {0}", file);
|
||||
|
||||
do
|
||||
{
|
||||
string line = sr.ReadLine().Trim();
|
||||
|
||||
if (String.IsNullOrEmpty(line) ||
|
||||
line.StartsWith("#") || // Disregard comments.
|
||||
line.StartsWith("passthru") || // Disregard passthru statements.
|
||||
line.StartsWith("required-props:") ||
|
||||
line.StartsWith("param:") ||
|
||||
line.StartsWith("dlflags:") ||
|
||||
line.StartsWith("glxflags:") ||
|
||||
line.StartsWith("vectorequiv:") ||
|
||||
line.StartsWith("category:") ||
|
||||
line.StartsWith("version:") ||
|
||||
line.StartsWith("glxsingle:") ||
|
||||
line.StartsWith("glxropcode:") ||
|
||||
line.StartsWith("glxvendorpriv:") ||
|
||||
line.StartsWith("glsflags:") ||
|
||||
line.StartsWith("glsopcode:") ||
|
||||
line.StartsWith("glsalias:") ||
|
||||
line.StartsWith("wglflags:") ||
|
||||
line.StartsWith("extension:") ||
|
||||
line.StartsWith("alias:") ||
|
||||
line.StartsWith("offset:"))
|
||||
continue;
|
||||
|
||||
while (line.Contains("(") && !sr.EndOfStream)
|
||||
{
|
||||
Function f = new Function();
|
||||
|
||||
f.Name = line.Split(Translation.Separators, StringSplitOptions.RemoveEmptyEntries)[0];
|
||||
if (f.Name.EndsWith("ARB") ||
|
||||
f.Name.EndsWith("EXT") ||
|
||||
f.Name.EndsWith("ATI") ||
|
||||
f.Name.EndsWith("NV") ||
|
||||
f.Name.EndsWith("SUN") ||
|
||||
f.Name.EndsWith("SUNX") ||
|
||||
f.Name.EndsWith("SGI") ||
|
||||
f.Name.EndsWith("SGIS") ||
|
||||
f.Name.EndsWith("SGIX") ||
|
||||
f.Name.EndsWith("MESA") ||
|
||||
f.Name.EndsWith("3DFX") ||
|
||||
f.Name.EndsWith("IBM") ||
|
||||
f.Name.EndsWith("GREMEDY") ||
|
||||
f.Name.EndsWith("HP") ||
|
||||
f.Name.EndsWith("INTEL") ||
|
||||
f.Name.EndsWith("PGI") ||
|
||||
f.Name.EndsWith("INGR") ||
|
||||
f.Name.EndsWith("APPLE"))
|
||||
f.Extension = true;
|
||||
|
||||
do
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
line = line.Replace('\t', ' ');
|
||||
|
||||
string[] words = line.Split(Translation.Separators, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (String.IsNullOrEmpty(line) || words.Length == 0)
|
||||
break;
|
||||
|
||||
switch (words[0])
|
||||
{
|
||||
case "return":
|
||||
f.ReturnValue = words[1];
|
||||
break;
|
||||
case "param":
|
||||
Parameter p = new Parameter();
|
||||
p.Name = words[1];
|
||||
p.Flow = words[3] == "in" ? Parameter.FlowDirection.In : Parameter.FlowDirection.Out;
|
||||
p.Type = words[2];
|
||||
if (words[4] == "array")
|
||||
p.Array = true;
|
||||
f.Parameters.Add(p);
|
||||
break;
|
||||
case "version":
|
||||
f.Version = words[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (!sr.EndOfStream);
|
||||
|
||||
functions.Add(f);
|
||||
}
|
||||
}
|
||||
while (!sr.EndOfStream);
|
||||
|
||||
return functions;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Read constant specs
|
||||
[Obsolete]
|
||||
public static List<Constant> ReadConstantSpecs(string file)
|
||||
{
|
||||
List<Constant> constants = new List<Constant>();
|
||||
|
||||
string path = Path.Combine(Settings.InputPath, file);
|
||||
StreamReader sr;
|
||||
|
||||
try
|
||||
{
|
||||
sr = new StreamReader(path);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine("Error opening spec file: {0}", path);
|
||||
return null;
|
||||
}
|
||||
Console.WriteLine("Reading constant specs from file: {0}", file);
|
||||
|
||||
do
|
||||
{
|
||||
string line = sr.ReadLine().Trim();
|
||||
|
||||
if (String.IsNullOrEmpty(line) ||
|
||||
line.StartsWith("#") || // Disregard comments.
|
||||
line.StartsWith("passthru") || // Disregard passthru statements.
|
||||
line.StartsWith("required-props:") ||
|
||||
line.StartsWith("param:") ||
|
||||
line.StartsWith("dlflags:") ||
|
||||
line.StartsWith("glxflags:") ||
|
||||
line.StartsWith("vectorequiv:") ||
|
||||
line.StartsWith("category:") ||
|
||||
line.StartsWith("version:") ||
|
||||
line.StartsWith("glxsingle:") ||
|
||||
line.StartsWith("glxropcode:") ||
|
||||
line.StartsWith("glxvendorpriv:") ||
|
||||
line.StartsWith("glsflags:") ||
|
||||
line.StartsWith("glsopcode:") ||
|
||||
line.StartsWith("glsalias:") ||
|
||||
line.StartsWith("wglflags:") ||
|
||||
line.StartsWith("extension:") ||
|
||||
line.StartsWith("alias:") ||
|
||||
line.StartsWith("offset:") ||
|
||||
line.Contains("enum:"))
|
||||
continue;
|
||||
|
||||
line = line.Replace('\t', ' ');
|
||||
|
||||
string[] words = line.Split(Translation.Separators, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (words.Length == 0)
|
||||
continue;
|
||||
|
||||
Constant c = new Constant();
|
||||
if (line.Contains("="))
|
||||
{
|
||||
c.Name = words[0];
|
||||
c.Value = words[2];
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(c.Name) && !ListContainsConstant(constants, c))
|
||||
constants.Add(c);
|
||||
}
|
||||
while (!sr.EndOfStream);
|
||||
|
||||
return constants;
|
||||
}
|
||||
|
||||
public static bool ListContainsConstant(List<Constant> constants, Constant c)
|
||||
{
|
||||
foreach (Constant d in constants)
|
||||
if (d.Name == c.Name)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Read enum specs
|
||||
|
||||
public static Hashtable ReadEnumSpecs(string file)
|
||||
{
|
||||
Hashtable enums = new Hashtable();
|
||||
|
||||
string path = Path.Combine(Settings.InputPath, file);
|
||||
StreamReader sr;
|
||||
|
||||
try
|
||||
{
|
||||
sr = new StreamReader(path);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine("Error opening spec file: {0}", path);
|
||||
return null;
|
||||
}
|
||||
Console.WriteLine("Reading enum specs from file: {0}", file);
|
||||
|
||||
do
|
||||
{
|
||||
string line = sr.ReadLine().Trim();
|
||||
|
||||
if (String.IsNullOrEmpty(line) ||
|
||||
line.StartsWith("#") || // Disregard comments.
|
||||
line.StartsWith("passthru") || // Disregard passthru statements.
|
||||
line.StartsWith("required-props:") ||
|
||||
line.StartsWith("param:") ||
|
||||
line.StartsWith("dlflags:") ||
|
||||
line.StartsWith("glxflags:") ||
|
||||
line.StartsWith("vectorequiv:") ||
|
||||
line.StartsWith("category:") ||
|
||||
line.StartsWith("version:") ||
|
||||
line.StartsWith("glxsingle:") ||
|
||||
line.StartsWith("glxropcode:") ||
|
||||
line.StartsWith("glxvendorpriv:") ||
|
||||
line.StartsWith("glsflags:") ||
|
||||
line.StartsWith("glsopcode:") ||
|
||||
line.StartsWith("glsalias:") ||
|
||||
line.StartsWith("wglflags:") ||
|
||||
line.StartsWith("extension:") ||
|
||||
line.StartsWith("alias:") ||
|
||||
line.StartsWith("offset:"))
|
||||
continue;
|
||||
|
||||
line = line.Replace('\t', ' ');
|
||||
|
||||
while (line.Contains("enum") && !sr.EndOfStream)
|
||||
{
|
||||
string[] words = line.Split(Translation.Separators, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (words.Length == 0)
|
||||
continue;
|
||||
|
||||
Enum e = new Enum();
|
||||
e.Name = words[0];
|
||||
|
||||
do
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
|
||||
if (String.IsNullOrEmpty(line) || line.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
if (line.Contains("enum:") || sr.EndOfStream)
|
||||
break;
|
||||
|
||||
line = line.Replace('\t', ' ');
|
||||
|
||||
words = line.Split(Translation.Separators, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (words.Length == 0)
|
||||
continue;
|
||||
|
||||
Constant c = new Constant();
|
||||
if (words[0] == "use")
|
||||
{
|
||||
c.Name = words[2];
|
||||
c.Value = words[1] + "." + words[2];
|
||||
}
|
||||
|
||||
if (line.Contains("="))
|
||||
{
|
||||
c.Name = words[0];
|
||||
c.Value = words[2];
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(c.Name) && !e.ConstantCollection.ContainsKey(c.Name))
|
||||
e.ConstantCollection.Add(c.Name, c);
|
||||
}
|
||||
while (!sr.EndOfStream);
|
||||
|
||||
if (enums.ContainsKey(e.Name))
|
||||
{
|
||||
//Merge keys:
|
||||
foreach (Constant c in e.ConstantCollection.Values)
|
||||
{
|
||||
if (!((Enum)enums[e.Name]).ConstantCollection.ContainsKey(c.Name))
|
||||
((Enum)enums[e.Name]).ConstantCollection.Add(c.Name, c);
|
||||
}
|
||||
}
|
||||
else
|
||||
enums.Add(e.Name, e);
|
||||
}
|
||||
}
|
||||
while (!sr.EndOfStream);
|
||||
|
||||
return enums;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Read type map
|
||||
|
||||
public static Dictionary<string, string> ReadTypeMap(string file)
|
||||
{
|
||||
Dictionary<string, string> map = new Dictionary<string, string>();
|
||||
|
||||
string path = Path.Combine(Settings.InputPath, file);
|
||||
StreamReader sr;
|
||||
|
||||
try
|
||||
{
|
||||
sr = new StreamReader(path);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine("Error opening typemap file: {0}", path);
|
||||
return null;
|
||||
}
|
||||
Console.WriteLine("Reading typemaps from file: {0}", file);
|
||||
|
||||
do
|
||||
{
|
||||
string line = sr.ReadLine();
|
||||
|
||||
if (String.IsNullOrEmpty(line) || line.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
string[] words = line.Split(new char[] { ' ', ',', '*', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (words[0] == "void") // Special case for "void" -> ""
|
||||
map.Add("void", String.Empty);
|
||||
else if (words[0] == "VoidPointer") // Special case for "VoidPointer" -> "GLvoid*"
|
||||
map.Add("VoidPointer", "IntPtr");
|
||||
else if (words[0] == "CharPointer")
|
||||
map.Add("CharPointer", "string");
|
||||
else
|
||||
map.Add(words[0], words[1]);
|
||||
}
|
||||
while (!sr.EndOfStream);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
18
Source/OpenGL/Bind/Settings.cs
Normal file
18
Source/OpenGL/Bind/Settings.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* Copyright (c) 2006 Stephen Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
static class Settings
|
||||
{
|
||||
public static string InputPath = "..\\..\\Specifications";
|
||||
public static string OutputPath = "..\\..\\Source\\OpenGL\\OpenGL\\Bindings";
|
||||
public static string OutputClass = "GL";
|
||||
public static string OutputNamespace = "OpenTK.OpenGL";
|
||||
}
|
||||
}
|
91
Source/OpenGL/Bind/Structures/Constant.cs
Normal file
91
Source/OpenGL/Bind/Structures/Constant.cs
Normal file
|
@ -0,0 +1,91 @@
|
|||
/* Copyright (c) 2006 Stephen Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an opengl constant in C# format. Both the constant name and value
|
||||
/// can be retrieved or set. All opengl constants are translated to 'const uint'.
|
||||
/// </summary>
|
||||
public class Constant
|
||||
{
|
||||
#region Name
|
||||
|
||||
string _name;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the opengl constant (eg. GL_LINES).
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set
|
||||
{
|
||||
if (!String.IsNullOrEmpty(value))
|
||||
_name = value.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Value
|
||||
|
||||
string _value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the opengl constant (eg. 0x00000001).
|
||||
/// </summary>
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
if (!String.IsNullOrEmpty(value))
|
||||
_value = value.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Creates an empty Constant.
|
||||
/// </summary>
|
||||
public Constant()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a Constant with the given name and value.
|
||||
/// </summary>
|
||||
/// <param name="name">The Name of the Constant.</param>
|
||||
/// <param name="value">The Type of the Constant.</param>
|
||||
public Constant(string name, string value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper functions
|
||||
|
||||
/// <summary>
|
||||
/// Returns a string that represents the full constant declaration without decorations
|
||||
/// (eg const uint GL_XXX_YYY = 0xDEADBEEF).
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
new public string ToString()
|
||||
{
|
||||
return Name + " = " + Value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
44
Source/OpenGL/Bind/Structures/Enum.cs
Normal file
44
Source/OpenGL/Bind/Structures/Enum.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* Copyright (c) 2006 Stephen Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
public class Enum
|
||||
{
|
||||
string _name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
System.Collections.Hashtable _constant_collection = new System.Collections.Hashtable();
|
||||
|
||||
public System.Collections.Hashtable ConstantCollection
|
||||
{
|
||||
get { return _constant_collection; }
|
||||
set { _constant_collection = value; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine(" public enum " + Name + " : uint");
|
||||
sb.AppendLine(" {");
|
||||
foreach (Constant c in ConstantCollection.Values)
|
||||
{
|
||||
sb.AppendLine(" " + c.Name + " = " + c.Value + ",");
|
||||
}
|
||||
sb.AppendLine(" }");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
130
Source/OpenGL/Bind/Structures/Function.cs
Normal file
130
Source/OpenGL/Bind/Structures/Function.cs
Normal file
|
@ -0,0 +1,130 @@
|
|||
/* Copyright (c) 2006 Stephen Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an opengl function.
|
||||
/// The return value, function name, function parameters and opengl version can be retrieved or set.
|
||||
/// </summary>
|
||||
public class Function
|
||||
{
|
||||
#region Needs wrapper property
|
||||
|
||||
bool _needs_wrapper;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether this function needs to be wrapped with a Marshaling function.
|
||||
/// This flag is set if a function contains an Array parameter, or returns
|
||||
/// an Array or string.
|
||||
/// </summary>
|
||||
public bool NeedsWrapper
|
||||
{
|
||||
get { return _needs_wrapper; }
|
||||
set { _needs_wrapper = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Return value property
|
||||
|
||||
string _return_value;
|
||||
/// <summary>
|
||||
/// Gets or sets the return value of the opengl function.
|
||||
/// </summary>
|
||||
public string ReturnValue
|
||||
{
|
||||
get { return _return_value; }
|
||||
set { _return_value = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Name property
|
||||
|
||||
string _name;
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the opengl function.
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set
|
||||
{
|
||||
if (!String.IsNullOrEmpty(value))
|
||||
_name = value.Trim();
|
||||
else
|
||||
_name = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Parameter collection property
|
||||
|
||||
ParameterCollection _parameters = new ParameterCollection();
|
||||
|
||||
public ParameterCollection Parameters
|
||||
{
|
||||
get { return _parameters; }
|
||||
set { _parameters = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Version property
|
||||
|
||||
string _version;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the opengl version that introduced this function.
|
||||
/// </summary>
|
||||
public string Version
|
||||
{
|
||||
get { return _version; }
|
||||
set { _version = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Extension property
|
||||
|
||||
bool _extension = false;
|
||||
|
||||
public bool Extension
|
||||
{
|
||||
get { return _extension; }
|
||||
set { _extension = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public Function()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ToString function
|
||||
|
||||
/// <summary>
|
||||
/// Gets the string representing the full function declaration without decorations
|
||||
/// (ie "void glClearColor(float red, float green, float blue, float alpha)"
|
||||
/// </summary>
|
||||
override public string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(ReturnValue + " " + Name + Parameters.ToString());
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
127
Source/OpenGL/Bind/Structures/Parameter.cs
Normal file
127
Source/OpenGL/Bind/Structures/Parameter.cs
Normal file
|
@ -0,0 +1,127 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single parameter of an opengl function.
|
||||
/// </summary>
|
||||
public class Parameter
|
||||
{
|
||||
#region Name property
|
||||
|
||||
string _name;
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the parameter.
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region _unmanaged_type property
|
||||
|
||||
UnmanagedType _unmanaged_type;
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the parameter.
|
||||
/// </summary>
|
||||
public UnmanagedType UnmanagedType
|
||||
{
|
||||
get { return _unmanaged_type; }
|
||||
set { _unmanaged_type = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Type property
|
||||
|
||||
string _type;
|
||||
/// <summary>
|
||||
/// Gets the type of the parameter.
|
||||
/// </summary>
|
||||
public string Type
|
||||
{
|
||||
get { return _type; }
|
||||
set { _type = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Flow property
|
||||
|
||||
/// <summary>
|
||||
/// Enumarates the possible flows of a parameter (ie. is this parameter
|
||||
/// used as input or as output?)
|
||||
/// </summary>
|
||||
public enum FlowDirection
|
||||
{
|
||||
Undefined = 0,
|
||||
In,
|
||||
Out
|
||||
}
|
||||
|
||||
FlowDirection _flow;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow of the parameter.
|
||||
/// </summary>
|
||||
public FlowDirection Flow
|
||||
{
|
||||
get { return _flow; }
|
||||
set { _flow = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Array property
|
||||
|
||||
bool _array = false;
|
||||
|
||||
public bool Array
|
||||
{
|
||||
get { return _array; }
|
||||
set { _array = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Parameter without type and name.
|
||||
/// </summary>
|
||||
public Parameter() { }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ToString function
|
||||
override public string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (UnmanagedType == UnmanagedType.AsAny && Flow == FlowDirection.In)
|
||||
sb.Append("[MarshalAs(UnmanagedType.AsAny)] ");
|
||||
|
||||
if (UnmanagedType == UnmanagedType.LPArray)
|
||||
sb.Append("[MarshalAs(UnmanagedType.LPArray)] ");
|
||||
|
||||
if (Flow == FlowDirection.Out && !Array)
|
||||
sb.Append("out ");
|
||||
|
||||
sb.Append(Type);
|
||||
if (Array)
|
||||
sb.Append("[]");
|
||||
|
||||
sb.Append(" ");
|
||||
sb.Append(Name);
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
48
Source/OpenGL/Bind/Structures/ParameterCollection.cs
Normal file
48
Source/OpenGL/Bind/Structures/ParameterCollection.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* Copyright (c) 2006 Stephen Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
public class ParameterCollection : List<Parameter>
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public ParameterCollection()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
override public string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("(");
|
||||
if (this.Count > 0)
|
||||
{
|
||||
foreach (Parameter p in this)
|
||||
{
|
||||
sb.Append(p.ToString());
|
||||
sb.Append(", ");
|
||||
}
|
||||
sb.Replace(", ", ")", sb.Length - 2, 2);
|
||||
}
|
||||
else
|
||||
sb.Append(")");
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public bool ContainsType(string type)
|
||||
{
|
||||
foreach (Parameter p in this)
|
||||
if (p.Type == type)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
306
Source/OpenGL/Bind/TranslateSpecs.cs
Normal file
306
Source/OpenGL/Bind/TranslateSpecs.cs
Normal file
|
@ -0,0 +1,306 @@
|
|||
/* Copyright (c) 2006 Stephen Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
static class Translation
|
||||
{
|
||||
public static char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' };
|
||||
|
||||
#region Dictionaries
|
||||
|
||||
static Dictionary<string, string> parameter_names = new Dictionary<string, string>();
|
||||
//static Dictionary<string, string> parameter_types = new Dictionary<string, string>();
|
||||
|
||||
private static Dictionary<string, string> _gl_types;
|
||||
public static Dictionary<string, string> GLtypes
|
||||
{
|
||||
get { return Translation._gl_types; }
|
||||
set { Translation._gl_types = value; }
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> _cs_types;
|
||||
|
||||
public static Dictionary<string, string> CStypes
|
||||
{
|
||||
get { return Translation._cs_types; }
|
||||
set { Translation._cs_types = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
static Translation()
|
||||
{
|
||||
// Names
|
||||
parameter_names.Add("base", "@base");
|
||||
parameter_names.Add("object", "@object");
|
||||
parameter_names.Add("string", "@string");
|
||||
parameter_names.Add("ref", "reference");
|
||||
parameter_names.Add("params", "parameters");
|
||||
parameter_names.Add("in", "@in");
|
||||
|
||||
#region Commented out
|
||||
|
||||
//// Types
|
||||
//parameter_types.Add("Boolean", "bool");
|
||||
//parameter_types.Add("BooleanPointer", "bool[]");
|
||||
//parameter_types.Add("Char", "char");
|
||||
//parameter_types.Add("CharPointer", "string");
|
||||
|
||||
//parameter_types.Add("CheckedFloat32", "float");
|
||||
//parameter_types.Add("CheckedInt32", "int");
|
||||
|
||||
//parameter_types.Add("ClampedColorF", "float");
|
||||
//parameter_types.Add("ClampedFloat32", "float");
|
||||
//parameter_types.Add("ClampedFloat64", "double");
|
||||
//parameter_types.Add("ClampedStencilValue", "int");
|
||||
|
||||
//parameter_types.Add("ColorB", "byte");
|
||||
//parameter_types.Add("ColorS", "short");
|
||||
//parameter_types.Add("ColorI", "int");
|
||||
//parameter_types.Add("ColorUB", "byte");
|
||||
//parameter_types.Add("ColorUS", "ushort");
|
||||
//parameter_types.Add("ColorUI", "uint");
|
||||
//parameter_types.Add("ColorF", "float");
|
||||
//parameter_types.Add("ColorD", "double");
|
||||
|
||||
//parameter_types.Add("ColorIndexValueD", "double");
|
||||
//parameter_types.Add("ColorIndexValueF", "float");
|
||||
//parameter_types.Add("ColorIndexValueI", "int");
|
||||
//parameter_types.Add("ColorIndexValueS", "short");
|
||||
//parameter_types.Add("ColorIndexValueUB", "byte");
|
||||
|
||||
//parameter_types.Add("CompressedTextureARB", "void");
|
||||
//parameter_types.Add("ControlPointNV", "void");
|
||||
|
||||
//parameter_types.Add("CoordF", "float");
|
||||
//parameter_types.Add("CoordD", "double");
|
||||
//parameter_types.Add("CoordI", "int");
|
||||
//parameter_types.Add("CoordS", "short");
|
||||
|
||||
//parameter_types.Add("FeedbackElement", "float");
|
||||
//parameter_types.Add("FenceNV", "uint");
|
||||
|
||||
///////////////////////////////////////
|
||||
//parameter_types.Add("Int8", "byte");
|
||||
//parameter_types.Add("Int16", "short");
|
||||
//parameter_types.Add("Int32", "int");
|
||||
//parameter_types.Add("UInt8", "byte");
|
||||
//parameter_types.Add("UInt16", "ushort");
|
||||
//parameter_types.Add("UInt32", "uint");
|
||||
//parameter_types.Add("Float32", "float");
|
||||
//parameter_types.Add("Float64", "double");
|
||||
|
||||
//parameter_types.Add("ConstFloat32", "float");
|
||||
//parameter_types.Add("ConstInt32", "double");
|
||||
//parameter_types.Add("ConstUInt32", "uint");
|
||||
//parameter_types.Add("ConstVoid", "void");
|
||||
//parameter_types.Add("ConstVoidPointer", "void[]");
|
||||
|
||||
//parameter_types.Add("String", "string");
|
||||
//parameter_types.Add("Void", "void");
|
||||
//parameter_types.Add("VoidPointer", "void[]");
|
||||
//parameter_types.Add("void", "void");
|
||||
|
||||
//parameter_types.Add("Float32Pointer", "float");
|
||||
//parameter_types.Add("Float32Double", "double");
|
||||
/////////////////////////////////////////
|
||||
|
||||
//parameter_types.Add("List", "uint");
|
||||
//parameter_types.Add("SizeI", "int");
|
||||
//parameter_types.Add("LineStipple", "ushort");
|
||||
//parameter_types.Add("WinCoord", "int");
|
||||
|
||||
//parameter_types.Add("Texture", "uint");
|
||||
//parameter_types.Add("TextureComponentCount", "int");
|
||||
|
||||
//parameter_types.Add("SelectName", "uint");
|
||||
|
||||
//parameter_types.Add("MaskedColorIndexValueF", "float");
|
||||
//parameter_types.Add("MaskedColorIndexValueI", "uint");
|
||||
//parameter_types.Add("MaskedStencilValue", "uint");
|
||||
//parameter_types.Add("StencilValue", "int");
|
||||
|
||||
//parameter_types.Add("handleARB", "uint");
|
||||
//parameter_types.Add("charARB", "char"); // Maybe this should be byte?
|
||||
//parameter_types.Add("charPointerARB", "string");
|
||||
|
||||
//parameter_types.Add("GLenum", "uint");
|
||||
|
||||
//parameter_types.Add("VertexBufferSize", "IntPtr");
|
||||
//parameter_types.Add("VertexBufferOffset", "IntPtr");
|
||||
//parameter_types.Add("VertexBufferSizeARB", "IntPtr");
|
||||
//parameter_types.Add("VertexBufferOffsetARB", "IntPtr");
|
||||
|
||||
//parameter_types.Add("IglooParameterSGIX", "IntPtr");
|
||||
|
||||
//parameter_types.Add("Half16NV", "ushort");
|
||||
//parameter_types.Add("PixelDataRangeTargetNV", "uint");
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Translate constants
|
||||
public static List<Constant> TranslateConstants(List<Constant> constants)
|
||||
{
|
||||
uint value;
|
||||
|
||||
foreach (Constant c in constants)
|
||||
{
|
||||
c.Name = "GL_" + c.Name;
|
||||
if (!Char.IsDigit(c.Value[0]) && !c.Value.StartsWith("GL_"))
|
||||
c.Value = "GL_" + c.Value;
|
||||
//if (String.CompareOrdinal(c.Value, "0x7FFFFFFF") > 0)
|
||||
if (UInt32.TryParse(c.Value.Replace("0x", String.Empty), System.Globalization.NumberStyles.AllowHexSpecifier, null, out value))
|
||||
if (value > 0x7FFFFFFF)
|
||||
c.Value = "unchecked((int)" + c.Value + ")";
|
||||
}
|
||||
return constants;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Translate functions
|
||||
public static void TranslateFunctions(List<Function> functions, Hashtable enums, out List<Function> wrappers)
|
||||
{
|
||||
wrappers = new List<Function>();
|
||||
|
||||
foreach (Function f in functions)
|
||||
{
|
||||
TranslateReturnValue(f, enums);
|
||||
TranslateParameters(f, enums);
|
||||
Function wrapper = GenerateWrapper(f);
|
||||
if (wrapper != null)
|
||||
wrappers.Add(wrapper);
|
||||
|
||||
if (f.NeedsWrapper)
|
||||
f.Name = f.Name + "_";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TranslateReturnValue
|
||||
private static void TranslateReturnValue(Function f, Hashtable enums)
|
||||
{
|
||||
string s;
|
||||
|
||||
if (f.ReturnValue == "void")
|
||||
return;
|
||||
|
||||
if (GLtypes.TryGetValue(f.ReturnValue, out s))
|
||||
f.ReturnValue = s;
|
||||
//if (CStypes.TryGetValue(f.ReturnValue, out s))
|
||||
// f.ReturnValue = s;
|
||||
|
||||
if (f.ReturnValue == "void[]")
|
||||
{
|
||||
f.ReturnValue = "IntPtr";
|
||||
}
|
||||
|
||||
if (f.ReturnValue == "string")
|
||||
{
|
||||
f.ReturnValue = "IntPtr";
|
||||
}
|
||||
|
||||
if (f.ReturnValue == "IntPtr")
|
||||
{
|
||||
f.NeedsWrapper = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region TranslateParameters
|
||||
private static void TranslateParameters(Function f, Hashtable enums)
|
||||
{
|
||||
string s;
|
||||
|
||||
// Map parameters.
|
||||
foreach (Parameter p in f.Parameters)
|
||||
{
|
||||
if (parameter_names.TryGetValue(p.Name, out s))
|
||||
p.Name = s;
|
||||
|
||||
if (enums.ContainsKey(p.Type))
|
||||
{
|
||||
p.Type = "Enums." + p.Type;
|
||||
continue;
|
||||
}
|
||||
else if (GLtypes.TryGetValue(p.Type, out s))
|
||||
p.Type = s;
|
||||
//if (CStypes.TryGetValue(p.Type, out s))
|
||||
// p.Type = s;
|
||||
|
||||
if (p.Array && !p.Type.Contains("void"))
|
||||
{
|
||||
p.UnmanagedType = System.Runtime.InteropServices.UnmanagedType.LPArray;
|
||||
}
|
||||
else if (p.Array && p.Type.Contains("void"))
|
||||
{
|
||||
p.Array = false;
|
||||
p.Type = "IntPtr";
|
||||
f.NeedsWrapper = true;
|
||||
}
|
||||
|
||||
//if (p.Flow == Parameter.FlowDirection.Out && p.Type.Contains("string"))
|
||||
// p.Type.Replace("string", "StringBuilder");
|
||||
|
||||
//if (p.Type.Contains("[][]"))
|
||||
//{
|
||||
// p.Type = "ref " + p.Type.Replace("[][]", "[]");
|
||||
//}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GenerateWrapper
|
||||
private static Function GenerateWrapper(Function f)
|
||||
{
|
||||
if (!f.NeedsWrapper)
|
||||
return null;
|
||||
|
||||
// These do not need wrapping!
|
||||
if (f.Name.Contains("TexImage") || f.Name.Contains("TexSubImage"))
|
||||
{
|
||||
f.NeedsWrapper = false;
|
||||
return null;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Translate enums
|
||||
|
||||
public static void TranslateEnums(System.Collections.Hashtable enums)
|
||||
{
|
||||
foreach (Enum e in enums.Values)
|
||||
{
|
||||
if (Char.IsDigit(e.Name[0]))
|
||||
e.Name = e.Name.Insert(0, "_");
|
||||
|
||||
if (e.Name == "Boolean")
|
||||
continue;
|
||||
|
||||
foreach (Constant c in e.ConstantCollection.Values)
|
||||
{
|
||||
if (Char.IsDigit(c.Name[0]))
|
||||
c.Name = c.Name.Insert(0, "_");
|
||||
|
||||
if (c.Value.Contains(".") && Char.IsDigit(c.Value[c.Value.IndexOf('.') + 1]))
|
||||
c.Value = c.Value.Insert(c.Value.IndexOf('.') + 1, "_");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
108
Source/OpenGL/Bind/WriteContexts.cs
Normal file
108
Source/OpenGL/Bind/WriteContexts.cs
Normal file
|
@ -0,0 +1,108 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
static class ContextWriter
|
||||
{
|
||||
public static void WriteMainContext(string output_path, List<Function> functions)
|
||||
{
|
||||
string filename = Path.Combine(output_path, "ContextLoad.cs");
|
||||
|
||||
if (!Directory.Exists(Settings.OutputPath))
|
||||
Directory.CreateDirectory(Settings.OutputPath);
|
||||
|
||||
StreamWriter sw = new StreamWriter(filename, false);
|
||||
|
||||
Console.WriteLine("Writing Context.Load() function to {1}", Settings.OutputClass, filename);
|
||||
|
||||
SpecWriter.WriteLicense(sw);
|
||||
|
||||
sw.WriteLine("using System;");
|
||||
sw.WriteLine("using System.Runtime.InteropServices;");
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("namespace {0}", Settings.OutputNamespace);
|
||||
sw.WriteLine("{");
|
||||
sw.WriteLine(" public abstract partial class Context");
|
||||
sw.WriteLine(" {");
|
||||
|
||||
sw.WriteLine(" #region OpenGL function loading");
|
||||
sw.WriteLine();
|
||||
sw.WriteLine(" public virtual void Load()");
|
||||
sw.WriteLine(" {");
|
||||
|
||||
foreach (Function f in functions)
|
||||
{
|
||||
sw.WriteLine(" {2}.{0} = ({2}.Delegates.{0})GetAddress(\"gl{1}\", typeof({2}.Delegates.{0}));", f.Name, f.Name.TrimEnd('_'), Settings.OutputClass);
|
||||
}
|
||||
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine("}");
|
||||
sw.WriteLine();
|
||||
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
public static void WriteDerivedContext(string output_path, string class_name, List<Function> functions, params string[] import_list)
|
||||
{
|
||||
string filename = Path.Combine(output_path, class_name + "Load.cs");
|
||||
|
||||
if (!Directory.Exists(Settings.OutputPath))
|
||||
Directory.CreateDirectory(Settings.OutputPath);
|
||||
|
||||
StreamWriter sw = new StreamWriter(filename, false);
|
||||
|
||||
Console.WriteLine("Writing {0}.Load() function to {1}", class_name, filename);
|
||||
|
||||
SpecWriter.WriteLicense(sw);
|
||||
|
||||
sw.WriteLine("using System;");
|
||||
sw.WriteLine("using System.Runtime.InteropServices;");
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("namespace {0}.Platform", Settings.OutputNamespace);
|
||||
sw.WriteLine("{");
|
||||
sw.WriteLine(" public partial class {0}", class_name);
|
||||
sw.WriteLine(" {");
|
||||
|
||||
sw.WriteLine(" #region OpenGL core and extension function loading");
|
||||
sw.WriteLine();
|
||||
sw.WriteLine(" public override void Load()");
|
||||
sw.WriteLine(" {");
|
||||
sw.WriteLine(" base.Load();");
|
||||
|
||||
foreach (Function f in functions)
|
||||
{
|
||||
if (IsImportFunction(f, import_list))
|
||||
sw.WriteLine(" {0}.{1} = new {0}.Delegates.{1}({0}.Imports.{1});", Settings.OutputClass, f.Name);
|
||||
}
|
||||
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine("}");
|
||||
sw.WriteLine();
|
||||
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
#region IsImport
|
||||
private static bool IsImportFunction(Function f, string[] import_list)
|
||||
{
|
||||
if (f.Extension)
|
||||
return false;
|
||||
|
||||
foreach (string version in import_list)
|
||||
if (f.Version == version)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
322
Source/OpenGL/Bind/WriteSpecs.cs
Normal file
322
Source/OpenGL/Bind/WriteSpecs.cs
Normal file
|
@ -0,0 +1,322 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
/* Copyright (c) 2006 Stephen Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections;
|
||||
|
||||
namespace OpenTK.OpenGL.Bind
|
||||
{
|
||||
static partial class SpecWriter
|
||||
{
|
||||
#region WriteSpecs
|
||||
public static void WriteSpecs(string output_path, List<Function> functions, List<Function> wrappers, Hashtable enums)
|
||||
{
|
||||
string filename = Path.Combine(output_path, Settings.OutputClass + ".cs");
|
||||
|
||||
if (!Directory.Exists(Settings.OutputPath))
|
||||
Directory.CreateDirectory(Settings.OutputPath);
|
||||
|
||||
StreamWriter sw = new StreamWriter(filename, false);
|
||||
|
||||
Console.WriteLine("Writing {0} class to {1}", Settings.OutputClass, filename);
|
||||
|
||||
WriteLicense(sw);
|
||||
|
||||
sw.WriteLine("using System;");
|
||||
sw.WriteLine("using System.Runtime.InteropServices;");
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("namespace {0}", Settings.OutputNamespace);
|
||||
sw.WriteLine("{");
|
||||
|
||||
WriteTypes(sw);
|
||||
WriteEnums(sw, enums);
|
||||
|
||||
sw.WriteLine(" public static partial class {0}", Settings.OutputClass);
|
||||
sw.WriteLine(" {");
|
||||
|
||||
WriteFunctionSignatures(sw, functions);
|
||||
WriteDllImports(sw, functions);
|
||||
WriteFunctions(sw, functions);
|
||||
WriteWrappers(sw, wrappers);
|
||||
//WriteConstructor(sw, functions);
|
||||
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine("}");
|
||||
sw.WriteLine();
|
||||
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static void WriteLicense(StreamWriter sw)
|
||||
{
|
||||
}
|
||||
|
||||
#region WriteTypes
|
||||
private static void WriteTypes(StreamWriter sw)
|
||||
{
|
||||
sw.WriteLine(" #region Types");
|
||||
//foreach ( c in constants)
|
||||
foreach (string key in Translation.CStypes.Keys)
|
||||
{
|
||||
sw.WriteLine(" using {0} = System.{1};", key, Translation.CStypes[key]);
|
||||
//sw.WriteLine(" public const {0};", c.ToString());
|
||||
}
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Write enums
|
||||
private static void WriteEnums(StreamWriter sw, Hashtable enums)
|
||||
{
|
||||
sw.WriteLine(" #region Enums");
|
||||
sw.WriteLine(" public struct Enums");
|
||||
sw.WriteLine(" {");
|
||||
|
||||
#region Missing constants
|
||||
|
||||
sw.WriteLine(" #region Missing Constants");
|
||||
sw.WriteLine();
|
||||
|
||||
// Version 1.4 enum
|
||||
sw.WriteLine(" const uint GL_FOG_COORDINATE_SOURCE = 0x8450;");
|
||||
sw.WriteLine(" const uint GL_FOG_COORDINATE = 0x8451;");
|
||||
sw.WriteLine(" const uint GL_CURRENT_FOG_COORDINATE = 0x8453;");
|
||||
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY_TYPE = 0x8454;");
|
||||
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY_STRIDE = 0x8455;");
|
||||
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY_POINTER = 0x8456;");
|
||||
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY = 0x8457;");
|
||||
|
||||
// Version 1.5 enum
|
||||
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = 0x889D;");
|
||||
|
||||
// Version 1.3 enum
|
||||
sw.WriteLine(" const uint GL_SOURCE0_RGB = 0x8580;");
|
||||
sw.WriteLine(" const uint GL_SOURCE1_RGB = 0x8581;");
|
||||
sw.WriteLine(" const uint GL_SOURCE2_RGB = 0x8582;");
|
||||
sw.WriteLine(" const uint GL_SOURCE0_ALPHA = 0x8588;");
|
||||
sw.WriteLine(" const uint GL_SOURCE1_ALPHA = 0x8589;");
|
||||
sw.WriteLine(" const uint GL_SOURCE2_ALPHA = 0x858A;");
|
||||
|
||||
// Version 2.0 enum
|
||||
sw.WriteLine(" const uint GL_BLEND_EQUATION = 0x8009;");
|
||||
|
||||
sw.WriteLine(" const uint GL_MODELVIEW_MATRIX = 0x0BA6;");
|
||||
sw.WriteLine(" const uint GL_MODELVIEW = 0x1700;");
|
||||
sw.WriteLine(" const uint GL_MODELVIEW_STACK_DEPTH = 0x0BA3;");
|
||||
|
||||
// NV_texture_shader enum
|
||||
sw.WriteLine(" const uint GL_OFFSET_TEXTURE_MATRIX_NV = 0x86E1;");
|
||||
sw.WriteLine(" const uint GL_OFFSET_TEXTURE_SCALE_NV = 0x86E2;");
|
||||
sw.WriteLine(" const uint GL_OFFSET_TEXTURE_BIAS_NV = 0x86E3;");
|
||||
|
||||
sw.WriteLine();
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine();
|
||||
|
||||
#endregion
|
||||
|
||||
foreach (Enum e in enums.Values)
|
||||
{
|
||||
sw.WriteLine(e.ToString());
|
||||
}
|
||||
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Write function signatures
|
||||
private static void WriteFunctionSignatures(StreamWriter sw, List<Function> functions)
|
||||
{
|
||||
sw.WriteLine(" #region Function signatures");
|
||||
sw.WriteLine();
|
||||
sw.WriteLine(" public static class Delegates");
|
||||
sw.WriteLine(" {");
|
||||
|
||||
foreach (Function f in functions)
|
||||
{
|
||||
sw.WriteLine(" public delegate {0};", f.ToString());
|
||||
}
|
||||
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Write dll imports
|
||||
private static void WriteDllImports(StreamWriter sw, List<Function> functions)
|
||||
{
|
||||
sw.WriteLine(" #region Imports");
|
||||
sw.WriteLine();
|
||||
sw.WriteLine(" internal class Imports");
|
||||
sw.WriteLine(" {");
|
||||
|
||||
foreach (Function f in functions)
|
||||
{
|
||||
if (!f.Extension)
|
||||
{
|
||||
sw.WriteLine(" [DllImport(\"opengl32\", EntryPoint = \"gl{0}\")]", f.Name.TrimEnd('_'));
|
||||
sw.WriteLine(" public static extern {0};", f.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Write functions
|
||||
private static void WriteFunctions(StreamWriter sw, List<Function> functions)
|
||||
{
|
||||
sw.WriteLine(" #region Function initialisation");
|
||||
sw.WriteLine();
|
||||
|
||||
foreach (Function f in functions)
|
||||
{
|
||||
sw.WriteLine(" public static Delegates.{0} {0};", f.Name);
|
||||
}
|
||||
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Write wrappers
|
||||
|
||||
public static void WriteWrappers(StreamWriter sw, List<Function> wrappers)
|
||||
{
|
||||
sw.WriteLine(" #region Wrappers");
|
||||
sw.WriteLine();
|
||||
|
||||
foreach (Function f in wrappers)
|
||||
{
|
||||
// Hack! Should implement these in the future.
|
||||
if (f.Extension)
|
||||
continue;
|
||||
|
||||
if (f.Parameters.ToString().Contains("out IntPtr"))
|
||||
continue;
|
||||
|
||||
if (f.Parameters.ToString().Contains("IntPtr[]"))
|
||||
continue;
|
||||
|
||||
sw.WriteLine(" #region {0}", f.Name.TrimEnd('_'));
|
||||
|
||||
if (f.Name == "glGetString")
|
||||
{
|
||||
sw.WriteLine(" public static {0} {1}{2}", "string", f.Name.TrimEnd('_'), f.Parameters.ToString());
|
||||
sw.WriteLine(" {");
|
||||
sw.WriteLine(" return Marshal.PtrToStringAnsi(glGetString_({0}));", f.Parameters[0].Name);
|
||||
sw.WriteLine(" }");
|
||||
|
||||
}
|
||||
else if (f.Parameters.ToString().Contains("IntPtr"))
|
||||
{
|
||||
sw.WriteLine(" public static {0} {1}{2}", f.ReturnValue, f.Name.TrimEnd('_'), f.Parameters.ToString().Replace("IntPtr", "object"));
|
||||
sw.WriteLine(" {");
|
||||
int i = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("(");
|
||||
foreach (Parameter p in f.Parameters)
|
||||
{
|
||||
if (p.Type == "IntPtr")
|
||||
{
|
||||
sw.WriteLine(" GCHandle h{0} = GCHandle.Alloc({1}, GCHandleType.Pinned);", i, p.Name);
|
||||
sb.Append("h" + i + ".AddrOfPinnedObject()" + ", ");
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(p.Name + ", ");
|
||||
}
|
||||
}
|
||||
sb.Replace(", ", ")", sb.Length - 2, 2);
|
||||
|
||||
sw.WriteLine(" try");
|
||||
sw.WriteLine(" {");
|
||||
if (f.ReturnValue == "void")
|
||||
sw.WriteLine(" {0}{1};", f.Name, sb.ToString());
|
||||
else
|
||||
sw.WriteLine(" return {0}{1};", f.Name, sb.ToString());
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine(" finally");
|
||||
sw.WriteLine(" {");
|
||||
while (i > 0)
|
||||
{
|
||||
sw.WriteLine(" h{0}.Free();", --i);
|
||||
}
|
||||
sw.WriteLine(" }");
|
||||
sw.WriteLine(" }");
|
||||
}
|
||||
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine();
|
||||
}
|
||||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine();
|
||||
|
||||
// if (fw.Parameters.ContainsType("object"))
|
||||
// {
|
||||
// Function f = WeakNameLookup(fw.Name, FunctionCollection);
|
||||
|
||||
// sw.WriteLine(" public {0} {1}{2}", fw.ReturnValue, fw.Name, fw.Parameters.ToString());
|
||||
// sw.WriteLine(" {");
|
||||
|
||||
// int i = 0;
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// sb.Append("(");
|
||||
// foreach (Parameter p in fw.Parameters)
|
||||
// {
|
||||
// if (p.Type == "object")
|
||||
// {
|
||||
// sw.WriteLine(" GCHandle h{0} = GCHandle.Alloc({1}, GCHandleType.Pinned);", i, p.Name);
|
||||
// sb.Append("h" + i + ".AddrOfPinnedObject()" + ", ");
|
||||
// i++;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// sb.Append(p.Name + ", ");
|
||||
// }
|
||||
// }
|
||||
// sb.Replace(", ", ")", sb.Length - 2, 2);
|
||||
|
||||
// sw.WriteLine(" try");
|
||||
// sw.WriteLine(" {");
|
||||
// if (fw.ReturnValue == "void")
|
||||
// sw.WriteLine(" {0}{1};", f.Name, sb.ToString());
|
||||
// else
|
||||
// sw.WriteLine(" return {0}{1};", f.Name, sb.ToString());
|
||||
// sw.WriteLine(" }");
|
||||
// sw.WriteLine(" finally");
|
||||
// sw.WriteLine(" {");
|
||||
// while (i > 0)
|
||||
// {
|
||||
// sw.WriteLine(" h{0}.Free();", --i);
|
||||
// }
|
||||
// sw.WriteLine(" }");
|
||||
// sw.WriteLine(" }");
|
||||
// sw.WriteLine();
|
||||
// }
|
||||
|
||||
//sw.WriteLine(" #endregion");
|
||||
//sw.WriteLine(" }");
|
||||
//sw.WriteLine("}");
|
||||
|
||||
//sw.Flush();
|
||||
//sw.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
1438
Source/OpenGL/OpenGL/Bindings/ContextLoad.cs
Normal file
1438
Source/OpenGL/OpenGL/Bindings/ContextLoad.cs
Normal file
File diff suppressed because it is too large
Load diff
9487
Source/OpenGL/OpenGL/Bindings/GL.cs
Normal file
9487
Source/OpenGL/OpenGL/Bindings/GL.cs
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -19,8 +19,7 @@ namespace OpenTK.OpenGL
|
|||
public abstract System.Delegate GetAddress(string function_string, Type function_type);
|
||||
public abstract void MakeCurrent();
|
||||
|
||||
public abstract void Load();
|
||||
public abstract void LoadExtensions();
|
||||
//public abstract void LoadExtensions();
|
||||
|
||||
public abstract void Dispose();
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ namespace OpenTK.OpenGL.Platform
|
|||
|
||||
Load();
|
||||
|
||||
if (load_extensions)
|
||||
LoadExtensions();
|
||||
//if (load_extensions)
|
||||
// LoadExtensions();
|
||||
}
|
||||
|
||||
public override void SwapBuffers()
|
||||
|
|
|
@ -97,8 +97,8 @@ namespace OpenTK.OpenGL.Platform
|
|||
|
||||
Load();
|
||||
|
||||
if (load_extensions)
|
||||
LoadExtensions();
|
||||
//if (load_extensions)
|
||||
// LoadExtensions();
|
||||
}
|
||||
|
||||
public override void SwapBuffers()
|
||||
|
|
|
@ -42,13 +42,12 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Glu.cs" />
|
||||
<Compile Include="Bindings\GLConstants.cs" />
|
||||
<Compile Include="Bindings\GLFunctions.cs" />
|
||||
<Compile Include="Bindings\GLWrappers.cs" />
|
||||
<Compile Include="Bindings\ContextLoad.cs" />
|
||||
<Compile Include="Bindings\GL.cs" />
|
||||
<Compile Include="Bindings\WindowsContextLoad.cs" />
|
||||
<Compile Include="Bindings\WindowsVistaContextLoad.cs" />
|
||||
<Compile Include="Bindings\X11ContextLoad.cs" />
|
||||
<Compile Include="Glu.cs" />
|
||||
<Compile Include="Contexts\Context.cs" />
|
||||
<Compile Include="Contexts\WindowsContext.cs" />
|
||||
<Compile Include="Contexts\WindowsVistaContext.cs" />
|
||||
|
|
|
@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
|
|||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenGL")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyTitle("OpenGL assembly")]
|
||||
[assembly: AssemblyDescription("Provides bindings to the OpenGL functions.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("OpenGL")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2006")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2006 Stefanos Apostolopoulos")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("0.3.1.0")]
|
||||
[assembly: AssemblyFileVersion("0.3.1.0")]
|
||||
[assembly: AssemblyVersion("0.3.1.1")]
|
||||
[assembly: AssemblyFileVersion("0.3.1.1")]
|
||||
|
|
29
Specifications/cs_types.txt
Normal file
29
Specifications/cs_types.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
# ARB and NV types (these should come before normal types to guard against double translation).
|
||||
GLsizeiptrARB, IntPtr
|
||||
GLintptrARB, IntPtr
|
||||
GLhandleARB, Int32 #UInt32
|
||||
GLhalfARB, Int16 #UInt16
|
||||
GLhalfNV, Int16 #UInt16
|
||||
GLcharARB, Char
|
||||
|
||||
# Normal types.
|
||||
GLsizeiptr, IntPtr
|
||||
GLintptr, IntPtr
|
||||
GLenum, Int32
|
||||
GLboolean, Boolean
|
||||
GLbitfield, Int32 #UInt32
|
||||
# GLvoid*, IntPtr
|
||||
# GLvoid, void
|
||||
GLchar, Char
|
||||
GLbyte, SByte
|
||||
GLshort, Int16
|
||||
GLint, Int32
|
||||
GLubyte, SByte
|
||||
GLushort, Int16 #UInt16
|
||||
GLuint, Int32 #UInt32
|
||||
GLsizei, Int32
|
||||
GLfloat, Single
|
||||
GLclampf, Single
|
||||
GLdouble, Double
|
||||
GLclampd, Double
|
||||
GLstring, String
|
282
Specifications/gl_types.txt
Normal file
282
Specifications/gl_types.txt
Normal file
|
@ -0,0 +1,282 @@
|
|||
AccumOp,*,*, GLenum,*,*
|
||||
AlphaFunction,*,*, GLenum,*,*
|
||||
AttribMask,*,*, GLbitfield,*,*
|
||||
BeginMode,*,*, GLenum,*,*
|
||||
BinormalPointerTypeEXT,*,*, GLenum,*,*
|
||||
BlendEquationMode,*,*, GLenum,*,*
|
||||
BlendEquationModeEXT,*,*, GLenum,*,*
|
||||
BlendFuncSeparateParameterEXT,*,*, GLenum,*,*
|
||||
BlendingFactorDest,*,*, GLenum,*,*
|
||||
BlendingFactorSrc,*,*, GLenum,*,*
|
||||
Boolean,*,*, GLboolean,*,*
|
||||
BooleanPointer,*,*, GLboolean*,*,*
|
||||
Char,*,*, GLchar,*,*
|
||||
CharPointer,*,*, GLchar*,*,*
|
||||
CheckedFloat32,*,*, GLfloat,*,*
|
||||
CheckedInt32,*,*, GLint,*,*
|
||||
ClampColorTargetARB,*,*, GLenum,*,*
|
||||
ClampColorModeARB,*,*, GLenum,*,*
|
||||
ClampedColorF,*,*, GLclampf,*,*
|
||||
ClampedFloat32,*,*, GLclampf,*,*
|
||||
ClampedFloat64,*,*, GLclampd,*,*
|
||||
ClampedStencilValue,*,*, GLint,*,*
|
||||
ClearBufferMask,*,*, GLbitfield,*,*
|
||||
ClientAttribMask,*,*, GLbitfield,*,*
|
||||
ClipPlaneName,*,*, GLenum,*,*
|
||||
ColorB,*,*, GLbyte,*,*
|
||||
ColorD,*,*, GLdouble,*,*
|
||||
ColorF,*,*, GLfloat,*,*
|
||||
ColorI,*,*, GLint,*,*
|
||||
ColorIndexValueD,*,*, GLdouble,*,*
|
||||
ColorIndexValueF,*,*, GLfloat,*,*
|
||||
ColorIndexValueI,*,*, GLint,*,*
|
||||
ColorIndexValueS,*,*, GLshort,*,*
|
||||
ColorIndexValueUB,*,*, GLubyte,*,*
|
||||
ColorMaterialParameter,*,*, GLenum,*,*
|
||||
ColorPointerType,*,*, GLenum,*,*
|
||||
ColorS,*,*, GLshort,*,*
|
||||
ColorTableParameterPName,*,*, GLenum,*,*
|
||||
ColorTableParameterPNameSGI,*,*, GLenum,*,*
|
||||
ColorTableTarget,*,*, GLenum,*,*
|
||||
ColorTableTargetSGI,*,*, GLenum,*,*
|
||||
ColorUB,*,*, GLubyte,*,*
|
||||
ColorUI,*,*, GLuint,*,*
|
||||
ColorUS,*,*, GLushort,*,*
|
||||
CombinerBiasNV,*,*, GLenum,*,*
|
||||
CombinerComponentUsageNV,*,*, GLenum,*,*
|
||||
CombinerMappingNV,*,*, GLenum,*,*
|
||||
CombinerParameterNV,*,*, GLenum,*,*
|
||||
CombinerPortionNV,*,*, GLenum,*,*
|
||||
CombinerRegisterNV,*,*, GLenum,*,*
|
||||
CombinerScaleNV,*,*, GLenum,*,*
|
||||
CombinerStageNV,*,*, GLenum,*,*
|
||||
CombinerVariableNV,*,*, GLenum,*,*
|
||||
CompressedTextureARB,*,*, GLvoid,*,*
|
||||
ControlPointNV,*,*, GLvoid,*,*
|
||||
ControlPointTypeNV,*,*, GLenum,*,*
|
||||
ConvolutionParameter,*,*, GLenum,*,*
|
||||
ConvolutionParameterEXT,*,*, GLenum,*,*
|
||||
ConvolutionTarget,*,*, GLenum,*,*
|
||||
ConvolutionTargetEXT,*,*, GLenum,*,*
|
||||
CoordD,*,*, GLdouble,*,*
|
||||
CoordF,*,*, GLfloat,*,*
|
||||
CoordI,*,*, GLint,*,*
|
||||
CoordS,*,*, GLshort,*,*
|
||||
CullFaceMode,*,*, GLenum,*,*
|
||||
CullParameterEXT,*,*, GLenum,*,*
|
||||
DepthFunction,*,*, GLenum,*,*
|
||||
DrawBufferMode,*,*, GLenum,*,*
|
||||
DrawElementsType,*,*, GLenum,*,*
|
||||
ElementPointerTypeATI,*,*, GLenum,*,*
|
||||
EnableCap,*,*, GLenum,*,*
|
||||
ErrorCode,*,*, GLenum,*,*
|
||||
EvalMapsModeNV,*,*, GLenum,*,*
|
||||
EvalTargetNV,*,*, GLenum,*,*
|
||||
FeedbackElement,*,*, GLfloat,*,*
|
||||
FeedbackType,*,*, GLenum,*,*
|
||||
FenceNV,*,*, GLuint,*,*
|
||||
FenceConditionNV,*,*, GLenum,*,*
|
||||
FenceParameterNameNV,*,*, GLenum,*,*
|
||||
FfdMaskSGIX,*,*, GLbitfield,*,*
|
||||
FfdTargetSGIX,*,*, GLenum,*,*
|
||||
Float32,*,*, GLfloat,*,*
|
||||
Float32Pointer,*,*, GLfloat*,*,*
|
||||
Float64,*,*, GLdouble,*,*
|
||||
Float64Pointer,*,*, GLdouble*,*,*
|
||||
FogParameter,*,*, GLenum,*,*
|
||||
FogPointerTypeEXT,*,*, GLenum,*,*
|
||||
FogPointerTypeIBM,*,*, GLenum,*,*
|
||||
FragmentLightModelParameterSGIX,*,*,GLenum,*,*
|
||||
FragmentLightNameSGIX,*,*, GLenum,*,*
|
||||
FragmentLightParameterSGIX,*,*, GLenum,*,*
|
||||
FrontFaceDirection,*,*, GLenum,*,*
|
||||
FunctionPointer,*,*, _GLfuncptr,*,*
|
||||
GetColorTableParameterPName,*,*, GLenum,*,*
|
||||
GetColorTableParameterPNameSGI,*,*, GLenum,*,*
|
||||
GetConvolutionParameterPName,*,*, GLenum,*,*
|
||||
GetHistogramParameterPName,*,*, GLenum,*,*
|
||||
GetHistogramParameterPNameEXT,*,*, GLenum,*,*
|
||||
GetMapQuery,*,*, GLenum,*,*
|
||||
GetMinmaxParameterPName,*,*, GLenum,*,*
|
||||
GetMinmaxParameterPNameEXT,*,*, GLenum,*,*
|
||||
GetPName,*,*, GLenum,*,*
|
||||
GetPointervPName,*,*, GLenum,*,*
|
||||
GetTextureParameter,*,*, GLenum,*,*
|
||||
HintMode,*,*, GLenum,*,*
|
||||
HintTarget,*,*, GLenum,*,*
|
||||
HintTargetPGI,*,*, GLenum,*,*
|
||||
HistogramTarget,*,*, GLenum,*,*
|
||||
HistogramTargetEXT,*,*, GLenum,*,*
|
||||
IglooFunctionSelectSGIX,*,*, GLenum,*,*
|
||||
IglooParameterSGIX,*,*, GLvoid,*,*
|
||||
ImageTransformPNameHP,*,*, GLenum,*,*
|
||||
ImageTransformTargetHP,*,*, GLenum,*,*
|
||||
IndexFunctionEXT,*,*, GLenum,*,*
|
||||
IndexMaterialParameterEXT,*,*, GLenum,*,*
|
||||
IndexPointerType,*,*, GLenum,*,*
|
||||
Int16,*,*, GLshort,*,*
|
||||
Int32,*,*, GLint,*,*
|
||||
Int8,*,*, GLbyte,*,*
|
||||
InterleavedArrayFormat,*,*, GLenum,*,*
|
||||
LightEnvParameterSGIX,*,*, GLenum,*,*
|
||||
LightModelParameter,*,*, GLenum,*,*
|
||||
LightName,*,*, GLenum,*,*
|
||||
LightParameter,*,*, GLenum,*,*
|
||||
LightTextureModeEXT,*,*, GLenum,*,*
|
||||
LightTexturePNameEXT,*,*, GLenum,*,*
|
||||
LineStipple,*,*, GLushort,*,*
|
||||
List,*,*, GLuint,*,*
|
||||
ListMode,*,*, GLenum,*,*
|
||||
ListNameType,*,*, GLenum,*,*
|
||||
ListParameterName,*,*, GLenum,*,*
|
||||
LogicOp,*,*, GLenum,*,*
|
||||
MapAttribParameterNV,*,*, GLenum,*,*
|
||||
MapParameterNV,*,*, GLenum,*,*
|
||||
MapTarget,*,*, GLenum,*,*
|
||||
MapTargetNV,*,*, GLenum,*,*
|
||||
MapTypeNV,*,*, GLenum,*,*
|
||||
MaskedColorIndexValueF,*,*, GLfloat,*,*
|
||||
MaskedColorIndexValueI,*,*, GLuint,*,*
|
||||
MaskedStencilValue,*,*, GLuint,*,*
|
||||
MaterialFace,*,*, GLenum,*,*
|
||||
MaterialParameter,*,*, GLenum,*,*
|
||||
MatrixIndexPointerTypeARB,*,*, GLenum,*,*
|
||||
MatrixMode,*,*, GLenum,*,*
|
||||
MatrixTransformNV,*,*, GLenum,*,*
|
||||
MeshMode1,*,*, GLenum,*,*
|
||||
MeshMode2,*,*, GLenum,*,*
|
||||
MinmaxTarget,*,*, GLenum,*,*
|
||||
MinmaxTargetEXT,*,*, GLenum,*,*
|
||||
NormalPointerType,*,*, GLenum,*,*
|
||||
NurbsCallback,*,*, GLenum,*,*
|
||||
NurbsObj,*,*, GLUnurbs*,*,*
|
||||
NurbsProperty,*,*, GLenum,*,*
|
||||
NurbsTrim,*,*, GLenum,*,*
|
||||
OcclusionQueryParameterNameNV,*,*, GLenum,*,*
|
||||
PixelCopyType,*,*, GLenum,*,*
|
||||
PixelFormat,*,*, GLenum,*,*
|
||||
PixelInternalFormat,*,*, GLenum,*,*
|
||||
PixelMap,*,*, GLenum,*,*
|
||||
PixelStoreParameter,*,*, GLenum,*,*
|
||||
PixelTexGenModeSGIX,*,*, GLenum,*,*
|
||||
PixelTexGenParameterNameSGIS,*,*, GLenum,*,*
|
||||
PixelTransferParameter,*,*, GLenum,*,*
|
||||
PixelTransformPNameEXT,*,*, GLenum,*,*
|
||||
PixelTransformTargetEXT,*,*, GLenum,*,*
|
||||
PixelType,*,*, GLenum,*,*
|
||||
PointParameterNameARB,*,*, GLenum,*,*
|
||||
PolygonMode,*,*, GLenum,*,*
|
||||
ProgramNV,*,*, GLuint,*,*
|
||||
ProgramCharacterNV,*,*, GLubyte,*,*
|
||||
ProgramParameterNV,*,*, GLenum,*,*
|
||||
QuadricCallback,*,*, GLenum,*,*
|
||||
QuadricDrawStyle,*,*, GLenum,*,*
|
||||
QuadricNormal,*,*, GLenum,*,*
|
||||
QuadricObj,*,*, GLUquadric*,*,*
|
||||
QuadricOrientation,*,*, GLenum,*,*
|
||||
ReadBufferMode,*,*, GLenum,*,*
|
||||
RenderingMode,*,*, GLenum,*,*
|
||||
ReplacementCodeSUN,*,*, GLuint,*,*
|
||||
ReplacementCodeTypeSUN,*,*, GLenum,*,*
|
||||
SamplePassARB,*,*, GLenum,*,*
|
||||
SamplePatternEXT,*,*, GLenum,*,*
|
||||
SamplePatternSGIS,*,*, GLenum,*,*
|
||||
SecondaryColorPointerTypeIBM,*,*, GLenum,*,*
|
||||
SelectName,*,*, GLuint,*,*
|
||||
SeparableTarget,*,*, GLenum,*,*
|
||||
SeparableTargetEXT,*,*, GLenum,*,*
|
||||
ShadingModel,*,*, GLenum,*,*
|
||||
SizeI,*,*, GLsizei,*,*
|
||||
SpriteParameterNameSGIX,*,*, GLenum,*,*
|
||||
StencilFunction,*,*, GLenum,*,*
|
||||
StencilFaceDirection,*,*, GLenum,*,*
|
||||
StencilOp,*,*, GLenum,*,*
|
||||
StencilValue,*,*, GLint,*,*
|
||||
String,*,*, GLstring,*,*
|
||||
StringName,*,*, GLenum,*,*
|
||||
TangentPointerTypeEXT,*,*, GLenum,*,*
|
||||
TessCallback,*,*, GLenum,*,*
|
||||
TessContour,*,*, GLenum,*,*
|
||||
TessProperty,*,*, GLenum,*,*
|
||||
TesselatorObj,*,*, GLUtesselator*,*,*
|
||||
TexCoordPointerType,*,*, GLenum,*,*
|
||||
Texture,*,*, GLuint,*,*
|
||||
TextureComponentCount,*,*, GLint,*,*
|
||||
TextureCoordName,*,*, GLenum,*,*
|
||||
TextureEnvParameter,*,*, GLenum,*,*
|
||||
TextureEnvTarget,*,*, GLenum,*,*
|
||||
TextureFilterSGIS,*,*, GLenum,*,*
|
||||
TextureGenParameter,*,*, GLenum,*,*
|
||||
TextureNormalModeEXT,*,*, GLenum,*,*
|
||||
TextureParameterName,*,*, GLenum,*,*
|
||||
TextureTarget,*,*, GLenum,*,*
|
||||
TextureUnit,*,*, GLenum,*,*
|
||||
UInt16,*,*, GLushort,*,*
|
||||
UInt32,*,*, GLuint,*,*
|
||||
UInt8,*,*, GLubyte,*,*
|
||||
VertexAttribEnumNV,*,*, GLenum,*,*
|
||||
VertexAttribPointerTypeNV,*,*, GLenum,*,*
|
||||
VertexPointerType,*,*, GLenum,*,*
|
||||
VertexWeightPointerTypeEXT,*,*, GLenum,*,*
|
||||
Void,*,*, GLvoid,*,*
|
||||
VoidPointer,*,*, GLvoid*,*,*
|
||||
ConstVoidPointer,*,*, GLvoid* const,*,*
|
||||
WeightPointerTypeARB,*,*, GLenum,*,*
|
||||
WinCoord,*,*, GLint,*,*
|
||||
void,*,*, *,*,*
|
||||
ArrayObjectPNameATI,*,*, GLenum,*,*
|
||||
ArrayObjectUsageATI,*,*, GLenum,*,*,
|
||||
ConstFloat32,*,*, GLfloat,*,*
|
||||
ConstInt32,*,*, GLint,*,*
|
||||
ConstUInt32,*,*, GLuint,*,*
|
||||
ConstVoid,*,*, GLvoid,*,*
|
||||
DataTypeEXT,*,*, GLenum,*,*
|
||||
FragmentOpATI,*,*, GLenum,*,*
|
||||
GetTexBumpParameterATI,*,*, GLenum,*,*
|
||||
GetVariantValueEXT,*,*, GLenum,*,*
|
||||
ParameterRangeEXT,*,*, GLenum,*,*
|
||||
PreserveModeATI,*,*, GLenum,*,*
|
||||
ProgramFormatARB,*,*, GLenum,*,*
|
||||
ProgramTargetARB,*,*, GLenum,*,*
|
||||
ProgramPropertyARB,*,*, GLenum,*,*
|
||||
ProgramStringPropertyARB,*,*, GLenum,*,*
|
||||
ScalarType,*,*, GLenum,*,*
|
||||
SwizzleOpATI,*,*, GLenum,*,*
|
||||
TexBumpParameterATI,*,*, GLenum,*,*
|
||||
VariantCapEXT,*,*, GLenum,*,*
|
||||
VertexAttribPointerPropertyARB,*,*, GLenum,*,*
|
||||
VertexAttribPointerTypeARB,*,*, GLenum,*,*
|
||||
VertexAttribPropertyARB,*,*, GLenum,*,*
|
||||
VertexShaderCoordOutEXT,*,*, GLenum,*,*
|
||||
VertexShaderOpEXT,*,*, GLenum,*,*
|
||||
VertexShaderParameterEXT,*,*, GLenum,*,*
|
||||
VertexShaderStorageTypeEXT,*,*, GLenum,*,*
|
||||
VertexShaderTextureUnitParameter,*,*, GLenum,*,*
|
||||
VertexShaderWriteMaskEXT,*,*, GLenum,*,*
|
||||
VertexStreamATI,*,*, GLenum,*,*
|
||||
PNTrianglesPNameATI,*,*, GLenum,*,*
|
||||
# ARB_vertex_buffer_object types and core equivalents for new types
|
||||
VertexBufferOffset,*,*, GLintptr,*,*
|
||||
VertexBufferSize,*,*, GLsizeiptr,*,*
|
||||
VertexBufferAccessARB,*,*, GLenum,*,*
|
||||
VertexBufferOffsetARB,*,*, GLintptrARB,*,*
|
||||
VertexBufferPNameARB,*,*, GLenum,*,*
|
||||
VertexBufferPointerNameARB,*,*, GLenum,*,*
|
||||
VertexBufferSizeARB,*,*, GLsizeiptrARB,*,*
|
||||
VertexBufferTargetARB,*,*, GLenum,*,*
|
||||
VertexBufferUsageARB,*,*, GLenum,*,*
|
||||
# APPLE_fence
|
||||
ObjectTypeAPPLE,*,*, GLenum,*,*
|
||||
# APPLE_vertex_array_range
|
||||
VertexArrayPNameAPPLE,*,*, GLenum,*,*
|
||||
# ATI_draw_buffers
|
||||
DrawBufferModeATI,*,*, GLenum,*,*
|
||||
# NV_half
|
||||
Half16NV,*,*, GLhalfNV,*,*
|
||||
# NV_pixel_data_range
|
||||
PixelDataRangeTargetNV,*,*, GLenum,*,*
|
||||
# Generic types for as-yet-unspecified enums
|
||||
GLenum,*,*, GLenum,*,*
|
||||
handleARB,*,*, GLhandleARB,*,*
|
||||
charARB,*,*, GLcharARB,*,*
|
||||
charPointerARB,*,*, GLcharARB*,*,*
|
13
Todo.txt
Normal file
13
Todo.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
Todo:
|
||||
+ Add more examples (e.g. the GLSL example I wrote, some of kanato's examples etc).
|
||||
+ Change the hierarchy of the WindowsContext and WindowsVistaContext classes. The should have a common ancestor who manages the windows creation (it should be the same for both).
|
||||
+ Add more constructors to the WindowsContext classes. This probably needs updating of the WinAPI assembly.
|
||||
+ Add X11Context constructors.
|
||||
+ Find out what is needed for the MacOS platform (how to do function loading and window management without X11).
|
||||
+ Add full bindings to Glu, Wgl, Glx and Agl.
|
||||
+ Add the Math module.
|
||||
+ Research and add the Input module.
|
||||
+ Review and add the timer module.
|
||||
+ Review and add the OpenAL module.
|
||||
+ Add projects for MonoDevelop.
|
||||
+ See if using Nant for building is a good idea.
|
5
changelog.txt
Normal file
5
changelog.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
OpenTK 0.3.0 -> 0.3.1
|
||||
+ Updated the binding generator to version 0.7.4, based on the work done for Tao.
|
||||
+ Updated the Context load functions. Now Context loads all functions are extensions, and the derived classes override this behavior as needed.
|
||||
+ Changed the uint array used in the DisplayLists example to an int array.
|
||||
+ Added the changelog! :)
|
Loading…
Reference in a new issue