This commit is contained in:
the_fiddler 2006-10-10 23:40:36 +00:00
parent b3a5341848
commit 7096709104
21 changed files with 911 additions and 426 deletions

View file

@ -10,12 +10,25 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documentation", "Documentat
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\csharp.tm = Specifications\csharp.tm
Specifications\enum.spec = Specifications\enum.spec
Specifications\enumext.spec = Specifications\enumext.spec
Specifications\enumglu.spec = Specifications\enumglu.spec
Specifications\gl.spec = Specifications\gl.spec
Specifications\gl_types.txt = Specifications\gl_types.txt
Specifications\gl.tm = Specifications\gl.tm
Specifications\glu.spec = Specifications\glu.spec
Specifications\glx.spec = Specifications\glx.spec
Specifications\glx.tm = Specifications\glx.tm
Specifications\glxenum.spec = Specifications\glxenum.spec
Specifications\glxenumext.spec = Specifications\glxenumext.spec
Specifications\glxext.spec = Specifications\glxext.spec
Specifications\try.spec = Specifications\try.spec
Specifications\TypeMap.txt = Specifications\TypeMap.txt
Specifications\wgl.spec = Specifications\wgl.spec
Specifications\wgl.tm = Specifications\wgl.tm
Specifications\wglenum.spec = Specifications\wglenum.spec
Specifications\wglenumext.spec = Specifications\wglenumext.spec
Specifications\wglext.spec = Specifications\wglext.spec
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{E9FF51BB-295E-4891-AA30-D1374F26DCE0}"
@ -47,6 +60,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenGL", "OpenGL", "{70FA6E
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GLSL.Lesson01", "Source\Examples\OpenGL\GLSL\Lesson01\GLSL.Lesson01.csproj", "{46980D11-67FA-4B33-903F-BC9D8A4FE60F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Platform.X", "Source\Platform\X\OpenTK.Platform.X.csproj", "{E3F35BD6-67CE-4AD5-AB98-043CF072A75A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -69,6 +84,10 @@ Global
{46980D11-67FA-4B33-903F-BC9D8A4FE60F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46980D11-67FA-4B33-903F-BC9D8A4FE60F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46980D11-67FA-4B33-903F-BC9D8A4FE60F}.Release|Any CPU.Build.0 = Release|Any CPU
{E3F35BD6-67CE-4AD5-AB98-043CF072A75A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3F35BD6-67CE-4AD5-AB98-043CF072A75A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3F35BD6-67CE-4AD5-AB98-043CF072A75A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3F35BD6-67CE-4AD5-AB98-043CF072A75A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -82,6 +101,7 @@ Global
{30996477-EDDE-4E45-AB3D-5E466314C755} = {7E640424-E2CD-4DD5-9392-7A706D73930E}
{2F3FEAD4-0FBD-48CC-AFA0-29FFF28284C2} = {7E640424-E2CD-4DD5-9392-7A706D73930E}
{FDFA00B6-FA81-4658-86E1-F312EFB42E1C} = {50DCE788-72FC-47E0-A6BD-50BCCE3FCE5B}
{E3F35BD6-67CE-4AD5-AB98-043CF072A75A} = {50DCE788-72FC-47E0-A6BD-50BCCE3FCE5B}
{836876D1-0C8D-4240-BEE4-859D9D3D46CB} = {2F3FEAD4-0FBD-48CC-AFA0-29FFF28284C2}
{1EDDE592-3923-4898-9006-3D69579E1745} = {2F3FEAD4-0FBD-48CC-AFA0-29FFF28284C2}
{70FA6EE8-62C6-437F-AD82-117F2D9CDE68} = {C6E60A87-12B4-444A-BE03-7E980EAC0172}

View file

@ -8,7 +8,6 @@ using System.Text;
using System.IO;
using System.Security;
using System.Security.Permissions;
//using Settings = Tao.OpenGl.Bind.Properties.Bind;
using System.Threading;
using System.Collections.Generic;
using System.Collections;
@ -48,7 +47,7 @@ namespace OpenTK.OpenGL.Bind
Settings.OutputPath = b[1];
break;
case "class":
Settings.OutputClass = b[1];
Settings.GLClass = b[1];
break;
default:
throw new ArgumentException("Argument " + a + " not recognized. Use the '/?' switch for help.");
@ -73,10 +72,11 @@ namespace OpenTK.OpenGL.Bind
{
long ticks = System.DateTime.Now.Ticks;
// GL binding generation.
List<Function> wrappers;
List<Function> functions = SpecReader.ReadFunctionSpecs("gl.spec");
Hashtable enums = SpecReader.ReadEnumSpecs("enum.spec");
Hashtable enums2= SpecReader.ReadEnumSpecs("enumext.spec");
Hashtable enums2 = SpecReader.ReadEnumSpecs("enumext.spec");
foreach (Enum e in enums2.Values)
if (!enums.ContainsKey(e.Name))
enums.Add(e.Name, e);
@ -87,18 +87,24 @@ namespace OpenTK.OpenGL.Bind
((Enum)enums[e.Name]).ConstantCollection.Add(c.Name, c);
}
Translation.GLtypes = SpecReader.ReadTypeMap("gl.tm");
Translation.CStypes = SpecReader.ReadTypeMap("cs_types.txt");
Translation.GLTypes = SpecReader.ReadTypeMap("gl.tm");
Translation.CSTypes = SpecReader.ReadTypeMap("csharp.tm");
Translation.TranslateFunctions(functions, enums, out wrappers);
Translation.TranslateEnums(enums);
SpecWriter.WriteSpecs(Settings.OutputPath, functions, wrappers, enums);
SpecWriter.WriteSpecs(Settings.OutputPath, Settings.GLClass, functions, wrappers, enums);
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");
ContextWriter.WriteMainContext(Settings.OutputPath, "GLContext", Settings.GLClass, functions);
ContextWriter.WriteDerivedContext(Settings.OutputPath, "WindowsContext", Settings.GLClass, functions, "1.0", "1.1");
ContextWriter.WriteDerivedContext(Settings.OutputPath, "WindowsVistaContext", Settings.GLClass, functions, "1.0", "1.1", "1.2", "1.3", "1.4");
ContextWriter.WriteDerivedContext(Settings.OutputPath, "X11Context", Settings.GLClass, functions, "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "2.0");
// GLX binding generation.
//Translation.GLXTypes = SpecReader.ReadTypeMap("glx.tm"); // Works semi-ok.
//functions = SpecReader.ReadFunctionSpecs("glx.spec"); // Works ok!
//Hashtable enums = SpecReader.ReadEnumSpecs("glxenum.spec"); // Works ok!
//SpecWriter.WriteSpecs(Settings.OutputPath, "Glx", functions, null, enums); // Needs updating.
ticks = System.DateTime.Now.Ticks - ticks;
@ -109,11 +115,6 @@ namespace OpenTK.OpenGL.Bind
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...");
// Console.ReadKey(false);
//}
}
}
}

View file

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.7.5.2")]
[assembly: AssemblyFileVersion("0.7.5.2")]
[assembly: AssemblyVersion("0.7.6.0")]
[assembly: AssemblyFileVersion("0.7.6.0")]

View file

@ -13,7 +13,7 @@ namespace OpenTK.OpenGL.Bind
{
public static string InputPath = "..\\..\\Specifications";
public static string OutputPath = "..\\..\\Source\\OpenGL\\OpenGL\\Bindings";
public static string OutputClass = "GL";
public static string GLClass = "GL";
public static string OutputNamespace = "OpenTK.OpenGL";
}
}

View file

@ -37,7 +37,7 @@ namespace OpenTK.OpenGL.Bind
{
sb.AppendLine(" " + c.Name + " = " + c.Value + ",");
}
sb.AppendLine(" }");
sb.AppendLine(" }");
return sb.ToString();
}

