mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-08 22:35:38 +00:00
Preparatory work for linux support (added basic X and GLX bindings)
Major update to OpenTK.OpenGL.Bind. Updated OpenGL specs to 2.1 (were 2.0)
This commit is contained in:
parent
83da572596
commit
8cd76686d0
|
@ -49,6 +49,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenGL", "OpenGL", "{2F3FEA
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.OpenGL", "Source\OpenGL\OpenGL\OpenTK.OpenGL.csproj", "{836876D1-0C8D-4240-BEE4-859D9D3D46CB}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1EDDE592-3923-4898-9006-3D69579E1745} = {1EDDE592-3923-4898-9006-3D69579E1745}
|
||||
{FDFA00B6-FA81-4658-86E1-F312EFB42E1C} = {FDFA00B6-FA81-4658-86E1-F312EFB42E1C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
|
@ -10,7 +10,7 @@ using OpenTK.OpenGL;
|
|||
|
||||
namespace OpenTK.Examples.OpenGL.GLSL
|
||||
{
|
||||
public partial class Cube : GLForm
|
||||
public partial class Cube : Framework
|
||||
{
|
||||
#region Shaders
|
||||
string[] vertex_shader_source =
|
||||
|
@ -125,7 +125,7 @@ namespace OpenTK.Examples.OpenGL.GLSL
|
|||
DrawCube();
|
||||
|
||||
Context.SwapBuffers();
|
||||
this.Invalidate();
|
||||
//this.Invalidate();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -73,6 +73,10 @@ namespace OpenTK.OpenGL.Bind
|
|||
long ticks = System.DateTime.Now.Ticks;
|
||||
|
||||
// GL binding generation.
|
||||
|
||||
Translation.GLTypes = SpecReader.ReadTypeMap("gl.tm");
|
||||
Translation.CSTypes = SpecReader.ReadTypeMap("csharp.tm");
|
||||
|
||||
List<Function> wrappers;
|
||||
List<Function> functions = SpecReader.ReadFunctionSpecs("gl.spec");
|
||||
Hashtable enums = SpecReader.ReadEnumSpecs("enum.spec");
|
||||
|
@ -87,9 +91,6 @@ namespace OpenTK.OpenGL.Bind
|
|||
((Enum)enums[e.Name]).ConstantCollection.Add(c.Name, c);
|
||||
}
|
||||
|
||||
Translation.GLTypes = SpecReader.ReadTypeMap("gl.tm");
|
||||
Translation.CSTypes = SpecReader.ReadTypeMap("csharp.tm");
|
||||
|
||||
Translation.TranslateFunctions(functions, enums, out wrappers);
|
||||
Translation.TranslateEnums(enums);
|
||||
|
||||
|
@ -102,7 +103,7 @@ namespace OpenTK.OpenGL.Bind
|
|||
|
||||
// GLX binding generation.
|
||||
//Translation.GLXTypes = SpecReader.ReadTypeMap("glx.tm"); // Works semi-ok.
|
||||
//functions = SpecReader.ReadFunctionSpecs("glx.spec"); // Works ok!
|
||||
//List<Function> 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.
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ 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'.
|
||||
/// can be retrieved or set. The value can be either a number, another constant
|
||||
/// or an alias to a constant
|
||||
/// </summary>
|
||||
public class Constant
|
||||
{
|
||||
|
|
|
@ -104,6 +104,28 @@ namespace OpenTK.OpenGL.Bind
|
|||
|
||||
public static void TranslateEnums(System.Collections.Hashtable enums)
|
||||
{
|
||||
// Add missing enums.
|
||||
{
|
||||
Enum e = new Enum();
|
||||
Constant c;
|
||||
e.Name = "SGIX_icc_texture";
|
||||
c = new Constant("RGB_ICC_SGIX", "0x8460"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("RGBA_ICC_SGIX", "0x8461"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("ALPHA_ICC_SGIX", "0x8462"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("LUMINANCE_ICC_SGIX", "0x8463"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("INTENSITY_ICC_SGIX", "0x8464"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("LUMINANCE_ALPHA_ICC_SGIX", "0x8465"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("R5_G6_B5_ICC_SGIX", "0x8466"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("R5_G6_B5_A8_ICC_SGIX", "0x8467"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("ALPHA16_ICC_SGIX", "0x8468"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("LUMINANCE16_ICC_SGIX", "0x8469"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("INTENSITY16_ICC_SGIX", "0x846A"); e.ConstantCollection.Add(c.Name, c);
|
||||
c = new Constant("LUMINANCE16_ALPHA8_ICC_SGIX", "0x846B"); e.ConstantCollection.Add(c.Name, c);
|
||||
|
||||
enums.Add(e.Name, e);
|
||||
}
|
||||
|
||||
// Translate enums.
|
||||
foreach (Enum e in enums.Values)
|
||||
{
|
||||
if (Char.IsDigit(e.Name[0]))
|
||||
|
@ -114,13 +136,37 @@ namespace OpenTK.OpenGL.Bind
|
|||
|
||||
foreach (Constant c in e.ConstantCollection.Values)
|
||||
{
|
||||
// Prepend an '_' if the first letter is a number (e.g. 4_BYTES -> _4_BYTES)
|
||||
if (Char.IsDigit(c.Name[0]))
|
||||
c.Name = c.Name.Insert(0, "_");
|
||||
|
||||
// Prepend an '_' to the aliased value, if it starts with a number (e.g. DataType.4_BYTES -> DataType._4_BYTES)
|
||||
if (c.Value.Contains(".") && Char.IsDigit(c.Value[c.Value.IndexOf('.') + 1]))
|
||||
c.Value = c.Value.Insert(c.Value.IndexOf('.') + 1, "_");
|
||||
|
||||
// There are cases when a value is not a number but an aliased constant, with no enum specified.
|
||||
// In this case try searching all enums for the correct constant to alias (stupid opengl group).
|
||||
if (!c.Value.Contains(".") && !c.Value.StartsWith("0x") && !Char.IsDigit(c.Value[0]))
|
||||
{
|
||||
if (c.Value.StartsWith("GL_"))
|
||||
c.Value = c.Value.TrimStart('G', 'L', '_');
|
||||
|
||||
if (Char.IsDigit(c.Value[0]))
|
||||
c.Value = c.Value.Insert(0, "_");
|
||||
|
||||
foreach (Enum search_enum in enums.Values)
|
||||
foreach (Constant search_constant in search_enum.ConstantCollection.Values)
|
||||
if (search_constant.Name == c.Value || search_constant.Name == c.Value.TrimStart('_'))
|
||||
c.Value = c.Value.Insert(0, search_enum.Name + ".");
|
||||
}
|
||||
|
||||
// Handle enum.spec bugs:
|
||||
if (c.Value.Contains("LightProperty"))
|
||||
c.Value = c.Value.Replace("LightProperty", "LightParameter");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace OpenTK.OpenGL.Bind
|
|||
#endregion
|
||||
|
||||
#region Write types
|
||||
|
||||
private static void WriteTypes(StreamWriter sw)
|
||||
{
|
||||
sw.WriteLine(" #region Types");
|
||||
|
@ -79,6 +80,7 @@ namespace OpenTK.OpenGL.Bind
|
|||
sw.WriteLine(" #endregion");
|
||||
sw.WriteLine();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Write enums
|
||||
|
@ -93,38 +95,6 @@ namespace OpenTK.OpenGL.Bind
|
|||
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();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -591,6 +591,12 @@ namespace OpenTK.OpenGL
|
|||
GL.VertexAttrib4uiv_ = (GL.Delegates.VertexAttrib4uiv_)GetAddress("glVertexAttrib4uiv", typeof(GL.Delegates.VertexAttrib4uiv_));
|
||||
GL.VertexAttrib4usv_ = (GL.Delegates.VertexAttrib4usv_)GetAddress("glVertexAttrib4usv", typeof(GL.Delegates.VertexAttrib4usv_));
|
||||
GL.VertexAttribPointer_ = (GL.Delegates.VertexAttribPointer_)GetAddress("glVertexAttribPointer", typeof(GL.Delegates.VertexAttribPointer_));
|
||||
GL.UniformMatrix2x3fv_ = (GL.Delegates.UniformMatrix2x3fv_)GetAddress("glUniformMatrix2x3fv", typeof(GL.Delegates.UniformMatrix2x3fv_));
|
||||
GL.UniformMatrix3x2fv_ = (GL.Delegates.UniformMatrix3x2fv_)GetAddress("glUniformMatrix3x2fv", typeof(GL.Delegates.UniformMatrix3x2fv_));
|
||||
GL.UniformMatrix2x4fv_ = (GL.Delegates.UniformMatrix2x4fv_)GetAddress("glUniformMatrix2x4fv", typeof(GL.Delegates.UniformMatrix2x4fv_));
|
||||
GL.UniformMatrix4x2fv_ = (GL.Delegates.UniformMatrix4x2fv_)GetAddress("glUniformMatrix4x2fv", typeof(GL.Delegates.UniformMatrix4x2fv_));
|
||||
GL.UniformMatrix3x4fv_ = (GL.Delegates.UniformMatrix3x4fv_)GetAddress("glUniformMatrix3x4fv", typeof(GL.Delegates.UniformMatrix3x4fv_));
|
||||
GL.UniformMatrix4x3fv_ = (GL.Delegates.UniformMatrix4x3fv_)GetAddress("glUniformMatrix4x3fv", typeof(GL.Delegates.UniformMatrix4x3fv_));
|
||||
GL.ActiveTextureARB = (GL.Delegates.ActiveTextureARB)GetAddress("glActiveTextureARB", typeof(GL.Delegates.ActiveTextureARB));
|
||||
GL.ClientActiveTextureARB = (GL.Delegates.ClientActiveTextureARB)GetAddress("glClientActiveTextureARB", typeof(GL.Delegates.ClientActiveTextureARB));
|
||||
GL.MultiTexCoord1dARB = (GL.Delegates.MultiTexCoord1dARB)GetAddress("glMultiTexCoord1dARB", typeof(GL.Delegates.MultiTexCoord1dARB));
|
||||
|
@ -1436,6 +1442,13 @@ namespace OpenTK.OpenGL
|
|||
GL.GetFramebufferAttachmentParameterivEXT_ = (GL.Delegates.GetFramebufferAttachmentParameterivEXT_)GetAddress("glGetFramebufferAttachmentParameterivEXT", typeof(GL.Delegates.GetFramebufferAttachmentParameterivEXT_));
|
||||
GL.GenerateMipmapEXT = (GL.Delegates.GenerateMipmapEXT)GetAddress("glGenerateMipmapEXT", typeof(GL.Delegates.GenerateMipmapEXT));
|
||||
GL.StringMarkerGREMEDY_ = (GL.Delegates.StringMarkerGREMEDY_)GetAddress("glStringMarkerGREMEDY", typeof(GL.Delegates.StringMarkerGREMEDY_));
|
||||
GL.StencilClearTagEXT = (GL.Delegates.StencilClearTagEXT)GetAddress("glStencilClearTagEXT", typeof(GL.Delegates.StencilClearTagEXT));
|
||||
GL.BlitFramebufferEXT = (GL.Delegates.BlitFramebufferEXT)GetAddress("glBlitFramebufferEXT", typeof(GL.Delegates.BlitFramebufferEXT));
|
||||
GL.RenderbufferStorageMultisampleEXT = (GL.Delegates.RenderbufferStorageMultisampleEXT)GetAddress("glRenderbufferStorageMultisampleEXT", typeof(GL.Delegates.RenderbufferStorageMultisampleEXT));
|
||||
GL.GetQueryObjecti64vEXT_ = (GL.Delegates.GetQueryObjecti64vEXT_)GetAddress("glGetQueryObjecti64vEXT", typeof(GL.Delegates.GetQueryObjecti64vEXT_));
|
||||
GL.GetQueryObjectui64vEXT_ = (GL.Delegates.GetQueryObjectui64vEXT_)GetAddress("glGetQueryObjectui64vEXT", typeof(GL.Delegates.GetQueryObjectui64vEXT_));
|
||||
GL.ProgramEnvParameters4fvEXT_ = (GL.Delegates.ProgramEnvParameters4fvEXT_)GetAddress("glProgramEnvParameters4fvEXT", typeof(GL.Delegates.ProgramEnvParameters4fvEXT_));
|
||||
GL.ProgramLocalParameters4fvEXT_ = (GL.Delegates.ProgramLocalParameters4fvEXT_)GetAddress("glProgramLocalParameters4fvEXT", typeof(GL.Delegates.ProgramLocalParameters4fvEXT_));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -9,19 +9,31 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using OpenTK.Platform.X;
|
||||
|
||||
namespace OpenTK.OpenGL.Platform
|
||||
{
|
||||
public partial class X11Context : OpenTK.OpenGL.GLContext
|
||||
{
|
||||
int drawable, context;
|
||||
int drawable;
|
||||
IntPtr context;
|
||||
IntPtr display;
|
||||
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();
|
||||
display = Api.OpenDisplay("OpenTK X11 trial");
|
||||
Api.VisualInfo visual = Glx.ChooseVisual(display, 0, new int[] { });
|
||||
context = Glx.CreateContext(display, visual, IntPtr.Zero, true);
|
||||
//Api.Free(new IntPtr(visual));
|
||||
drawable = c.Handle.ToInt32();
|
||||
Glx.MakeCurrent(drawable, context);
|
||||
|
||||
//context = Glx.CreateContext(
|
||||
//X11Context
|
||||
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
//throw new Exception("The method or operation is not implemented.");
|
||||
}
|
||||
|
||||
public override void SwapBuffers()
|
||||
|
@ -45,7 +57,9 @@ namespace OpenTK.OpenGL.Platform
|
|||
|
||||
public override void Dispose()
|
||||
{
|
||||
throw new Exception("The method or operation is not implemented.");
|
||||
//throw new Exception("The method or operation is not implemented.");
|
||||
Glx.DestroyContext(context);
|
||||
Api.CloseDisplay(display);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,11 @@ using System.Drawing;
|
|||
using System.Threading;
|
||||
using OpenTK.Platform.Windows;
|
||||
using System.Runtime.InteropServices;
|
||||
using OpenTK.OpenGL.Platform;
|
||||
|
||||
namespace OpenTK.OpenGL
|
||||
{
|
||||
public class GLForm : Form, IDisposable
|
||||
public class Framework : Form, IDisposable
|
||||
{
|
||||
#region Context
|
||||
private GLContext _context;
|
||||
|
@ -27,14 +28,51 @@ namespace OpenTK.OpenGL
|
|||
}
|
||||
#endregion
|
||||
|
||||
delegate bool IsIdleDelegate();
|
||||
IsIdleDelegate IsIdle;
|
||||
|
||||
#region Constructors
|
||||
public GLForm()
|
||||
|
||||
public Framework()
|
||||
{
|
||||
Open(null, 640, 480, 8, 8, 8, 8, 16, 0, false);
|
||||
}
|
||||
|
||||
public Framework(string title, int width, int height, int red, int green, int blue, int alpha, int depth, int stencil, bool fullscreen)
|
||||
{
|
||||
Open(title, width, height, red, green, blue, alpha, depth, stencil, fullscreen);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Open(string title, int width, int height, int red, int green, int blue, int alpha, int depth, int stencil, bool fullscreen)
|
||||
{
|
||||
Application.Idle += new EventHandler(OnIdle);
|
||||
|
||||
try
|
||||
{
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
|
||||
Environment.OSVersion.Platform == PlatformID.Win32Windows)
|
||||
{
|
||||
IsIdle = new IsIdleDelegate(WindowsIsIdle);
|
||||
WindowsOpen(title, width, height, red, green, blue, alpha, depth, stencil, fullscreen);
|
||||
}
|
||||
else if (Environment.OSVersion.Platform == PlatformID.Unix)
|
||||
{
|
||||
IsIdle = new IsIdleDelegate(XIsIdle);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new PlatformNotSupportedException("The platform on which you are trying to run this program is not currently supported. Sorry for the inconvenience.");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void WindowsOpen(string title, int width, int height, int red, int green, int blue, int alpha, int depth, int stencil, bool fullscreen)
|
||||
{
|
||||
// Hack! Should add more constructors to the GLContext class.
|
||||
Context = GLContext.Create(this, 8, 8, 8, 8, 16, 0);
|
||||
|
@ -81,74 +119,55 @@ namespace OpenTK.OpenGL
|
|||
this.Size = new Size(width, height);
|
||||
|
||||
// Cross-platformness?
|
||||
Application.Idle += new EventHandler(OnApplicationIdle);
|
||||
|
||||
}
|
||||
|
||||
#region Application main loop
|
||||
//override protected void WndProc(ref Message m)
|
||||
//{
|
||||
// base.WndProc(ref m);
|
||||
// //OnPaint(null);
|
||||
//}
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
Application.Idle -= OnIdle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
/// <summary>
|
||||
/// Called when all pending messages have been processed, this is where the application 'Main Loop' resides.
|
||||
/// </summary>
|
||||
/// <param name="sender">Not used.</param>
|
||||
/// <param name="e">Not used.</param>
|
||||
void OnApplicationIdle(object sender, EventArgs e)
|
||||
private void OnIdle(object sender, EventArgs e)
|
||||
{
|
||||
// Check if any new messages have popped up. If not, then run the logic at full speed.
|
||||
//while (IsApplicationIdle())
|
||||
////while (idle)
|
||||
//{
|
||||
// // We'd like to play nice with the scheduler. If the window is not in focus,
|
||||
// // we give back some thread-time to the OS, to allow other apps to function full-speed.
|
||||
// // However, if the window _is_ in focus we grab all processor resources.
|
||||
// // Hack! Should allow the user to set a sleep interval.
|
||||
// if (ActiveForm != this)
|
||||
// Thread.Sleep(100);
|
||||
// OnPaint(null);
|
||||
//}
|
||||
while (IsIdle())
|
||||
{
|
||||
if (ActiveForm != this)
|
||||
Thread.Sleep(100);
|
||||
OnPaint(null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if there all pending messages have been processed.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if there are no messages left, false otherwise.</returns>
|
||||
static public bool IsApplicationIdle()
|
||||
private bool WindowsIsIdle()
|
||||
{
|
||||
//Message msg = Message.Create(this.Handle, A
|
||||
|
||||
//try
|
||||
//{
|
||||
//Message msg;
|
||||
Api.Message msg;
|
||||
return !OpenTK.Platform.Windows.Api.PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// //MessageBox.Show(e.ToString());
|
||||
// return false;
|
||||
//}
|
||||
//WndProc(ref msg);
|
||||
|
||||
//if (msg.
|
||||
//return false;
|
||||
|
||||
//Message msg = Message.Create(IntPtr.Zero, Api.Constants.WM_ENTERIDLE, IntPtr.Zero, IntPtr.Zero);
|
||||
|
||||
//return !Api.PeekMessage(ref msg, IntPtr.Zero, 0, 0, 0);
|
||||
}
|
||||
#endregion
|
||||
|
||||
bool idle;
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
//OnPaint(null);
|
||||
Api.Message msg;
|
||||
return !OpenTK.Platform.Windows.Api.PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
|
||||
}
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
void IDisposable.Dispose()
|
||||
private bool XIsIdle()
|
||||
{
|
||||
Application.Idle -= OnApplicationIdle;
|
||||
throw new NotImplementedException("IsIdle handler not implemented yet!");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -8,6 +8,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using OpenTK.Platform.X;
|
||||
|
||||
namespace OpenTK.OpenGL
|
||||
{
|
||||
|
@ -43,243 +44,250 @@ namespace OpenTK.OpenGL
|
|||
/// </summary>
|
||||
public class Glx
|
||||
{
|
||||
const string _dll_name = "glx.so";
|
||||
const string _dll_name = "libgl";
|
||||
|
||||
#region Enums
|
||||
|
||||
public struct Enums
|
||||
{
|
||||
public enum GLXAttribute : uint
|
||||
public struct Enums
|
||||
{
|
||||
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 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,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
#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 = "glXCreateContext")]
|
||||
public static extern IntPtr CreateContext(IntPtr dpy, Api.VisualInfo vis, IntPtr shareList, bool direct);
|
||||
//public static extern IntPtr CreateContext(IntPtr gc_id, Int32 screen, Int32 visual, IntPtr share_list);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "glXDestroyContext")]
|
||||
public static extern void DestroyContext(IntPtr context);
|
||||
|
||||
[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")]
|
||||
[DllImport(_dll_name, EntryPoint = "glXMakeCurrent")]
|
||||
public static extern void MakeCurrent(Int32 drawable, IntPtr context);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "glXSwapBuffers")]
|
||||
public static extern void SwapBuffers(Int32 drawable);
|
||||
|
||||
[DllImport("_dll_name", EntryPoint = "glxGetProcAddress")]
|
||||
[DllImport(_dll_name, EntryPoint = "glXGetProcAddress")]
|
||||
public static extern IntPtr GetProcAddress([MarshalAs(UnmanagedType.LPTStr)] string procName);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "glXChooseVisual")]
|
||||
public static extern OpenTK.Platform.X.Api.VisualInfo ChooseVisual(IntPtr dpy, int screen, [MarshalAs(UnmanagedType.LPArray)]int[] attriblist);
|
||||
|
||||
//public static ChooseVisual()
|
||||
|
||||
|
||||
//[DllImport("opengl32.dll", EntryPoint = "glCreateWindow")]
|
||||
//public static extern void CreateWindow(Int32 config, Int32 window, Int32 glxwindow);
|
||||
//[DllImport("opengl32.dll", EntryPoint = "glDestroyWindow")]
|
||||
|
|
|
@ -7,10 +7,46 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Platform.X
|
||||
{
|
||||
public class XApi
|
||||
public static class Api
|
||||
{
|
||||
private const string _dll_name = "libX11";
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct VisualInfo
|
||||
{
|
||||
IntPtr visual;
|
||||
int visualid;
|
||||
int screen;
|
||||
uint depth;
|
||||
int @class;
|
||||
ulong red_mask;
|
||||
ulong green_mask;
|
||||
ulong blue_mask;
|
||||
int colormap_size;
|
||||
int bits_per_rgb;
|
||||
}
|
||||
|
||||
#region Functions
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "XOpenDisplay")]
|
||||
public static extern IntPtr OpenDisplay([MarshalAs(UnmanagedType.LPTStr)] string display_name);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "XCloseDisplay")]
|
||||
public static extern void CloseDisplay(IntPtr display);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "XDefaultScreen")]
|
||||
public static extern int DefaultScreen(IntPtr display);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "XDefaultVisual")]
|
||||
public static extern IntPtr DefaultVisual(IntPtr display, int screen_number);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "XFree")]
|
||||
public static extern void Free(IntPtr data);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
OpenTK 0.3.4 -> 0.3.5
|
||||
+ Major update to OpenTK.OpenGL.Bind (cleaner code, new functions, comments and many new wrappers).
|
||||
+ Updated the spec files for opengl 2.1.
|
||||
+ Added the new 64 bit types to the typemaps (gl.tm and csharp.tm)
|
||||
+ The bugs in the specs are still there:
|
||||
+ SGIX_icc_texture is still commented out, while enums use it.
|
||||
+ LightProperty is still used by constants (the correct enum is LightParameter).
|
||||
+ I think I should contact someone at the Khronos group about these. For the time being I worked around them, by adding a special case for LightProperty in the translator, and adding the SGIX enum to the missing parameters.
|
||||
+ See also: http://www.haskell.org/HOpenGL/spec_bugs.html (lots of useful information on that site).
|
||||
+ Laid the foundation for X (Linux, Unix, MacOS) support.
|
||||
+ Added bindings to some glx functions.
|
||||
+ Added the OpenTK.Platform.X class.
|
||||
|
|
Loading…
Reference in a new issue