View file

@ -34,16 +34,23 @@ namespace OpenTK.OpenGL.Bind
static Dictionary<string, string> parameter_names = new Dictionary<string, string>();
#region GL types dictionary
private static Dictionary<string, string> _gl_types;
public static Dictionary<string, string> GLtypes
public static Dictionary<string, string> GLTypes
{
get { return Translation._gl_types; }
set { Translation._gl_types = value; }
}
#endregion
#region CS types dictionary
private static Dictionary<string, string> _cs_types;
public static Dictionary<string, string> CStypes
public static Dictionary<string, string> CSTypes
{
get { return Translation._cs_types; }
set { Translation._cs_types = value; }
@ -51,6 +58,32 @@ namespace OpenTK.OpenGL.Bind
#endregion
#region GLX types dictionary
private static Dictionary<string, string> _glx_types;
public static Dictionary<string, string> GLXTypes
{
get { return _glx_types; }
set { _glx_types = value; }
}
#endregion
#region WGL types dictionary
private static Dictionary<string, string> _wgl_types;
public static Dictionary<string, string> WGLTypes
{
get { return _wgl_types; }
set { _wgl_types = value; }
}
#endregion
#endregion
#region Constructor
static Translation()
@ -62,6 +95,7 @@ namespace OpenTK.OpenGL.Bind
parameter_names.Add("ref", "reference");
parameter_names.Add("params", "parameters");
parameter_names.Add("in", "@in");
parameter_names.Add("class", "@class");
}
#endregion
@ -116,7 +150,7 @@ namespace OpenTK.OpenGL.Bind
if (f.ReturnValue == "void")
return;
if (GLtypes.TryGetValue(f.ReturnValue, out s))
if (GLTypes.TryGetValue(f.ReturnValue, out s))
f.ReturnValue = s;
if (f.ReturnValue == "void[]")
@ -167,7 +201,7 @@ namespace OpenTK.OpenGL.Bind
if (enums.ContainsKey(f.Category))
p.Type = "Enums." + f.Category;
}
else if (GLtypes.TryGetValue(p.Type, out s))
else if (GLTypes.TryGetValue(p.Type, out s))
p.Type = s;
#endregion

View file

@ -13,7 +13,7 @@ namespace OpenTK.OpenGL.Bind
static class ContextWriter
{
#region Write main context
public static void WriteMainContext(string output_path, List<Function> functions)
public static void WriteMainContext(string output_path, string class_name, string gl_class_name, List<Function> functions)
{
string filename = Path.Combine(output_path, "GLContextLoad.cs");
@ -22,7 +22,7 @@ namespace OpenTK.OpenGL.Bind
StreamWriter sw = new StreamWriter(filename, false);
Console.WriteLine("Writing Context.Load() function to {1}", Settings.OutputClass, filename);
Console.WriteLine("Writing Context.Load() function to {1}", class_name, filename);
SpecWriter.WriteLicense(sw);
@ -41,7 +41,7 @@ namespace OpenTK.OpenGL.Bind
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(" {2}.{0} = ({2}.Delegates.{0})GetAddress(\"gl{1}\", typeof({2}.Delegates.{0}));", f.Name, f.Name.TrimEnd('_'), gl_class_name);
}
sw.WriteLine(" }");
@ -56,7 +56,7 @@ namespace OpenTK.OpenGL.Bind
#endregion
#region Write derived context
public static void WriteDerivedContext(string output_path, string class_name, List<Function> functions, params string[] import_list)
public static void WriteDerivedContext(string output_path, string class_name, string gl_class_name, List<Function> functions, params string[] import_list)
{
string filename = Path.Combine(output_path, class_name + "Load.cs");
@ -86,7 +86,7 @@ namespace OpenTK.OpenGL.Bind
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(" {0}.{1} = new {0}.Delegates.{1}({0}.Imports.{1});", gl_class_name, f.Name);
}
sw.WriteLine(" }");

View file

@ -15,16 +15,16 @@ 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)
public static void WriteSpecs(string output_path, string class_name, List<Function> functions, List<Function> wrappers, Hashtable enums)
{
string filename = Path.Combine(output_path, Settings.OutputClass + ".cs");
string filename = Path.Combine(output_path, class_name + ".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);
Console.WriteLine("Writing {0} class to {1}", class_name, filename);
WriteLicense(sw);
@ -38,7 +38,7 @@ namespace OpenTK.OpenGL.Bind
WriteTypes(sw);
WriteEnums(sw, enums);
sw.WriteLine(" public static partial class {0}", Settings.OutputClass);
sw.WriteLine(" public static partial class {0}", class_name);
sw.WriteLine(" {");
WriteFunctionSignatures(sw, functions);
@ -71,9 +71,9 @@ namespace OpenTK.OpenGL.Bind
{
sw.WriteLine(" #region Types");
//foreach ( c in constants)
foreach (string key in Translation.CStypes.Keys)
foreach (string key in Translation.CSTypes.Keys)
{
sw.WriteLine(" using {0} = System.{1};", key, Translation.CStypes[key]);
sw.WriteLine(" using {0} = System.{1};", key, Translation.CSTypes[key]);
//sw.WriteLine(" public const {0};", c.ToString());
}
sw.WriteLine(" #endregion");
@ -185,6 +185,7 @@ namespace OpenTK.OpenGL.Bind
#endregion
#region Write functions
private static void WriteFunctions(StreamWriter sw, List<Function> functions)
{
sw.WriteLine(" #region Function initialisation");
@ -199,27 +200,34 @@ namespace OpenTK.OpenGL.Bind
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 w in wrappers)
if (wrappers != null)
{
sw.WriteLine(" #region {0}{1}", w.Name, w.Parameters.ToString());
sw.WriteLine();
foreach (Function w in wrappers)
{
sw.WriteLine(" #region {0}{1}", w.Name, w.Parameters.ToString());
sw.WriteLine();
sw.WriteLine(" public static");
sw.WriteLine(w.ToString(" "));
sw.WriteLine(" #endregion");
sw.WriteLine();
sw.WriteLine(" public static");
sw.WriteLine(w.ToString(" "));
sw.WriteLine(" #endregion");
sw.WriteLine();
}
}
sw.WriteLine(" #endregion");
}
#endregion
}
}

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,6 @@ namespace OpenTK.OpenGL.Platform
public WindowsContext(Control c, int red, int green, int blue, int alpha, int depth, int stencil)
{
bool load_extensions = false;
int error_code = 0;
_window_handle = c.Handle;
@ -40,7 +39,6 @@ namespace OpenTK.OpenGL.Platform
else
{
//System.Diagnostics.Debug.WriteLine("Loaded dll: {0}", _dll_name);
load_extensions = true;
}
}
@ -110,11 +108,11 @@ namespace OpenTK.OpenGL.Platform
public override Delegate GetAddress(string function_string, Type function_type)
{
int address = Wgl.GetProcAddress(function_string);
if (address == 0)
IntPtr address = Wgl.GetProcAddress(function_string);
if (address == IntPtr.Zero)
return null;
else
return Marshal.GetDelegateForFunctionPointer(new IntPtr(address), function_type);
return Marshal.GetDelegateForFunctionPointer(address, function_type);
}
public override void MakeCurrent()

View file

@ -21,7 +21,6 @@ namespace OpenTK.OpenGL.Platform
public WindowsVistaContext(Control c, int red, int green, int blue, int alpha, int depth, int stencil)
{
bool load_extensions = false;
int error_code = 0;
_window_handle = c.Handle;
@ -38,7 +37,6 @@ namespace OpenTK.OpenGL.Platform
else
{
Console.WriteLine("Loaded dll: {0}", _dll_name);
load_extensions = true;
}
}
@ -108,11 +106,11 @@ namespace OpenTK.OpenGL.Platform
public override Delegate GetAddress(string function_string, Type function_type)
{
int address = Wgl.GetProcAddress(function_string);
if (address == 0)
IntPtr address = Wgl.GetProcAddress(function_string);
if (address == IntPtr.Zero)
return null;
else
return Marshal.GetDelegateForFunctionPointer(new IntPtr(address), function_type);
return Marshal.GetDelegateForFunctionPointer(address, function_type);
}
public override void MakeCurrent()

View file

@ -1,38 +1,48 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace OpenTK.OpenGL.Platform
{
public partial class X11Context : OpenTK.OpenGL.GLContext
{
int drawable, context;
const string _dll_name = "opengl.so";
public X11Context(Control c, int red, int green, int blue, int alpha, int depth, int stencil)
{
drawable = c.Handle.ToInt32();
throw new Exception("The method or operation is not implemented.");
}
public override void SwapBuffers()
{
throw new Exception("The method or operation is not implemented.");
Glx.SwapBuffers(drawable);
}
public override Delegate GetAddress(string function_string, Type function_type)
{
throw new Exception("The method or operation is not implemented.");
IntPtr address = Glx.GetProcAddress(function_string);
if (address == IntPtr.Zero)
return null;
else
return Marshal.GetDelegateForFunctionPointer(address, function_type);
}
public override void MakeCurrent()
{
throw new Exception("The method or operation is not implemented.");
Glx.MakeCurrent(drawable, context);
}
const string _dll_name = "opengl.so";
public override void Dispose()
{
throw new Exception("The method or operation is not implemented.");

304
Source/OpenGL/OpenGL/Glx.cs Normal file
View file

@ -0,0 +1,304 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OpenTK.OpenGL
{
#region Types
using GLsizeiptrARB = System.IntPtr;
using GLintptrARB = System.IntPtr;
using GLhandleARB = System.Int32;
using GLhalfARB = System.Int16;
using GLhalfNV = System.Int16;
using GLcharARB = System.Char;
using GLsizei = System.Int32;
using GLsizeiptr = System.IntPtr;
using GLintptr = System.IntPtr;
using GLenum = System.Int32;
using GLboolean = System.Boolean;
using GLbitfield = System.Int32;
using GLchar = System.Char;
using GLbyte = System.Byte;
using GLubyte = System.Byte;
using GLshort = System.Int16;
using GLushort = System.Int16;
using GLint = System.Int32;
using GLuint = System.Int32;
using GLfloat = System.Single;
using GLclampf = System.Single;
using GLdouble = System.Double;
using GLclampd = System.Double;
using GLstring = System.String;
#endregion
/// <summary>
/// Provides access to GLX functions.
/// </summary>
public class Glx
{
const string _dll_name = "glx.so";
#region Enums
public struct Enums
{
public enum GLXAttribute : uint
{
TRANSPARENT_BLUE_VALUE_EXT = 0x27,
GRAY_SCALE = 0x8006,
RGBA_TYPE = 0x8014,
TRANSPARENT_RGB_EXT = 0x8008,
ACCUM_BLUE_SIZE = 16,
SHARE_CONTEXT_EXT = 0x800A,
STEREO = 6,
ALPHA_SIZE = 11,
FLOAT_COMPONENTS_NV = 0x20B0,
NONE = 0x8000,
DEPTH_SIZE = 12,
TRANSPARENT_INDEX_VALUE_EXT = 0x24,
MAX_PBUFFER_WIDTH_SGIX = 0x8016,
GREEN_SIZE = 9,
X_RENDERABLE_SGIX = 0x8012,
LARGEST_PBUFFER = 0x801C,
DONT_CARE = 0xFFFFFFFF,
TRANSPARENT_ALPHA_VALUE_EXT = 0x28,
PSEUDO_COLOR_EXT = 0x8004,
USE_GL = 1,
SAMPLE_BUFFERS_SGIS = 100000,
TRANSPARENT_GREEN_VALUE_EXT = 0x26,
HYPERPIPE_ID_SGIX = 0x8030,
COLOR_INDEX_TYPE_SGIX = 0x8015,
SLOW_CONFIG = 0x8001,
PRESERVED_CONTENTS = 0x801B,
ACCUM_RED_SIZE = 14,
EVENT_MASK = 0x801F,
VISUAL_ID_EXT = 0x800B,
EVENT_MASK_SGIX = 0x801F,
SLOW_VISUAL_EXT = 0x8001,
TRANSPARENT_GREEN_VALUE = 0x26,
MAX_PBUFFER_WIDTH = 0x8016,
DIRECT_COLOR_EXT = 0x8003,
VISUAL_ID = 0x800B,
ACCUM_GREEN_SIZE = 15,
DRAWABLE_TYPE_SGIX = 0x8010,
SCREEN_EXT = 0x800C,
SAMPLES = 100001,
HEIGHT = 0x801E,
TRANSPARENT_INDEX_VALUE = 0x24,
SAMPLE_BUFFERS_ARB = 100000,
PBUFFER = 0x8023,
RGBA_TYPE_SGIX = 0x8014,
MAX_PBUFFER_HEIGHT = 0x8017,
FBCONFIG_ID_SGIX = 0x8013,
DRAWABLE_TYPE = 0x8010,
SCREEN = 0x800C,
RED_SIZE = 8,
VISUAL_SELECT_GROUP_SGIX = 0x8028,
VISUAL_CAVEAT_EXT = 0x20,
PSEUDO_COLOR = 0x8004,
PBUFFER_HEIGHT = 0x8040,
STATIC_GRAY = 0x8007,
PRESERVED_CONTENTS_SGIX = 0x801B,
RGBA_FLOAT_TYPE_ARB = 0x20B9,
TRANSPARENT_RED_VALUE = 0x25,
TRANSPARENT_ALPHA_VALUE = 0x28,
WINDOW = 0x8022,
X_RENDERABLE = 0x8012,
STENCIL_SIZE = 13,
TRANSPARENT_RGB = 0x8008,
LARGEST_PBUFFER_SGIX = 0x801C,
STATIC_GRAY_EXT = 0x8007,
TRANSPARENT_BLUE_VALUE = 0x27,
DIGITAL_MEDIA_PBUFFER_SGIX = 0x8024,
BLENDED_RGBA_SGIS = 0x8025,
NON_CONFORMANT_VISUAL_EXT = 0x800D,
COLOR_INDEX_TYPE = 0x8015,
TRANSPARENT_RED_VALUE_EXT = 0x25,
GRAY_SCALE_EXT = 0x8006,
WINDOW_SGIX = 0x8022,
X_VISUAL_TYPE = 0x22,
MAX_PBUFFER_HEIGHT_SGIX = 0x8017,
DOUBLEBUFFER = 5,
OPTIMAL_PBUFFER_WIDTH_SGIX = 0x8019,
X_VISUAL_TYPE_EXT = 0x22,
WIDTH_SGIX = 0x801D,
STATIC_COLOR_EXT = 0x8005,
BUFFER_SIZE = 2,
DIRECT_COLOR = 0x8003,
MAX_PBUFFER_PIXELS = 0x8018,
NONE_EXT = 0x8000,
HEIGHT_SGIX = 0x801E,
RENDER_TYPE = 0x8011,
FBCONFIG_ID = 0x8013,
TRANSPARENT_INDEX_EXT = 0x8009,
TRANSPARENT_INDEX = 0x8009,
TRANSPARENT_TYPE_EXT = 0x23,
ACCUM_ALPHA_SIZE = 17,
PBUFFER_SGIX = 0x8023,
MAX_PBUFFER_PIXELS_SGIX = 0x8018,
OPTIMAL_PBUFFER_HEIGHT_SGIX = 0x801A,
DAMAGED = 0x8020,
SAVED_SGIX = 0x8021,
TRANSPARENT_TYPE = 0x23,
MULTISAMPLE_SUB_RECT_WIDTH_SGIS = 0x8026,
NON_CONFORMANT_CONFIG = 0x800D,
BLUE_SIZE = 10,
TRUE_COLOR_EXT = 0x8002,
SAMPLES_SGIS = 100001,
SAMPLES_ARB = 100001,
TRUE_COLOR = 0x8002,
RGBA = 4,
AUX_BUFFERS = 7,
SAMPLE_BUFFERS = 100000,
SAVED = 0x8021,
MULTISAMPLE_SUB_RECT_HEIGHT_SGIS = 0x8027,
DAMAGED_SGIX = 0x8020,
STATIC_COLOR = 0x8005,
PBUFFER_WIDTH = 0x8041,
WIDTH = 0x801D,
LEVEL = 3,
CONFIG_CAVEAT = 0x20,
RENDER_TYPE_SGIX = 0x8011,
}
public enum GLXHyperpipeAttrib : uint
{
PIPE_RECT_LIMITS_SGIX = 0x00000002,
PIPE_RECT_SGIX = 0x00000001,
HYPERPIPE_STEREO_SGIX = 0x00000003,
HYPERPIPE_PIXEL_AVERAGE_SGIX = 0x00000004,
}
public enum GLXStringName : uint
{
EXTENSIONS = 0x3,
VERSION = 0x2,
VENDOR = 0x1,
}
public enum GLXEventMask : uint
{
PBUFFER_CLOBBER_MASK = 0x08000000,
BUFFER_CLOBBER_MASK_SGIX = 0x08000000,
}
public enum GLXRenderTypeMask : uint
{
COLOR_INDEX_BIT_SGIX = 0x00000002,
RGBA_BIT = 0x00000001,
RGBA_FLOAT_BIT_ARB = 0x00000004,
RGBA_BIT_SGIX = 0x00000001,
COLOR_INDEX_BIT = 0x00000002,
}
public enum GLXHyperpipeTypeMask : uint
{
HYPERPIPE_RENDER_PIPE_SGIX = 0x00000002,
HYPERPIPE_DISPLAY_PIPE_SGIX = 0x00000001,
}
public enum GLXPbufferClobberMask : uint
{
ACCUM_BUFFER_BIT_SGIX = 0x00000080,
FRONT_LEFT_BUFFER_BIT = 0x00000001,
BACK_RIGHT_BUFFER_BIT = 0x00000008,
FRONT_RIGHT_BUFFER_BIT_SGIX = 0x00000002,
STENCIL_BUFFER_BIT_SGIX = 0x00000040,
SAMPLE_BUFFERS_BIT_SGIX = 0x00000100,
STENCIL_BUFFER_BIT = 0x00000040,
BACK_RIGHT_BUFFER_BIT_SGIX = 0x00000008,
BACK_LEFT_BUFFER_BIT_SGIX = 0x00000004,
AUX_BUFFERS_BIT = 0x00000010,
DEPTH_BUFFER_BIT_SGIX = 0x00000020,
ACCUM_BUFFER_BIT = 0x00000080,
AUX_BUFFERS_BIT_SGIX = 0x00000010,
DEPTH_BUFFER_BIT = 0x00000020,
FRONT_LEFT_BUFFER_BIT_SGIX = 0x00000001,
BACK_LEFT_BUFFER_BIT = 0x00000004,
FRONT_RIGHT_BUFFER_BIT = 0x00000002,
}
public enum GLXHyperpipeMisc : uint
{
HYPERPIPE_PIPE_NAME_LENGTH_SGIX = 80,
}
public enum GLXErrorCode : uint
{
BAD_CONTEXT = 5,
NO_EXTENSION = 3,
BAD_HYPERPIPE_SGIX = 92,
BAD_ENUM = 7,
BAD_SCREEN = 1,
BAD_VALUE = 6,
BAD_ATTRIBUTE = 2,
BAD_VISUAL = 4,
BAD_HYPERPIPE_CONFIG_SGIX = 91,
}
public enum GLXSyncType : uint
{
SYNC_SWAP_SGIX = 0x00000001,
SYNC_FRAME_SGIX = 0x00000000,
}
public enum GLXDrawableTypeMask : uint
{
WINDOW_BIT = 0x00000001,
PIXMAP_BIT = 0x00000002,
PBUFFER_BIT_SGIX = 0x00000004,
PBUFFER_BIT = 0x00000004,
WINDOW_BIT_SGIX = 0x00000001,
PIXMAP_BIT_SGIX = 0x00000002,
}
}
#endregion
#region GLX functions
[DllImport("_dll_name", EntryPoint = "glxCreateContext")]
public static extern void CreateContext(Int32 gc_id, Int32 screen, Int32 visual, Int32 share_list);
[DllImport("_dll_name", EntryPoint = "glxDestroyContext")]
public static extern void DestroyContext(Int32 context);
[DllImport("_dll_name", EntryPoint = "glxMakeCurrent")]
public static extern void MakeCurrent(Int32 drawable, Int32 context);
[DllImport("_dll_name", EntryPoint = "glxSwapBuffers")]
public static extern void SwapBuffers(Int32 drawable);
[DllImport("_dll_name", EntryPoint = "glxGetProcAddress")]
public static extern IntPtr GetProcAddress([MarshalAs(UnmanagedType.LPTStr)] string procName);
//[DllImport("opengl32.dll", EntryPoint = "glCreateWindow")]
//public static extern void CreateWindow(Int32 config, Int32 window, Int32 glxwindow);
//[DllImport("opengl32.dll", EntryPoint = "glDestroyWindow")]
//public static extern void DestroyWindow(Int32 glxwindow);
//[DllImport("opengl32.dll", EntryPoint = "glCreatePixmap")]
//public static extern void CreatePixmap(Int32 config, Int32 pixmap, Int32 glxpixmap);
//[DllImport("opengl32.dll", EntryPoint = "glDestroyPixmap")]
//public static extern void DestroyPixmap(Int32 glxpixmap);
//[DllImport("opengl32.dll", EntryPoint = "glCreateNewContext")]
//public static extern void CreateNewContext(Int32 config, Int32 render_type, Int32 share_list, Int32 direct);
//[DllImport("opengl32.dll", EntryPoint = "glQueryContext")]
//public static extern void QueryContext();
//[DllImport("opengl32.dll", EntryPoint = "glMakeContextCurrent")]
//public static extern void MakeContextCurrent(Int32 drawable, Int32 readdrawable, Int32 context);
//[DllImport("opengl32.dll", EntryPoint = "glCreatePbuffer")]
//public static extern void CreatePbuffer(Int32 config, Int32 pbuffer);
//[DllImport("opengl32.dll", EntryPoint = "glDestroyPbuffer")]
//public static extern void DestroyPbuffer(Int32 pbuffer);
#endregion
}
}

View file

@ -56,6 +56,7 @@
<Compile Include="Contexts\WindowsContext.cs" />
<Compile Include="Contexts\WindowsVistaContext.cs" />
<Compile Include="Contexts\X11Context.cs" />
<Compile Include="Glx.cs" />
<Compile Include="Wgl.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
@ -64,6 +65,10 @@
<Project>{FDFA00B6-FA81-4658-86E1-F312EFB42E1C}</Project>
<Name>OpenTK.Platform.Windows</Name>
</ProjectReference>
<ProjectReference Include="..\..\Platform\X\OpenTK.Platform.X.csproj">
<Project>{E3F35BD6-67CE-4AD5-AB98-043CF072A75A}</Project>
<Name>OpenTK.Platform.X</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -1,6 +1,8 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
@ -239,7 +241,7 @@ namespace OpenTK.OpenGL
public static extern int ShareLists(int r1, int r2);
[DllImport(_dll_name, EntryPoint = "wglGetProcAddress")]
public static extern int GetProcAddress(string funcname);
public static extern IntPtr GetProcAddress(string funcname);
#endregion
}

View file

@ -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.1.0.1")]
[assembly: AssemblyFileVersion("0.1.0.1")]
[assembly: AssemblyVersion("0.1.2.0")]
[assembly: AssemblyFileVersion("0.1.2.0")]

View file

@ -0,0 +1,47 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E3F35BD6-67CE-4AD5-AB98-043CF072A75A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>X</RootNamespace>
<AssemblyName>X</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="XApi.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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("X")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("X")]
[assembly: AssemblyCopyright("Copyright © 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1236132a-311a-430f-922e-18e4cc0aabe3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]

16
Source/Platform/X/XApi.cs Normal file
View file

@ -0,0 +1,16 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Platform.X
{
public class XApi
{
}
}

View file

@ -1,5 +1,10 @@
OpenTK 0.3.4 -> 0.3.5
+ Major update to OpenTK.OpenGL.Bind (cleaner code, new functions, comments and many new wrappers).
+ Laid the foundation for X (Linux, Unix, MacOS) support.
+ Added bindings to some glx functions.
+ Added the OpenTK.Platform.X class.
+ Minor updates to the wgl bindings (int -> IntPtr).
+ Tested the binding generator with the glx specs (the reader and the enum writer work ok, the trnaslator and the other writers need updating).
OpenTK 0.3.3 -> 0.3.4
+ Corrected the crash error in Release mode (it was caused by trying to Marshal the System.Windows.Forms.Message struct to PeekMessage - adding my own Message struct corrected the issue).

View file

@ -1,20 +1,22 @@
Todo:
+ + + Add basic GLX bindings.
+ + + Add basic X bindings.
+ + + Add context creation support for X.
+ + + Test X support.
+ + + Add the CLS compliant attribute to the GL class.
+ + Add cross-platform way for overriding the Application.Idle handler.
+ Add more examples.
+ + 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.
+ + Add more constructors to the Context classes.
+ + Add more GLForm constructors.
+ + Add comments and documentation (faqs, pitfalls, best practices).
+ + Add a cross-platform build system (probably NAnt?)
+ Add more examples.
+ 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 full bindings for glu, wgl, glx and agl (probably generated automatically).
+ 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.
+ + Clean up the code.
+ + Add comments and documentation (faqs, pitfalls, best practices).
+ + + Add the CLS compliant attribute to the GL class.
+ Clean up the code.
+ Add more platform bindings.