mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 06:55:37 +00:00
Merged with bind branch.
This commit is contained in:
parent
9295a44c60
commit
ffe8ce7795
|
@ -29,20 +29,23 @@ namespace Bind.GL2
|
|||
protected static string enumsFile = "GLEnums.cs";
|
||||
protected static string wrappersFile = "GL.cs";
|
||||
|
||||
protected static string className = Settings.GLClass;
|
||||
protected static string loadAllFuncName = "LoadAll";
|
||||
protected static string functionPrefix = "gl";
|
||||
public string FunctionPrefix { get { return functionPrefix; } }
|
||||
|
||||
protected string specFolder;
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Constructors ---
|
||||
|
||||
public Generator(string folder)
|
||||
public Generator()
|
||||
{
|
||||
specFolder = folder;
|
||||
if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||
{
|
||||
Settings.OutputNamespace = "Tao.OpenGl";
|
||||
Settings.OutputClass = "Gl";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Defaults
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -146,6 +149,8 @@ namespace Bind.GL2
|
|||
|
||||
#region ISpecReader Members
|
||||
|
||||
#region public virtual DelegateCollection ReadDelegates(StreamReader specFile)
|
||||
|
||||
public virtual DelegateCollection ReadDelegates(StreamReader specFile)
|
||||
{
|
||||
Console.WriteLine("Reading function specs.");
|
||||
|
@ -168,7 +173,7 @@ namespace Bind.GL2
|
|||
// Get function name:
|
||||
d.Name = line.Split(Utilities.Separators, StringSplitOptions.RemoveEmptyEntries)[0];
|
||||
|
||||
if (d.Name.Contains("MultiTexCoord1"))
|
||||
if (d.Name.Contains("UseFontOutlinesA"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -196,7 +201,7 @@ namespace Bind.GL2
|
|||
|
||||
p.Name = Utilities.Keywords.Contains(words[1]) ? "@" + words[1] : words[1];
|
||||
p.CurrentType = words[2];
|
||||
p.Pointer = words[4] == "array" ? true : false;
|
||||
p.Pointer = words[4] == "array" ? true : words[4] == "reference" ? true : false;
|
||||
p.Flow = words[3] == "in" ? Parameter.FlowDirection.In : Parameter.FlowDirection.Out;
|
||||
|
||||
d.Parameters.Add(p);
|
||||
|
@ -224,17 +229,21 @@ namespace Bind.GL2
|
|||
return delegates;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public virtual EnumCollection ReadEnums(StreamReader specFile)
|
||||
|
||||
public virtual EnumCollection ReadEnums(StreamReader specFile)
|
||||
{
|
||||
Trace.WriteLine("Reading opengl enumerant specs.");
|
||||
Trace.Indent();
|
||||
|
||||
EnumCollection enums = new EnumCollection();
|
||||
|
||||
// complete_enum contains all opengl enumerants.
|
||||
Bind.Structures.Enum complete_enum = new Bind.Structures.Enum();
|
||||
complete_enum.Name = Settings.CompleteEnumName;
|
||||
|
||||
Trace.WriteLine(String.Format("Reading opengl enumerant specs"));
|
||||
Trace.Indent();
|
||||
|
||||
do
|
||||
{
|
||||
string line = NextValidLine(specFile);
|
||||
|
@ -252,7 +261,7 @@ namespace Bind.GL2
|
|||
|
||||
// Declare a new enumerant
|
||||
Bind.Structures.Enum e = new Bind.Structures.Enum();
|
||||
e.Name = Char.IsDigit(words[0][0]) ? "GL_" + words[0] : words[0];
|
||||
e.Name = Char.IsDigit(words[0][0]) ? Settings.ConstantPrefix + words[0] : words[0];
|
||||
|
||||
// And fill in the values for this enumerant
|
||||
do
|
||||
|
@ -275,12 +284,18 @@ namespace Bind.GL2
|
|||
Constant c = new Constant();
|
||||
if (line.Contains("="))
|
||||
{
|
||||
// Trim the "GL_" from the start of the string.
|
||||
if (words[0].StartsWith("GL_"))
|
||||
words[0] = words[0].Substring(3);
|
||||
// Trim the name's prefix, but only if not in Tao compat mode.
|
||||
if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (words[0].StartsWith(Settings.ConstantPrefix))
|
||||
words[0] = words[0].Substring(Settings.ConstantPrefix.Length);
|
||||
|
||||
if (Char.IsDigit(words[0][0]))
|
||||
words[0] = "GL_" + words[0];
|
||||
if (Char.IsDigit(words[0][0]))
|
||||
words[0] = Settings.ConstantPrefix + words[0];
|
||||
}
|
||||
|
||||
c.Name = words[0];
|
||||
|
||||
|
@ -295,30 +310,29 @@ namespace Bind.GL2
|
|||
}
|
||||
else
|
||||
{
|
||||
// The value is not a number.
|
||||
// Strip the "GL_" from the start of the string.
|
||||
if (words[2].StartsWith("GL_"))
|
||||
words[2] = words[2].Substring(3);
|
||||
// The value is not a number. Strip the prefix.
|
||||
if (words[2].StartsWith(Settings.ConstantPrefix))
|
||||
words[2] = words[2].Substring(Settings.ConstantPrefix.Length);
|
||||
|
||||
// If the name now starts with a digit (doesn't matter whether we
|
||||
// stripped "GL_" above), add a "GL_" prefix.
|
||||
// (e.g. GL_4_BYTES).
|
||||
if (Char.IsDigit(words[2][0]))
|
||||
words[2] = "GL_" + words[2];
|
||||
words[2] = Settings.ConstantPrefix + words[2];
|
||||
}
|
||||
|
||||
c.Value = words[2];
|
||||
}
|
||||
else if (words[0] == "use")
|
||||
{
|
||||
// Trim the "GL_" from the start of the string.
|
||||
if (words[2].StartsWith("GL_"))
|
||||
words[2] = words[2].Substring(3);
|
||||
// Trim the prefix.
|
||||
if (words[2].StartsWith(Settings.ConstantPrefix))
|
||||
words[2] = words[2].Substring(Settings.ConstantPrefix.Length);
|
||||
|
||||
// If the remaining string starts with a digit, we were wrong above.
|
||||
// Re-add the "GL_"
|
||||
if (Char.IsDigit(words[2][0]))
|
||||
words[2] = "GL_" + words[2];
|
||||
words[2] = Settings.ConstantPrefix + words[2];
|
||||
|
||||
c.Name = words[2];
|
||||
|
||||
|
@ -395,6 +409,10 @@ namespace Bind.GL2
|
|||
return enums;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public virtual Dictionary<string, string> ReadTypeMap(StreamReader specFile)
|
||||
|
||||
public virtual Dictionary<string, string> ReadTypeMap(StreamReader specFile)
|
||||
{
|
||||
Console.WriteLine("Reading opengl types.");
|
||||
|
@ -441,6 +459,10 @@ namespace Bind.GL2
|
|||
return GLTypes;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public virtual Dictionary<string, string> ReadCSTypeMap(StreamReader specFile)
|
||||
|
||||
public virtual Dictionary<string, string> ReadCSTypeMap(StreamReader specFile)
|
||||
{
|
||||
Dictionary<string, string> CSTypes = new Dictionary<string, string>();
|
||||
|
@ -461,7 +483,9 @@ namespace Bind.GL2
|
|||
|
||||
return CSTypes;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region private string NextValidLine(StreamReader sr)
|
||||
|
||||
private string NextValidLine(System.IO.StreamReader sr)
|
||||
|
@ -510,18 +534,18 @@ namespace Bind.GL2
|
|||
|
||||
#region void WriteBindings
|
||||
|
||||
public void WriteBindings(
|
||||
DelegateCollection delegates, FunctionCollection functions,
|
||||
EnumCollection enums)
|
||||
public void WriteBindings(DelegateCollection delegates, FunctionCollection functions, EnumCollection enums)
|
||||
{
|
||||
// Write
|
||||
if (!Directory.Exists(Settings.OutputPath))
|
||||
Directory.CreateDirectory(Settings.OutputPath);
|
||||
|
||||
using (BindStreamWriter sw = new BindStreamWriter(Path.Combine(Settings.OutputPath, enumsFile)))
|
||||
{
|
||||
sw.WriteLine("namespace {0}", Settings.OutputNamespace);
|
||||
sw.WriteLine("{");
|
||||
|
||||
sw.Indent();
|
||||
sw.WriteLine("public static partial class {0}", className);
|
||||
sw.WriteLine("public static partial class {0}", Settings.OutputClass);
|
||||
sw.WriteLine("{");
|
||||
|
||||
sw.Indent();
|
||||
|
@ -586,7 +610,7 @@ namespace Bind.GL2
|
|||
Trace.WriteLine(String.Format("Writing delegates to {0}.{1}", Settings.OutputNamespace, Settings.DelegatesClass));
|
||||
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("partial class {0}", className);
|
||||
sw.WriteLine("partial class {0}", Settings.OutputClass);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
sw.WriteLine();
|
||||
|
@ -598,9 +622,9 @@ namespace Bind.GL2
|
|||
sw.WriteLine("static {0}()", Settings.DelegatesClass);
|
||||
sw.WriteLine("{");
|
||||
// --- Workaround for mono gmcs 1.2.4 issue, where static initalization fails. ---
|
||||
sw.Indent();
|
||||
sw.WriteLine("{0}.{1}();", className, loadAllFuncName);
|
||||
sw.Unindent();
|
||||
//sw.Indent();
|
||||
//sw.WriteLine("{0}.{1}();", Settings.OutputClass, loadAllFuncName);
|
||||
//sw.Unindent();
|
||||
// --- End workaround ---
|
||||
sw.WriteLine("}");
|
||||
sw.WriteLine();
|
||||
|
@ -613,7 +637,7 @@ namespace Bind.GL2
|
|||
"internal {0}static {1} {2}{1} = null;",
|
||||
d.Unsafe ? "unsafe " : "",
|
||||
d.Name,
|
||||
functionPrefix);
|
||||
Settings.FunctionPrefix);
|
||||
// --- End workaround ---s
|
||||
}
|
||||
sw.Unindent();
|
||||
|
@ -631,7 +655,7 @@ namespace Bind.GL2
|
|||
Trace.WriteLine(String.Format("Writing imports to {0}.{1}", Settings.OutputNamespace, Settings.ImportsClass));
|
||||
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("partial class {0}", className);
|
||||
sw.WriteLine("partial class {0}", Settings.OutputClass);
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
sw.WriteLine();
|
||||
|
@ -647,10 +671,11 @@ namespace Bind.GL2
|
|||
{
|
||||
sw.WriteLine("[System.Security.SuppressUnmanagedCodeSecurity()]");
|
||||
sw.WriteLine(
|
||||
"[System.Runtime.InteropServices.DllImport({0}.Library, EntryPoint = \"{1}{2}\", ExactSpelling = true)]",
|
||||
className,
|
||||
functionPrefix,
|
||||
d.Name
|
||||
"[System.Runtime.InteropServices.DllImport({0}.Library, EntryPoint = \"{1}{2}\"{3})]",
|
||||
Settings.OutputClass,
|
||||
Settings.FunctionPrefix,
|
||||
d.Name,
|
||||
d.Name.EndsWith("W") || d.Name.EndsWith("A") ? ", CharSet = CharSet.Auto" : ", ExactSpelling = true"
|
||||
);
|
||||
sw.WriteLine("internal extern static {0};", d.DeclarationString());
|
||||
}
|
||||
|
@ -667,10 +692,10 @@ namespace Bind.GL2
|
|||
|
||||
public void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers, Dictionary<string, string> CSTypes)
|
||||
{
|
||||
Trace.WriteLine(String.Format("Writing wrappers to {0}.{1}", Settings.OutputNamespace, className));
|
||||
Trace.WriteLine(String.Format("Writing wrappers to {0}.{1}", Settings.OutputNamespace, Settings.OutputClass));
|
||||
|
||||
sw.WriteLine();
|
||||
sw.WriteLine("public static partial class {0}", className);
|
||||
sw.WriteLine("public static partial class {0}", Settings.OutputClass);
|
||||
sw.WriteLine("{");
|
||||
|
||||
sw.Indent();
|
||||
|
@ -687,7 +712,7 @@ namespace Bind.GL2
|
|||
else
|
||||
{
|
||||
// Identifiers cannot start with a number:
|
||||
sw.WriteLine("public static class GL_{0}", key);
|
||||
sw.WriteLine("public static class {0}{1}", Settings.FunctionPrefix, key);
|
||||
}
|
||||
sw.WriteLine("{");
|
||||
sw.Indent();
|
||||
|
@ -735,7 +760,7 @@ namespace Bind.GL2
|
|||
|
||||
public void WriteEnums(BindStreamWriter sw, EnumCollection enums)
|
||||
{
|
||||
Trace.WriteLine(String.Format("Writing enums to {0}.{1}", Settings.OutputNamespace, className));
|
||||
Trace.WriteLine(String.Format("Writing enums to {0}.{1}", Settings.OutputNamespace, Settings.OutputClass));
|
||||
|
||||
if (Settings.Compatibility == Settings.Legacy.None)
|
||||
{
|
||||
|
@ -762,8 +787,8 @@ namespace Bind.GL2
|
|||
{
|
||||
sw.WriteLine(String.Format(
|
||||
"public const int {0} = {2}((int){1});",
|
||||
c.Name.StartsWith("GL_") ? c.Name : "GL_" + c.Name,
|
||||
Char.IsDigit(c.Value[0]) ? c.Value : c.Value.StartsWith("GL_") ? c.Value : "GL_" + c.Value,
|
||||
c.Name.StartsWith(Settings.ConstantPrefix) ? c.Name : Settings.ConstantPrefix + c.Name,
|
||||
Char.IsDigit(c.Value[0]) ? c.Value : c.Value.StartsWith(Settings.ConstantPrefix) ? c.Value : Settings.ConstantPrefix + c.Value,
|
||||
c.Unchecked ? "unchecked" : ""));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -12,9 +12,6 @@ namespace Bind
|
|||
{
|
||||
interface IBind : ISpecReader, ISpecWriter
|
||||
{
|
||||
//ISpecReader SpecReader { get; }
|
||||
void Process();
|
||||
|
||||
string FunctionPrefix { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,8 +46,6 @@ namespace Bind
|
|||
//Console.WriteLine(" - the OpenTK team ;-)");
|
||||
Console.WriteLine();
|
||||
|
||||
#region Handle Arguments
|
||||
|
||||
try
|
||||
{
|
||||
foreach (string a in arguments)
|
||||
|
@ -80,19 +78,17 @@ namespace Bind
|
|||
case "ns":
|
||||
Settings.OutputNamespace = b[1];
|
||||
break;
|
||||
case "gl":
|
||||
Settings.GLClass = b[1];
|
||||
break;
|
||||
case "glu":
|
||||
Settings.GluClass = b[1];
|
||||
break;
|
||||
//case "gl":
|
||||
// Settings.OutputClass = b[1];
|
||||
// break;
|
||||
//case "glu":
|
||||
// Settings.OutputClass = b[1];
|
||||
// break;
|
||||
case "legacy":
|
||||
Settings.Compatibility = b[1].ToLower() == "tao" ? Settings.Legacy.Tao : Settings.Legacy.None;
|
||||
Settings.OutputNamespace = "Tao.OpenGl";
|
||||
Settings.GLClass = "Gl";
|
||||
break;
|
||||
case "class":
|
||||
Settings.GLClass = b[1];
|
||||
Settings.OutputClass = b[1];
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException(
|
||||
|
@ -113,8 +109,6 @@ namespace Bind
|
|||
return;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
long ticks = System.DateTime.Now.Ticks;
|
||||
|
@ -122,7 +116,7 @@ namespace Bind
|
|||
switch (mode)
|
||||
{
|
||||
case GeneratorMode.GL2:
|
||||
Generator = new Bind.GL2.Generator(Settings.InputPath);
|
||||
Generator = new Bind.GL2.Generator();
|
||||
break;
|
||||
|
||||
case GeneratorMode.Wgl:
|
||||
|
@ -134,7 +128,7 @@ namespace Bind
|
|||
{
|
||||
Settings.OutputNamespace = "OpenTK.Platform.Windows";
|
||||
}
|
||||
Generator = new Bind.Wgl.Generator(Settings.InputPath);
|
||||
Generator = new Bind.Wgl.Generator();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("0.9.7.3")]
|
||||
[assembly: AssemblyFileVersion("0.9.7.3")]
|
||||
[assembly: AssemblyVersion("0.9.7.4")]
|
||||
[assembly: AssemblyFileVersion("0.9.7.4")]
|
||||
|
|
|
@ -20,19 +20,20 @@ namespace Bind
|
|||
public readonly static string DefaultOutputPath = "..\\..\\..\\Source\\OpenTK\\OpenGL\\Bindings";
|
||||
public readonly static string DefaultOutputNamespace = "OpenTK.OpenGL";
|
||||
|
||||
public static string GLClass = "GL";
|
||||
public static string OutputClass = "GL";
|
||||
public static string FunctionPrefix = "gl";
|
||||
public static string ConstantPrefix = "GL_";
|
||||
|
||||
private static string enumsClass = "Enums";
|
||||
public static string GLEnumsClass
|
||||
{
|
||||
get { return GLClass + "." + enumsClass; }
|
||||
get { return OutputClass + "." + enumsClass; }
|
||||
set { enumsClass = value; }
|
||||
|
||||
}
|
||||
public static string DelegatesClass = "Delegates";
|
||||
public static string ImportsClass = "Imports";
|
||||
public static string WglClass = "Wgl";
|
||||
public static string GlxClass = "Glx";
|
||||
public static string GluClass = "Glu";
|
||||
|
||||
public static Legacy Compatibility = Legacy.None;
|
||||
|
||||
public readonly static string DefaultWglOutputPath = "..\\..\\..\\Source\\OpenTK\\Platform\\Windows\\Bindings";
|
||||
|
@ -48,6 +49,6 @@ namespace Bind
|
|||
Tao,
|
||||
}
|
||||
|
||||
public static string WindowsPlatform = "OpenTK.Platform.Windows.API";
|
||||
public static string WindowsGDI = "OpenTK.Platform.Windows.API";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,3 +185,53 @@ UseFontBitmapsW( hDC, first, count, listBase )
|
|||
category wgl
|
||||
dlflags notlistable
|
||||
|
||||
# Added by hand. Where can we find an updated spec?
|
||||
|
||||
#UseFontBitmaps( hDC, first, count, listBase )
|
||||
# return BOOL
|
||||
# param hDC HDC in value
|
||||
# param first DWORD in value
|
||||
# param count DWORD in value
|
||||
# param listBase DWORD in value
|
||||
# category wgl
|
||||
# dlflags notlistable
|
||||
|
||||
UseFontOutlinesA( hDC, first, count, listBase )
|
||||
return BOOL
|
||||
param hDC HDC in value
|
||||
param first DWORD in value
|
||||
param count DWORD in value
|
||||
param listBase DWORD in value
|
||||
param thickness float in value
|
||||
param deviation float in value
|
||||
param fontMode DWORD in value
|
||||
param glyphMetrics GLYPHMETRICSFLOAT in array
|
||||
category wgl
|
||||
dlflags notlistable
|
||||
|
||||
UseFontOutlinesW( hDC, first, count, listBase )
|
||||
return BOOL
|
||||
param hDC HDC in value
|
||||
param first DWORD in value
|
||||
param count DWORD in value
|
||||
param listBase DWORD in value
|
||||
param thickness float in value
|
||||
param deviation float in value
|
||||
param fontMode DWORD in value
|
||||
param glyphMetrics GLYPHMETRICSFLOAT in array
|
||||
category wgl
|
||||
dlflags notlistable
|
||||
|
||||
#UseFontOutlines( hDC, first, count, listBase )
|
||||
# return BOOL
|
||||
# param hDC HDC in value
|
||||
# param first DWORD in value
|
||||
# param count DWORD in value
|
||||
# param listBase DWORD in value
|
||||
# param thickness float in value
|
||||
# param deviation float in value
|
||||
# param fontMode DWORD in value
|
||||
# param glyphMetrics GLYPHMETRICSFLOAT in array
|
||||
# category wgl
|
||||
# dlflags notlistable
|
||||
|
||||
|
|
|
@ -22,3 +22,8 @@ VoidPointer,*,*, void*,*,*
|
|||
float,*,*, float,*,*
|
||||
int,*,*, int,*,*
|
||||
#void,*,*, *,*,*
|
||||
PIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR
|
||||
LAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR
|
||||
GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT
|
||||
COLORREF Int32
|
||||
LPCSTR String
|
|
@ -357,3 +357,8 @@ WGL_ATI_pixel_format_float enum:
|
|||
###############################################################################
|
||||
|
||||
# Any_vendor_future_use: 0x21C0-0xFFFF
|
||||
|
||||
# Added by hand:
|
||||
WGL_font_type enum:
|
||||
WGL_FONT_LINES = 0
|
||||
WGL_FONT_POLYGONS = 1
|
||||
|
|
|
@ -270,9 +270,9 @@ namespace Bind.Structures
|
|||
|
||||
sb.Append(Settings.DelegatesClass);
|
||||
sb.Append(".");
|
||||
sb.Append(Bind.MainClass.Generator.FunctionPrefix);
|
||||
sb.Append(Settings.FunctionPrefix);
|
||||
sb.Append(Name);
|
||||
sb.Append(Parameters.CallString());
|
||||
sb.Append(Parameters.CallString(Settings.Compatibility == Settings.Legacy.Tao));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
@ -338,9 +338,9 @@ namespace Bind.Structures
|
|||
|
||||
#region public IEnumerable<Function> CreateWrappers()
|
||||
|
||||
public IEnumerable<Function> CreateWrappers()
|
||||
public void CreateWrappers()
|
||||
{
|
||||
if (this.Name.Contains("GetString"))
|
||||
if (this.Name.Contains("GenBuffers"))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -361,11 +361,44 @@ namespace Bind.Structures
|
|||
{
|
||||
Function f = WrapReturnType();
|
||||
|
||||
|
||||
WrapParameters(new Function((Function)f ?? this), wrappers);
|
||||
}
|
||||
|
||||
return wrappers;
|
||||
// If the function is not CLS-compliant (e.g. it contains unsigned parameters)
|
||||
// we need to create a CLS-Compliant overload. However, we should only do this
|
||||
// iff the opengl function does not contain unsigned/signed overloads itself
|
||||
// to avoid redefinitions.
|
||||
foreach (Function f in wrappers)
|
||||
{
|
||||
Bind.Structures.Function.Wrappers.AddChecked(f);
|
||||
//Bind.Structures.Function.Wrappers.Add(f);
|
||||
|
||||
if (!f.CLSCompliant)
|
||||
{
|
||||
Function cls = new Function(f);
|
||||
|
||||
cls.Body.Clear();
|
||||
if (!cls.NeedsWrapper)
|
||||
{
|
||||
cls.Body.Add((f.ReturnType.CurrentType != "void" ? "return " + this.CallString() : this.CallString()) + ";");
|
||||
}
|
||||
else
|
||||
{
|
||||
cls.Body.AddRange(this.CreateBody(cls, true));
|
||||
}
|
||||
|
||||
bool somethingChanged = false;
|
||||
for (int i = 0; i < f.Parameters.Count; i++)
|
||||
{
|
||||
cls.Parameters[i].CurrentType = cls.Parameters[i].GetCLSCompliantType();
|
||||
if (cls.Parameters[i].CurrentType != f.Parameters[i].CurrentType)
|
||||
somethingChanged = true;
|
||||
}
|
||||
|
||||
if (somethingChanged)
|
||||
Bind.Structures.Function.Wrappers.AddChecked(cls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -432,13 +465,9 @@ namespace Bind.Structures
|
|||
/// </summary>
|
||||
protected void WrapParameters(Function function, List<Function> wrappers)
|
||||
{
|
||||
if (function.Name == "GetString")
|
||||
{
|
||||
}
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
bool containsPointerParameters = false;
|
||||
bool containsPointerParameters = false, containsReferenceParameters = false;
|
||||
// Check if there are any IntPtr parameters (we may have come here from a ReturnType wrapper
|
||||
// such as glGetString, which contains no IntPtr parameters)
|
||||
foreach (Parameter p in function.Parameters)
|
||||
|
@ -448,12 +477,20 @@ namespace Bind.Structures
|
|||
containsPointerParameters = true;
|
||||
break;
|
||||
}
|
||||
else if (p.Reference)
|
||||
{
|
||||
containsReferenceParameters = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (containsPointerParameters)
|
||||
{
|
||||
wrappers.Add(DefaultWrapper(function));
|
||||
}
|
||||
else if (containsReferenceParameters)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (function.Body.Count == 0)
|
||||
|
@ -485,8 +522,17 @@ namespace Bind.Structures
|
|||
WrapParameters(function, wrappers);
|
||||
--index;
|
||||
|
||||
if (function.Name == "UseFontOutlinesA")
|
||||
{
|
||||
}
|
||||
|
||||
// On stack rewind, create array wrappers
|
||||
f = ArrayWrapper(new Function(function), index);
|
||||
f = new Function(function);
|
||||
f.Parameters[index].Reference = false;
|
||||
f.Parameters[index].Array = 1;
|
||||
f.Parameters[index].Pointer = false;
|
||||
f.Body = CreateBody(f, false);
|
||||
//f = ReferenceWrapper(new Function(function), index);
|
||||
wrappers.Add(f);
|
||||
|
||||
// Recurse to the last parameter again, keeping the Array wrappers
|
||||
|
@ -494,8 +540,12 @@ namespace Bind.Structures
|
|||
WrapParameters(f, wrappers);
|
||||
--index;
|
||||
|
||||
// On stack rewind, create Ref wrappers.
|
||||
f = ReferenceWrapper(new Function(function), index);
|
||||
f = new Function(function);
|
||||
f.Parameters[index].Reference = true;
|
||||
f.Parameters[index].Array = 0;
|
||||
f.Parameters[index].Pointer = false;
|
||||
f.Body = CreateBody(f, false);
|
||||
//f = ReferenceWrapper(new Function(function), index);
|
||||
wrappers.Add(f);
|
||||
|
||||
// Keeping the current Ref wrapper, visit all other parameters once more
|
||||
|
@ -512,7 +562,36 @@ namespace Bind.Structures
|
|||
--index;
|
||||
|
||||
// On stack rewind, create array wrappers
|
||||
f = GenericWrapper(new Function(function), index);
|
||||
f = new Function(function);
|
||||
f.Parameters[index].Reference = false;
|
||||
f.Parameters[index].Array = 0;
|
||||
f.Parameters[index].Pointer = false;
|
||||
f.Parameters[index].CurrentType = "object";
|
||||
f.Parameters[index].Flow = Parameter.FlowDirection.Undefined;
|
||||
|
||||
f.Body = CreateBody(f, false);
|
||||
wrappers.Add(f);
|
||||
|
||||
// Keeping the current Object wrapper, visit all other parameters once more
|
||||
++index;
|
||||
WrapParameters(f, wrappers);
|
||||
--index;
|
||||
|
||||
break;
|
||||
|
||||
case WrapperTypes.ReferenceParameter:
|
||||
// Recurse to the last parameter
|
||||
++index;
|
||||
WrapParameters(function, wrappers);
|
||||
--index;
|
||||
|
||||
// On stack rewind, create reference wrappers
|
||||
f = new Function(function);
|
||||
f.Parameters[index].Reference = true;
|
||||
f.Parameters[index].Array = 0;
|
||||
f.Parameters[index].Pointer = false;
|
||||
f.Body = CreateBody(f, false);
|
||||
//f = ReferenceWrapper(new Function(function), index);
|
||||
wrappers.Add(f);
|
||||
|
||||
// Keeping the current Object wrapper, visit all other parameters once more
|
||||
|
@ -528,66 +607,6 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
#region protected Function GenericWrapper(Function function, int index)
|
||||
|
||||
protected Function GenericWrapper(Function function, int index)
|
||||
{
|
||||
// Search and replace IntPtr parameters with the known parameter types:
|
||||
function.Parameters[index].Reference = false;
|
||||
function.Parameters[index].Array = 0;
|
||||
function.Parameters[index].Pointer = false;
|
||||
function.Parameters[index].CurrentType = "object";
|
||||
function.Parameters[index].Flow = Parameter.FlowDirection.Undefined;
|
||||
|
||||
// In the function body we should pin all objects in memory before calling the
|
||||
// low-level function.
|
||||
function.Body.Clear();
|
||||
//function.Body.AddRange(GetBodyWithFixedPins(function));
|
||||
function.Body.AddRange(function.GetBodyWithPins(false));
|
||||
|
||||
return function;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region protected Function ReferenceWrapper(Function function, int index)
|
||||
|
||||
protected Function ReferenceWrapper(Function function, int index)
|
||||
{
|
||||
// Search and replace IntPtr parameters with the known parameter types:
|
||||
function.Parameters[index].Reference = true;
|
||||
function.Parameters[index].Array = 0;
|
||||
function.Parameters[index].Pointer = false;
|
||||
|
||||
// In the function body we should pin all objects in memory before calling the
|
||||
// low-level function.
|
||||
function.Body.Clear();
|
||||
function.Body.AddRange(function.GetBodyWithPins(false));
|
||||
|
||||
return function;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region protected Function ArrayWrapper(Function function, int index)
|
||||
|
||||
protected Function ArrayWrapper(Function function, int index)
|
||||
{
|
||||
// Search and replace IntPtr parameters with the known parameter types:
|
||||
function.Parameters[index].Array = 1;
|
||||
function.Parameters[index].Pointer = false;
|
||||
function.Parameters[index].Flow = Parameter.FlowDirection.Undefined;
|
||||
|
||||
// In the function body we should pin all objects in memory before calling the
|
||||
// low-level function.
|
||||
function.Body.Clear();
|
||||
function.Body.AddRange(function.GetBodyWithPins(false));
|
||||
|
||||
return function;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region protected Function DefaultWrapper(Function f)
|
||||
|
||||
protected Function DefaultWrapper(Function f)
|
||||
|
@ -607,53 +626,28 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
#region protected FunctionBody GetBodyWithPins(bool wantCLSCompliance)
|
||||
#region protected FunctionBody CreateBody(Function fun, bool wantCLSCompliance)
|
||||
|
||||
/// <summary>
|
||||
/// Generates a body which calls the specified function, pinning all needed parameters.
|
||||
/// </summary>
|
||||
/// <param name="function"></param>
|
||||
protected FunctionBody GetBodyWithPins(bool wantCLSCompliance)
|
||||
static List<string> handle_statements = new List<string>();
|
||||
static List<string> fixed_statements = new List<string>();
|
||||
static List<string> assign_statements = new List<string>();
|
||||
static string function_call_statement;
|
||||
|
||||
protected FunctionBody CreateBody(Function fun, bool wantCLSCompliance)
|
||||
{
|
||||
// We'll make changes, but we want the original intact.
|
||||
//Function function = this as Function ?? new Function(this);
|
||||
//Function f = new Function(function);
|
||||
Function f = new Function(this);
|
||||
Function f = new Function(fun);
|
||||
|
||||
f.Body.Clear();
|
||||
// Unsafe only if
|
||||
//function.Unsafe = false;
|
||||
handle_statements.Clear();
|
||||
fixed_statements.Clear();
|
||||
assign_statements.Clear();
|
||||
|
||||
// Add default initliazers for out parameters:
|
||||
foreach (Parameter p in this.Parameters)
|
||||
{
|
||||
if (p.Flow == Parameter.FlowDirection.Out)
|
||||
{
|
||||
f.Body.Add(
|
||||
String.Format(
|
||||
"{0} = default({1});",
|
||||
p.Name,
|
||||
p.GetFullType(Bind.Structures.Type.CSTypes, wantCLSCompliance)
|
||||
)
|
||||
);
|
||||
}
|
||||
if (f.Name == "LoadDisplayColorTableEXT")
|
||||
{
|
||||
}
|
||||
// All GCHandles statements will go here. This will allow to place only one opening '{'
|
||||
// on fixed statements.
|
||||
int handleStart = f.Body.Count;
|
||||
|
||||
// Indicates the index where the last GCHandle statement is. Used to add an unsafe stamement
|
||||
// (if needed) at exactl that spot, i.e. after the GCHandles but before the fixed statements.
|
||||
int handleEnd = f.Body.Count;
|
||||
|
||||
// True if at least on GCHandle is allocated. Used to remove the try { } finally { }
|
||||
// block if no handle has been allocated.
|
||||
bool handleAllocated = false;
|
||||
|
||||
// True if function body contains at least one fixed statement. Add a statement-level
|
||||
// unsafe block if true (and the function is not unsafe at the function-level).
|
||||
bool fixedAllocated = false;
|
||||
|
||||
// Obtain pointers by pinning the parameters
|
||||
int param = 0;
|
||||
foreach (Parameter p in f.Parameters)
|
||||
{
|
||||
if (p.NeedsPin)
|
||||
|
@ -662,119 +656,114 @@ namespace Bind.Structures
|
|||
// This is because fixed can only take the address of fields, not managed objects.
|
||||
if (p.WrapperType == WrapperTypes.GenericParameter)
|
||||
{
|
||||
f.Body.Insert(
|
||||
handleStart,
|
||||
String.Format(
|
||||
"{0} {1} = {0}.Alloc({2}, System.Runtime.InteropServices.GCHandleType.Pinned);",
|
||||
"System.Runtime.InteropServices.GCHandle",
|
||||
p.Name + "_ptr",
|
||||
p.Name
|
||||
)
|
||||
);
|
||||
handle_statements.Add(String.Format(
|
||||
"{0} {1} = {0}.Alloc({2}, System.Runtime.InteropServices.GCHandleType.Pinned);",
|
||||
"System.Runtime.InteropServices.GCHandle", p.Name + "_ptr", p.Name));
|
||||
|
||||
if (p.Flow == Parameter.FlowDirection.Out)
|
||||
{
|
||||
assign_statements.Add(String.Format(
|
||||
" {0} = ({1}){2}.Target;",
|
||||
p.Name, p.CurrentType, p.Name + "_ptr"));
|
||||
}
|
||||
|
||||
// Note! The following line modifies f.Parameters, *not* function.Parameters
|
||||
p.Name = "(void*)" + p.Name + "_ptr.AddrOfPinnedObject()";
|
||||
}
|
||||
else if (p.WrapperType == WrapperTypes.PointerParameter ||
|
||||
p.WrapperType == WrapperTypes.ArrayParameter ||
|
||||
p.WrapperType == WrapperTypes.ReferenceParameter)
|
||||
{
|
||||
fixed_statements.Add(String.Format(
|
||||
"fixed ({0}* {1} = {2})",
|
||||
wantCLSCompliance && !p.CLSCompliant ? p.GetCLSCompliantType() : p.CurrentType,
|
||||
p.Name + "_ptr",
|
||||
p.Array > 0 ? p.Name : "&" + p.Name));
|
||||
|
||||
handleAllocated = true;
|
||||
if (p.Flow == Parameter.FlowDirection.Out && p.Array == 0) // Fixed Arrays of blittable types don't need explicit assignment.
|
||||
{
|
||||
assign_statements.Add(String.Format(" {0} = *{0}_ptr;", p.Name));
|
||||
}
|
||||
|
||||
handleEnd++;
|
||||
p.Name = p.Name + "_ptr";
|
||||
}
|
||||
else
|
||||
{
|
||||
f.Body.Add(
|
||||
String.Format(
|
||||
" fixed ({0}* {1} = {2})",
|
||||
wantCLSCompliance && !p.CLSCompliant ?
|
||||
p.GetCLSCompliantType() :
|
||||
p.CurrentType,
|
||||
p.Name + "_ptr",
|
||||
p.Array > 0 ? p.Name : "&" + p.Name
|
||||
)
|
||||
);
|
||||
p.Name = p.Name + "_ptr";
|
||||
|
||||
fixedAllocated = true;
|
||||
throw new ApplicationException("Unknown parameter type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.Unsafe)
|
||||
//if (!f.Unsafe && (fixed_statements.Count > 0 || fixed_statements.Count > 0))
|
||||
{
|
||||
f.Body.Insert(handleEnd, "unsafe");
|
||||
f.Body.Insert(handleEnd + 1, "{");
|
||||
f.Body.Add("unsafe");
|
||||
f.Body.Add("{");
|
||||
f.Body.Indent();
|
||||
}
|
||||
|
||||
if (handleAllocated)
|
||||
if (fixed_statements.Count > 0)
|
||||
{
|
||||
f.Body.Add(" try");
|
||||
f.Body.AddRange(fixed_statements);
|
||||
f.Body.Add("{");
|
||||
f.Body.Indent();
|
||||
}
|
||||
|
||||
if (handle_statements.Count > 0)
|
||||
{
|
||||
f.Body.AddRange(handle_statements);
|
||||
f.Body.Add("try");
|
||||
f.Body.Add("{");
|
||||
f.Body.Indent();
|
||||
}
|
||||
|
||||
f.Body.Add(" {");
|
||||
// Add delegate call:
|
||||
if (f.ReturnType.CurrentType.ToLower().Contains("void"))
|
||||
f.Body.Add(String.Format(" {0};", f.CallString()));
|
||||
else
|
||||
f.Body.Add(String.Format(" {0} {1} = {2};", f.ReturnType.CurrentType, "retval", f.CallString()));
|
||||
|
||||
// Assign out parameters:
|
||||
foreach (Parameter p in this.Parameters)
|
||||
{
|
||||
if (p.Flow == Parameter.FlowDirection.Out)
|
||||
{
|
||||
// Check each out parameter. If it has been pinned, get the Target of the GCHandle.
|
||||
// Otherwise, nothing needs be done.
|
||||
if (p.NeedsPin)
|
||||
{
|
||||
if (p.WrapperType == WrapperTypes.GenericParameter)
|
||||
{
|
||||
f.Body.Add(
|
||||
String.Format(
|
||||
" {0} = ({1}){2}.Target;",
|
||||
p.Name,
|
||||
p.CurrentType,
|
||||
p.Name + "_ptr"
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
f.Body.Add(
|
||||
String.Format(
|
||||
" {0} = *{0}_ptr;",
|
||||
p.Name
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
f.Body.Add(String.Format("{0};", f.CallString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
f.Body.Add(String.Format("{0} {1} = {2};", f.ReturnType.CurrentType, "retval", f.CallString()));
|
||||
}
|
||||
|
||||
if (assign_statements.Count > 0)
|
||||
{
|
||||
f.Body.AddRange(assign_statements);
|
||||
}
|
||||
|
||||
// Return:
|
||||
if (!f.ReturnType.CurrentType.ToLower().Contains("void"))
|
||||
{
|
||||
f.Body.Add(" return retval;");
|
||||
f.Body.Add("return retval;");
|
||||
}
|
||||
|
||||
if (handleAllocated)
|
||||
if (handle_statements.Count > 0)
|
||||
{
|
||||
f.Body.Add(" }");
|
||||
f.Body.Add(" finally");
|
||||
f.Body.Add(" {");
|
||||
f.Body.Unindent();
|
||||
f.Body.Add("}");
|
||||
f.Body.Add("finally");
|
||||
f.Body.Add("{");
|
||||
f.Body.Indent();
|
||||
// Free all allocated GCHandles
|
||||
foreach (Parameter p in this.Parameters)
|
||||
{
|
||||
// Free all allocated GCHandles
|
||||
if (p.NeedsPin)
|
||||
if (p.NeedsPin && p.WrapperType == WrapperTypes.GenericParameter)
|
||||
{
|
||||
if (p.WrapperType == WrapperTypes.GenericParameter)
|
||||
f.Body.Add(String.Format(" {0}_ptr.Free();", p.Name));
|
||||
//else
|
||||
// f.Body.Add("}");
|
||||
f.Body.Add(String.Format(" {0}_ptr.Free();", p.Name));
|
||||
}
|
||||
}
|
||||
f.Body.Unindent();
|
||||
f.Body.Add("}");
|
||||
}
|
||||
f.Body.Add(" }");
|
||||
|
||||
if (!this.Unsafe)
|
||||
if (fixed_statements.Count > 0)
|
||||
{
|
||||
f.Body.Unindent();
|
||||
f.Body.Add("}");
|
||||
}
|
||||
|
||||
//if (!f.Unsafe && (fixed_statements.Count > 0 || fixed_statements.Count > 0))
|
||||
{
|
||||
f.Body.Unindent();
|
||||
f.Body.Add("}");
|
||||
}
|
||||
|
||||
|
@ -785,6 +774,8 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
#region Translate
|
||||
|
||||
/// <summary>
|
||||
/// Translates the opengl return type to the equivalent C# type.
|
||||
/// </summary>
|
||||
|
@ -836,11 +827,16 @@ namespace Bind.Structures
|
|||
|
||||
if (ReturnType.CurrentType.ToLower().Contains("bool"))
|
||||
{
|
||||
// TODO: Is the translation to 'int' needed 100%? It breaks WGL.
|
||||
/*
|
||||
if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||
{
|
||||
ReturnType.CurrentType = "int";
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
//ReturnType.WrapperType = WrapperTypes.ReturnsBool;
|
||||
}
|
||||
|
@ -871,24 +867,6 @@ namespace Bind.Structures
|
|||
//IsPointer = true;
|
||||
Parameters[i].Array = 1;
|
||||
}
|
||||
|
||||
if (Parameters[i].CurrentType == "PIXELFORMATDESCRIPTOR")
|
||||
{
|
||||
Parameters[i].CurrentType = Settings.WindowsPlatform + ".PixelFormatDescriptor";
|
||||
}
|
||||
else if (Parameters[i].CurrentType == "LAYERPLANEDESCRIPTOR")
|
||||
{
|
||||
Parameters[i].CurrentType = Settings.WindowsPlatform + ".LayerPlaneDescriptor";
|
||||
}
|
||||
else if (Parameters[i].CurrentType == "LPCSTR")
|
||||
{
|
||||
// TODO: Why doesn't the cs typemap work for LPCSTR and COLORREF?
|
||||
Parameters[i].CurrentType = "String";
|
||||
}
|
||||
else if (Parameters[i].CurrentType == "COLORREF")
|
||||
{
|
||||
Parameters[i].CurrentType = "Int32";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -897,36 +875,10 @@ namespace Bind.Structures
|
|||
TranslateReturnType();
|
||||
TranslateParameters();
|
||||
|
||||
List<Function> wrappers = (List<Function>)CreateWrappers();
|
||||
|
||||
// If the function is not CLS-compliant (e.g. it contains unsigned parameters)
|
||||
// we need to create a CLS-Compliant overload. However, we should only do this
|
||||
// iff the opengl function does not contain unsigned/signed overloads itself
|
||||
// to avoid redefinitions.
|
||||
foreach (Function f in wrappers)
|
||||
{
|
||||
Bind.Structures.Function.Wrappers.AddChecked(f);
|
||||
|
||||
if (this.Name.Contains("Bitmap"))
|
||||
{
|
||||
}
|
||||
|
||||
bool createCLS = !f.CLSCompliant;
|
||||
|
||||
/*string nameWithoutExtension = Utilities.StripGL2Extension(f.Name).TrimEnd('v');
|
||||
createCLS &=
|
||||
String.IsNullOrEmpty(f.TrimmedName) ||
|
||||
nameWithoutExtension.Substring(nameWithoutExtension.Length - 3).Contains("u") &&
|
||||
!nameWithoutExtension.Substring(nameWithoutExtension.Length - 3).Contains("b");*/
|
||||
|
||||
if (createCLS)
|
||||
{
|
||||
Function clsFunction = f.GetCLSCompliantFunction();
|
||||
if (clsFunction != null)
|
||||
Bind.Structures.Function.Wrappers.AddChecked(clsFunction);
|
||||
}
|
||||
}
|
||||
CreateWrappers();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region class DelegateCollection : Dictionary<string, Delegate>
|
||||
|
|
|
@ -12,7 +12,7 @@ using System.Diagnostics;
|
|||
|
||||
namespace Bind.Structures
|
||||
{
|
||||
public class Function : Delegate
|
||||
public class Function : Delegate, IEquatable<Function>
|
||||
{
|
||||
internal static FunctionCollection Wrappers;
|
||||
|
||||
|
@ -138,9 +138,13 @@ namespace Bind.Structures
|
|||
// remove the Extension and the overload information from the name
|
||||
// (Extension == "ARB", "EXT", etc, overload == [u][bsidf][v])
|
||||
// TODO: Use some regex's here, to reduce clutter.
|
||||
if (Settings.Compatibility != Settings.Legacy.Tao)
|
||||
TrimmedName = value;
|
||||
|
||||
if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
TrimmedName = value;
|
||||
TrimmedName = Utilities.StripGL2Extension(value);
|
||||
|
||||
//if (TrimmedName.Contains("Uniform2iv"))
|
||||
|
@ -194,7 +198,7 @@ namespace Bind.Structures
|
|||
sb.Append(" ");
|
||||
if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||
{
|
||||
sb.Append("gl");
|
||||
sb.Append(Settings.FunctionPrefix);
|
||||
}
|
||||
sb.Append(!String.IsNullOrEmpty(TrimmedName) ? TrimmedName : Name);
|
||||
sb.Append(Parameters.ToString(true));
|
||||
|
@ -209,38 +213,13 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
#region public Function GetCLSCompliantFunction(Dictionary<string, string> CSTypes)
|
||||
#region IEquatable<Function> Members
|
||||
|
||||
public Function GetCLSCompliantFunction()
|
||||
public bool Equals(Function other)
|
||||
{
|
||||
Function f = new Function(this);
|
||||
|
||||
bool somethingChanged = false;
|
||||
for (int i = 0; i < f.Parameters.Count; i++)
|
||||
{
|
||||
f.Parameters[i].CurrentType = f.Parameters[i].GetCLSCompliantType();
|
||||
if (f.Parameters[i].CurrentType != this.Parameters[i].CurrentType)
|
||||
somethingChanged = true;
|
||||
}
|
||||
|
||||
if (!somethingChanged)
|
||||
return null;
|
||||
|
||||
f.Body.Clear();
|
||||
if (!f.NeedsWrapper)
|
||||
{
|
||||
f.Body.Add((f.ReturnType.CurrentType != "void" ? "return " + this.CallString() : this.CallString()) + ";");
|
||||
}
|
||||
else
|
||||
{
|
||||
f.Body.AddRange(this.GetBodyWithPins(true));
|
||||
}
|
||||
|
||||
// The type system cannot differentiate between functions with the same parameters
|
||||
// but different return types. Tough, only CLS-Compliant function in that case.
|
||||
//f.ReturnType.Type = f.ReturnType.GetCLSCompliantType(CSTypes);
|
||||
|
||||
return f;
|
||||
return !String.IsNullOrEmpty(this.TrimmedName) && !String.IsNullOrEmpty(other.TrimmedName) &&
|
||||
this.TrimmedName == other.TrimmedName &&
|
||||
this.Parameters.ToString(true) == other.Parameters.ToString(true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -262,6 +241,32 @@ namespace Bind.Structures
|
|||
}
|
||||
}
|
||||
|
||||
private string indent = "";
|
||||
|
||||
public void Indent()
|
||||
{
|
||||
indent += " ";
|
||||
}
|
||||
|
||||
public void Unindent()
|
||||
{
|
||||
if (indent.Length >= 4)
|
||||
indent = indent.Substring(4);
|
||||
}
|
||||
|
||||
new public void Add(string s)
|
||||
{
|
||||
base.Add(indent + s);
|
||||
}
|
||||
|
||||
new public void AddRange(IEnumerable<string> collection)
|
||||
{
|
||||
foreach (string t in collection)
|
||||
{
|
||||
this.Add(t);
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (this.Count == 0)
|
||||
|
@ -286,6 +291,8 @@ namespace Bind.Structures
|
|||
|
||||
class FunctionCollection : Dictionary<string, List<Function>>
|
||||
{
|
||||
Regex unsignedFunctions = new Regex(@".+(u[dfisb]v?)", RegexOptions.Compiled);
|
||||
|
||||
public void Add(Function f)
|
||||
{
|
||||
if (!this.ContainsKey(f.Extension))
|
||||
|
@ -314,28 +321,28 @@ namespace Bind.Structures
|
|||
/// <param name="f">The Function to add.</param>
|
||||
public void AddChecked(Function f)
|
||||
{
|
||||
bool exists = false;
|
||||
if (Bind.Structures.Function.Wrappers.ContainsKey(f.Extension))
|
||||
{
|
||||
Function fun = Bind.Structures.Function.Wrappers[f.Extension]
|
||||
.Find(delegate(Function target)
|
||||
{
|
||||
return
|
||||
!String.IsNullOrEmpty(target.TrimmedName) &&
|
||||
target.TrimmedName == f.TrimmedName &&
|
||||
target.Parameters.ToString(true) == f.Parameters.ToString(true);
|
||||
});
|
||||
if (fun != null)
|
||||
int index = Bind.Structures.Function.Wrappers[f.Extension].IndexOf(f);
|
||||
if (index == -1)
|
||||
{
|
||||
exists = true;
|
||||
/*Debug.WriteLine("Function redefinition:");
|
||||
Debug.WriteLine(fun.ToString());
|
||||
Debug.WriteLine(f.ToString());*/
|
||||
Bind.Structures.Function.Wrappers.Add(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (unsignedFunctions.IsMatch(Utilities.StripGL2Extension(f.Name)))// &&
|
||||
//!unsignedFunctions.IsMatch(
|
||||
// Utilities.StripGL2Extension(Bind.Structures.Function.Wrappers[f.Extension][index].Name)))
|
||||
{
|
||||
Bind.Structures.Function.Wrappers[f.Extension].RemoveAt(index);
|
||||
Bind.Structures.Function.Wrappers[f.Extension].Add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!exists)
|
||||
else
|
||||
{
|
||||
Bind.Structures.Function.Wrappers.Add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,10 +104,11 @@ namespace Bind.Structures
|
|||
|
||||
public bool NeedsPin
|
||||
{
|
||||
get { return
|
||||
(Array > 0 || Reference || CurrentType == "object") &&
|
||||
!CurrentType.ToLower().Contains("string");
|
||||
}
|
||||
get
|
||||
{
|
||||
return (Array > 0 || Reference || CurrentType == "object") &&
|
||||
!CurrentType.ToLower().Contains("string");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -235,7 +236,27 @@ namespace Bind.Structures
|
|||
else
|
||||
{
|
||||
// This is not enum, default translation:
|
||||
p.CurrentType = s;
|
||||
if (p.CurrentType == "PIXELFORMATDESCRIPTOR" || p.CurrentType == "LAYERPLANEDESCRIPTOR" ||
|
||||
p.CurrentType == "GLYPHMETRICSFLOAT")
|
||||
{
|
||||
if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||
{
|
||||
p.CurrentType = p.CurrentType.Insert(0, "Gdi.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p.CurrentType == "PIXELFORMATDESCRIPTOR")
|
||||
p.CurrentType ="API.PixelFormatDescriptor";
|
||||
else if (p.CurrentType == "LAYERPLANEDESCRIPTOR")
|
||||
p.CurrentType = "API.LayerPlaneDescriptor";
|
||||
else if (p.CurrentType == "GLYPHMETRICSFLOAT")
|
||||
p.CurrentType = "API.GlyphMetricsFloat";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p.CurrentType = s;
|
||||
}
|
||||
p.CurrentType =
|
||||
Bind.Structures.Type.CSTypes.ContainsKey(p.CurrentType) ?
|
||||
Bind.Structures.Type.CSTypes[p.CurrentType] : p.CurrentType;
|
||||
|
@ -267,6 +288,11 @@ namespace Bind.Structures
|
|||
}
|
||||
}
|
||||
|
||||
if (p.Reference)
|
||||
{
|
||||
p.WrapperType = WrapperTypes.ReferenceParameter;
|
||||
}
|
||||
|
||||
if (p.CurrentType.ToLower().Contains("bool"))
|
||||
{
|
||||
// Is this actually used anywhere?
|
||||
|
@ -375,18 +401,23 @@ namespace Bind.Structures
|
|||
{
|
||||
if (p.CurrentType.ToLower().Contains("string"))
|
||||
{
|
||||
sb.Append(String.Format(
|
||||
"({0}{1})",
|
||||
p.CurrentType,
|
||||
(p.Array > 0) ? "[]" : ""));
|
||||
sb.Append(String.Format("({0}{1})",
|
||||
p.CurrentType, (p.Array > 0) ? "[]" : ""));
|
||||
|
||||
}
|
||||
else if (p.Pointer || p.Array > 0 || p.Reference)
|
||||
{
|
||||
sb.Append(String.Format("({0}*)",
|
||||
p.CurrentType /*, (p.Pointer || p.Array > 0) ? "*" : ""*/));
|
||||
}
|
||||
//else if (p.Reference)
|
||||
//{
|
||||
// sb.Append(String.Format("{0} ({1})",
|
||||
// p.Flow == Parameter.FlowDirection.Out ? "out" : "ref", p.CurrentType));
|
||||
//}
|
||||
else
|
||||
{
|
||||
sb.Append(String.Format(
|
||||
"({0}{1})",
|
||||
p.CurrentType,
|
||||
(p.Pointer || p.Array > 0 || p.Reference) ? "*" : ""));
|
||||
sb.Append(String.Format("({0})", p.CurrentType));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -216,12 +216,16 @@ namespace Bind.Structures
|
|||
switch (CurrentType)
|
||||
{
|
||||
case "UInt16":
|
||||
case "ushort":
|
||||
return "Int16";
|
||||
case "UInt32":
|
||||
case "uint":
|
||||
return "Int32";
|
||||
case "UInt64":
|
||||
case "ulong":
|
||||
return "Int64";
|
||||
case "SByte":
|
||||
case "sbyte":
|
||||
return "Byte";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,10 @@ namespace Bind
|
|||
/// </summary>
|
||||
PointerParameter,
|
||||
/// <summary>
|
||||
/// Function that takes a reference to a struct.
|
||||
/// </summary>
|
||||
ReferenceParameter,
|
||||
/// <summary>
|
||||
/// Function returns string - needs manual marshalling through IntPtr to prevent the managed GC
|
||||
/// from freeing memory allocated on the unmanaged side (e.g. glGetString).
|
||||
/// </summary>
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace Bind.Wgl
|
|||
{
|
||||
#region --- Constructors ---
|
||||
|
||||
public Generator(string path)
|
||||
: base(path)
|
||||
public Generator()
|
||||
: base()
|
||||
{
|
||||
glTypemap = "Wgl\\wgl.tm";
|
||||
csTypemap = "csharp.tm";
|
||||
|
@ -29,10 +29,20 @@ namespace Bind.Wgl
|
|||
delegatesFile = "WglDelegates.cs";
|
||||
enumsFile = "WglEnums.cs";
|
||||
wrappersFile = "Wgl.cs";
|
||||
|
||||
className = "Wgl";
|
||||
|
||||
functionPrefix = "wgl";
|
||||
Settings.OutputClass = "Wgl";
|
||||
Settings.FunctionPrefix = "wgl";
|
||||
Settings.ConstantPrefix = "WGL_";
|
||||
|
||||
if (Settings.Compatibility == Settings.Legacy.Tao)
|
||||
{
|
||||
Settings.OutputNamespace = "Tao.Platform.Windows";
|
||||
Settings.WindowsGDI = "Tao.Platform.Windows.Gdi";
|
||||
}
|
||||
else
|
||||
{
|
||||
Settings.OutputNamespace = "OpenTK.Platform.Windows";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
24
Source/Examples/ExampleLauncher.Designer.cs
generated
24
Source/Examples/ExampleLauncher.Designer.cs
generated
|
@ -28,26 +28,44 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.runButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.listBox1.FormattingEnabled = true;
|
||||
this.listBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.listBox1.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(284, 264);
|
||||
this.listBox1.TabIndex = 0;
|
||||
this.listBox1.DoubleClick += new System.EventHandler(this.listBox1_DoubleClick);
|
||||
this.listBox1.KeyUp += new System.Windows.Forms.KeyEventHandler(this.listBox1_KeyUp);
|
||||
//
|
||||
// runButton
|
||||
//
|
||||
this.runButton.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.runButton.Location = new System.Drawing.Point(0, 220);
|
||||
this.runButton.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.runButton.Name = "runButton";
|
||||
this.runButton.Size = new System.Drawing.Size(284, 44);
|
||||
this.runButton.TabIndex = 0;
|
||||
this.runButton.Text = "Run Example";
|
||||
this.runButton.UseVisualStyleBackColor = true;
|
||||
this.runButton.Click += new System.EventHandler(this.runButton_Click);
|
||||
//
|
||||
// ExampleLauncher
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 264);
|
||||
this.Controls.Add(this.runButton);
|
||||
this.Controls.Add(this.listBox1);
|
||||
this.MinimumSize = new System.Drawing.Size(300, 300);
|
||||
this.Name = "ExampleLauncher";
|
||||
this.Text = "OpenTK Example Launcher";
|
||||
this.Load += new System.EventHandler(this.ExampleLauncher_Load);
|
||||
|
@ -58,5 +76,7 @@
|
|||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListBox listBox1;
|
||||
private System.Windows.Forms.Button runButton;
|
||||
|
||||
}
|
||||
}
|
|
@ -45,8 +45,10 @@ namespace Examples
|
|||
MessageBox.Show("Could not access debug.log", e.ToString());
|
||||
}
|
||||
|
||||
Debug.Listeners.Clear();
|
||||
Debug.Listeners.Add(new TextWriterTraceListener("debug.log"));
|
||||
Debug.Listeners.Add(new ConsoleTraceListener());
|
||||
Debug.AutoFlush = true;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -70,7 +72,45 @@ namespace Examples
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void listBox1_DoubleClick(object sender, EventArgs e)
|
||||
void Launch(object example)
|
||||
{
|
||||
Type ex = example as Type;
|
||||
try
|
||||
{
|
||||
(ex.GetConstructor(Type.EmptyTypes).Invoke(null) as IExample).Launch();
|
||||
}
|
||||
catch (Exception expt)
|
||||
{
|
||||
MessageBox.Show(String.Format("Stacktrace:{0}{1}{0}{0}Inner exception:{0}{2}",
|
||||
System.Environment.NewLine, expt.StackTrace, expt.InnerException), expt.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void ExampleLauncher_Load(object sender, EventArgs e)
|
||||
{
|
||||
SortedList<string, string> sl = new SortedList<string, string>();
|
||||
|
||||
// Get all examples
|
||||
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
|
||||
foreach (Type type in types)
|
||||
{
|
||||
if (type.GetInterface("IExample") != null)
|
||||
{
|
||||
sl.Add((type.Namespace.Replace("Examples.", String.Empty) + ": " + type.Name).Replace('_', ' '), null);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string s in sl.Keys)
|
||||
listBox1.Items.Add(s);
|
||||
|
||||
// Select first item
|
||||
if (listBox1.Items.Count > 0)
|
||||
{
|
||||
this.listBox1.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void RunExample()
|
||||
{
|
||||
if (listBox1.SelectedItem != null)
|
||||
{
|
||||
|
@ -79,7 +119,7 @@ namespace Examples
|
|||
"Examples." + listBox1.SelectedItem.ToString().Replace(": ", ".").Replace(' ', '_'),
|
||||
true,
|
||||
true);
|
||||
|
||||
|
||||
Debug.Print("Launching example: {0}", example.ToString());
|
||||
|
||||
if (example.BaseType == typeof(GameWindow))
|
||||
|
@ -111,51 +151,24 @@ namespace Examples
|
|||
}
|
||||
}
|
||||
|
||||
void Launch(object example)
|
||||
private void listBox1_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
Type ex = example as Type;
|
||||
try
|
||||
RunExample();
|
||||
}
|
||||
|
||||
private void listBox1_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
(ex.GetConstructor(Type.EmptyTypes).Invoke(null) as IExample).Launch();
|
||||
}
|
||||
catch (Exception expt)
|
||||
{
|
||||
MessageBox.Show(
|
||||
String.Format(
|
||||
"Stacktrace:{0}{1}{0}{0}Inner exception:{0}{2}",
|
||||
System.Environment.NewLine,
|
||||
expt.StackTrace,
|
||||
expt.InnerException
|
||||
),
|
||||
expt.Message);
|
||||
case Keys.Enter:
|
||||
RunExample();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void ExampleLauncher_Load(object sender, EventArgs e)
|
||||
private void runButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
SortedList<string, string> sl = new SortedList<string, string>();
|
||||
|
||||
// Get all examples
|
||||
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
|
||||
foreach (Type type in types)
|
||||
{
|
||||
if (type.GetInterface("IExample") != null)
|
||||
{
|
||||
sl.Add(
|
||||
(type.Namespace.Replace("Examples.", String.Empty) + ": " + type.Name).Replace('_', ' '),
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string s in sl.Keys)
|
||||
listBox1.Items.Add(s);
|
||||
|
||||
// Select first item
|
||||
if (listBox1.Items.Count > 0)
|
||||
{
|
||||
this.listBox1.SelectedIndex = 0;
|
||||
}
|
||||
RunExample();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,10 +117,4 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="exampleLauncherBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="exampleLauncherBindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>243, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -67,7 +67,7 @@ namespace Examples.WinForms
|
|||
#region private void Render()
|
||||
|
||||
private void Render()
|
||||
{
|
||||
{
|
||||
GL.MatrixMode(GL.Enums.MatrixMode.MODELVIEW);
|
||||
GL.LoadIdentity();
|
||||
Glu.LookAt(
|
||||
|
@ -171,37 +171,38 @@ namespace Examples.WinForms
|
|||
{
|
||||
GL.Begin(GL.Enums.BeginMode.QUADS);
|
||||
|
||||
GL.Color3(1.0f, 0.0f, 0.0f);
|
||||
GL.Color3((byte)Color.Silver.R, (byte)Color.Silver.G, (byte)Color.Silver.B);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
|
||||
GL.Color3(1.0f, 1.0f, 0.0f);
|
||||
GL.Color3((byte)Color.Honeydew.R, (byte)Color.Honeydew.G, (byte)Color.Honeydew.B);
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
|
||||
GL.Color3(1.0f, 0.0f, 1.0f);
|
||||
GL.Color3((byte)Color.Moccasin.R, (byte)Color.Moccasin.G, (byte)Color.Moccasin.B);
|
||||
|
||||
GL.Vertex3(-1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
|
||||
GL.Color3(0.0f, 1.0f, 0.0f);
|
||||
GL.Color3((byte)Color.IndianRed.R, (byte)Color.IndianRed.G, (byte)Color.IndianRed.B);
|
||||
GL.Vertex3(-1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, -1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
|
||||
GL.Color3(0.0f, 0.0f, 1.0f);
|
||||
GL.Color3((byte)Color.PaleVioletRed.R, (byte)Color.PaleVioletRed.G, (byte)Color.PaleVioletRed.B);
|
||||
GL.Vertex3(-1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(-1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
|
||||
GL.Color3(0.0f, 1.0f, 1.0f);
|
||||
GL.Color3((byte)Color.ForestGreen.R, (byte)Color.ForestGreen.G, (byte)Color.ForestGreen.B);
|
||||
GL.Vertex3(1.0f, -1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, -1.0f);
|
||||
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||
|
|
|
@ -30,41 +30,43 @@ namespace Examples.WinForms
|
|||
this.ShowDialog();
|
||||
}
|
||||
|
||||
protected override void OnHandleCreated(EventArgs e)
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnHandleCreated(e);
|
||||
base.OnLoad(e);
|
||||
|
||||
glControl1.CreateContext();
|
||||
}
|
||||
|
||||
private void redButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
GL.ClearColor(0.7f, 0.0f, 0.0f, 0.0f);
|
||||
glControl1.Invalidate();
|
||||
//GL.ClearColor(0.7f, 0.0f, 0.0f, 0.0f);
|
||||
//glControl1.Invalidate();
|
||||
}
|
||||
|
||||
private void greenButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
GL.ClearColor(0.0f, 0.5f, 0.0f, 0.0f);
|
||||
glControl1.Invalidate();
|
||||
//GL.ClearColor(0.0f, 0.5f, 0.0f, 0.0f);
|
||||
//glControl1.Invalidate();
|
||||
}
|
||||
|
||||
private void blueButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
GL.ClearColor(0.0f, 0.0f, 0.7f, 0.0f);
|
||||
glControl1.Invalidate();
|
||||
//GL.ClearColor(0.0f, 0.0f, 0.7f, 0.0f);
|
||||
//glControl1.Invalidate();
|
||||
}
|
||||
|
||||
private void glControl1_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT);
|
||||
glControl1.Context.SwapBuffers();
|
||||
//GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT);
|
||||
//glControl1.SwapBuffers();
|
||||
}
|
||||
|
||||
private void glControl1_Resize(object sender, OpenTK.Platform.ResizeEventArgs e)
|
||||
{
|
||||
if (glControl1.ClientSize.Height == 0)
|
||||
glControl1.ClientSize = new System.Drawing.Size(glControl1.ClientSize.Width, 1);
|
||||
//if (glControl1.ClientSize.Height == 0)
|
||||
// glControl1.ClientSize = new System.Drawing.Size(glControl1.ClientSize.Width, 1);
|
||||
|
||||
GL.Viewport(0, 0, glControl1.ClientSize.Width, glControl1.ClientSize.Height);
|
||||
//GL.Viewport(0, 0, glControl1.ClientSize.Width, glControl1.ClientSize.Height);
|
||||
}
|
||||
|
||||
private void glControl1_KeyDown(object sender, KeyEventArgs e)
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace OpenTK
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.Visible = false;
|
||||
this.Fullscreen = mode.Fullscreen;
|
||||
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
|
|
|
@ -204,6 +204,7 @@ namespace OpenTK
|
|||
if (!Exists)
|
||||
{
|
||||
glWindow.CreateWindow(mode);
|
||||
OpenTK.OpenGL.GL.LoadAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -10,7 +10,6 @@ namespace OpenTK.OpenGL
|
|||
{
|
||||
static Delegates()
|
||||
{
|
||||
GL.LoadAll();
|
||||
}
|
||||
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace OpenTK.OpenGL
|
|||
|
||||
#region --- Fields ---
|
||||
|
||||
internal const string Library = "OPENGL32.DLL";
|
||||
internal const string Library = "opengl32.dll";
|
||||
|
||||
private static System.Collections.Generic.Dictionary<string, bool> AvailableExtensions = new Dictionary<string, bool>();
|
||||
private static bool rebuildExtensionList;
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace OpenTK.Platform
|
|||
{
|
||||
public interface IGLControl : IDisposable
|
||||
{
|
||||
|
||||
bool IsIdle { get; }
|
||||
bool Fullscreen { get; set; }
|
||||
IGLContext Context { get; }
|
||||
|
|
|
@ -64,9 +64,11 @@ namespace OpenTK.Platform.Windows
|
|||
RawInputDeviceSize = Marshal.SizeOf(typeof(RawInputDevice));
|
||||
RawInputDeviceListSize = Marshal.SizeOf(typeof(RawInputDeviceList));
|
||||
RawInputDeviceInfoSize = Marshal.SizeOf(typeof(RawInputDeviceInfo));
|
||||
PixelFormatDescriptorVersion = 1;
|
||||
PixelFormatDescriptorSize = (short)Marshal.SizeOf(typeof(PixelFormatDescriptor));
|
||||
}
|
||||
|
||||
#region Constants
|
||||
#region --- Constants ---
|
||||
|
||||
public struct Constants
|
||||
{
|
||||
|
@ -401,7 +403,7 @@ namespace OpenTK.Platform.Windows
|
|||
/// <param name="pfd"></param>
|
||||
/// <returns></returns>
|
||||
[DllImport("gdi32.dll")]
|
||||
public static extern int ChoosePixelFormat(IntPtr dc, [In, MarshalAs(UnmanagedType.LPStruct)]PixelFormatDescriptor pfd);
|
||||
public static extern int ChoosePixelFormat(IntPtr dc, ref PixelFormatDescriptor pfd);
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -416,12 +418,7 @@ namespace OpenTK.Platform.Windows
|
|||
/// <returns></returns>
|
||||
[DllImport("gdi32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool SetPixelFormat(
|
||||
IntPtr dc,
|
||||
int format,
|
||||
[In, MarshalAs(UnmanagedType.LPStruct)]PixelFormatDescriptor pfd
|
||||
);
|
||||
|
||||
public static extern bool SetPixelFormat(IntPtr dc, int format, ref PixelFormatDescriptor pfd);
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -1275,54 +1272,56 @@ namespace OpenTK.Platform.Windows
|
|||
#endregion
|
||||
|
||||
#region PixelFormatDescriptor
|
||||
|
||||
internal static short PixelFormatDescriptorSize;
|
||||
internal static short PixelFormatDescriptorVersion;
|
||||
|
||||
/// <summary>
|
||||
/// Describes a pixel format. It is used when interfacing with the WINAPI to create a new Context.
|
||||
/// Found in WinGDI.h
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class PixelFormatDescriptor
|
||||
public struct PixelFormatDescriptor
|
||||
{
|
||||
public readonly short Size = (short)Marshal.SizeOf(typeof(PixelFormatDescriptor)); // No need for the user to set the size, since it is predefined.
|
||||
public short Version = 1;
|
||||
public PixelFormatDescriptorFlags Flags =
|
||||
//PixelFormatDescriptorFlags.DOUBLEBUFFER |
|
||||
PixelFormatDescriptorFlags.DRAW_TO_WINDOW |
|
||||
PixelFormatDescriptorFlags.SUPPORT_OPENGL;
|
||||
public byte PixelType = Constants.PFD_TYPE_RGBA;
|
||||
public byte ColorBits = 0;
|
||||
public byte RedBits = 0;
|
||||
public byte RedShift = 0;
|
||||
public byte GreenBits = 0;
|
||||
public byte GreenShift = 0;
|
||||
public byte BlueBits = 0;
|
||||
public byte BlueShift = 0;
|
||||
public byte AlphaBits = 8;
|
||||
public byte AlphaShift = 0;
|
||||
public byte AccumBits = 0;
|
||||
public byte AccumRedBits = 0;
|
||||
public byte AccumGreenBits = 0;
|
||||
public byte AccumBlueBits = 0;
|
||||
public byte AccumAlphaBits = 0;
|
||||
public byte DepthBits = 0;
|
||||
public byte StencilBits = 0;
|
||||
public byte AuxBuffers = 0;
|
||||
public byte LayerType = unchecked((byte)Constants.PFD_MAIN_PLANE);
|
||||
byte Reserved = 0;
|
||||
public int LayerMask = 0;
|
||||
public int VisibleMask = 0;
|
||||
public int DamageMask = 0;
|
||||
internal short Size;
|
||||
internal short Version;
|
||||
public PixelFormatDescriptorFlags Flags;
|
||||
public PixelType PixelType;
|
||||
public byte ColorBits;
|
||||
public byte RedBits;
|
||||
public byte RedShift;
|
||||
public byte GreenBits;
|
||||
public byte GreenShift;
|
||||
public byte BlueBits;
|
||||
public byte BlueShift;
|
||||
public byte AlphaBits;
|
||||
public byte AlphaShift;
|
||||
public byte AccumBits;
|
||||
public byte AccumRedBits;
|
||||
public byte AccumGreenBits;
|
||||
public byte AccumBlueBits;
|
||||
public byte AccumAlphaBits;
|
||||
public byte DepthBits;
|
||||
public byte StencilBits;
|
||||
public byte AuxBuffers;
|
||||
public byte LayerType;
|
||||
private byte Reserved;
|
||||
public int LayerMask;
|
||||
public int VisibleMask;
|
||||
public int DamageMask;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public class LayerPlaneDescriptor
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Describes the pixel format of a drawing surface.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class LayerPlaneDescriptor
|
||||
public struct LayerPlaneDescriptor
|
||||
{
|
||||
public readonly WORD Size = (WORD)Marshal.SizeOf(typeof(PixelFormatDescriptor));
|
||||
public static readonly WORD Size = (WORD)Marshal.SizeOf(typeof(LayerPlaneDescriptor));
|
||||
public WORD Version;
|
||||
public DWORD Flags;
|
||||
public BYTE PixelType;
|
||||
|
@ -1350,6 +1349,63 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
#endregion
|
||||
|
||||
#region GlyphMetricsFloat
|
||||
|
||||
/// <summary>
|
||||
/// The <b>GlyphMetricsFloat</b> structure contains information about the placement and orientation of a glyph in a
|
||||
/// character cell.
|
||||
/// </summary>
|
||||
/// <remarks>The values of <b>GlyphMetricsFloat</b> are specified as notional units.</remarks>
|
||||
/// <seealso cref="POINTFLOAT" />
|
||||
/// <seealso cref="Wgl.wglUseFontOutlines" />
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GlyphMetricsFloat
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the width of the smallest rectangle (the glyph's black box) that completely encloses the glyph.
|
||||
/// </summary>
|
||||
public float BlackBoxX;
|
||||
/// <summary>
|
||||
/// Specifies the height of the smallest rectangle (the glyph's black box) that completely encloses the glyph.
|
||||
/// </summary>
|
||||
public float BlackBoxY;
|
||||
/// <summary>
|
||||
/// Specifies the x and y coordinates of the upper-left corner of the smallest rectangle that completely encloses the glyph.
|
||||
/// </summary>
|
||||
public PointFloat GlyphOrigin;
|
||||
/// <summary>
|
||||
/// Specifies the horizontal distance from the origin of the current character cell to the origin of the next character cell.
|
||||
/// </summary>
|
||||
public float CellIncX;
|
||||
/// <summary>
|
||||
/// Specifies the vertical distance from the origin of the current character cell to the origin of the next character cell.
|
||||
/// </summary>
|
||||
public float CellIncY;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PointFloat
|
||||
|
||||
/// <summary>
|
||||
/// The <b>POINTFLOAT</b> structure contains the x and y coordinates of a point.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLYPHMETRICSFLOAT" />
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct PointFloat
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the horizontal (x) coordinate of a point.
|
||||
/// </summary>
|
||||
public float X;
|
||||
/// <summary>
|
||||
/// Specifies the vertical (y) coordinate of a point.
|
||||
/// </summary>
|
||||
public float Y;
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region DeviceMode
|
||||
/*
|
||||
typedef struct _devicemode {
|
||||
|
@ -2108,6 +2164,16 @@ namespace OpenTK.Platform.Windows
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region PixelType
|
||||
|
||||
public enum PixelType : byte
|
||||
{
|
||||
RGBA = 0,
|
||||
INDEXED = 1
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region WindowPlacementOptions enum
|
||||
|
||||
public enum WindowPlacementOptions
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,10 +27,10 @@ namespace OpenTK.Platform.Windows
|
|||
internal extern static Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, UInt32 mask);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglChoosePixelFormat", ExactSpelling = true)]
|
||||
internal extern static int ChoosePixelFormat(IntPtr hDc, OpenTK.Platform.Windows.API.PixelFormatDescriptor pPfd);
|
||||
internal extern static unsafe int ChoosePixelFormat(IntPtr hDc, API.PixelFormatDescriptor* pPfd);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglDescribePixelFormat", ExactSpelling = true)]
|
||||
internal extern static int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, OpenTK.Platform.Windows.API.PixelFormatDescriptor ppfd);
|
||||
internal extern static unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, API.PixelFormatDescriptor* ppfd);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetCurrentDC", ExactSpelling = true)]
|
||||
internal extern static IntPtr GetCurrentDC();
|
||||
|
@ -45,7 +45,7 @@ namespace OpenTK.Platform.Windows
|
|||
internal extern static int GetPixelFormat(IntPtr hdc);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSetPixelFormat", ExactSpelling = true)]
|
||||
internal extern static Boolean SetPixelFormat(IntPtr hdc, int ipfd, OpenTK.Platform.Windows.API.PixelFormatDescriptor ppfd);
|
||||
internal extern static unsafe Boolean SetPixelFormat(IntPtr hdc, int ipfd, API.PixelFormatDescriptor* ppfd);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSwapBuffers", ExactSpelling = true)]
|
||||
internal extern static Boolean SwapBuffers(IntPtr hdc);
|
||||
|
@ -57,13 +57,13 @@ namespace OpenTK.Platform.Windows
|
|||
internal extern static IntPtr CreateLayerContext(IntPtr hDc, int level);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglDescribeLayerPlane", ExactSpelling = true)]
|
||||
internal extern static Boolean DescribeLayerPlane(IntPtr hDc, int pixelFormat, int layerPlane, UInt32 nBytes, OpenTK.Platform.Windows.API.LayerPlaneDescriptor plpd);
|
||||
internal extern static unsafe Boolean DescribeLayerPlane(IntPtr hDc, int pixelFormat, int layerPlane, UInt32 nBytes, API.LayerPlaneDescriptor* plpd);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSetLayerPaletteEntries", ExactSpelling = true)]
|
||||
internal extern static int SetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32 pcr);
|
||||
internal extern static unsafe int SetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32* pcr);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglGetLayerPaletteEntries", ExactSpelling = true)]
|
||||
internal extern static int GetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32 pcr);
|
||||
internal extern static unsafe int GetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32* pcr);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglRealizeLayerPalette", ExactSpelling = true)]
|
||||
internal extern static Boolean RealizeLayerPalette(IntPtr hdc, int iLayerPlane, Boolean bRealize);
|
||||
|
@ -71,11 +71,17 @@ namespace OpenTK.Platform.Windows
|
|||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglSwapLayerBuffers", ExactSpelling = true)]
|
||||
internal extern static Boolean SwapLayerBuffers(IntPtr hdc, UInt32 fuFlags);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontBitmapsA", ExactSpelling = true)]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontBitmapsA", CharSet = CharSet.Auto)]
|
||||
internal extern static Boolean UseFontBitmapsA(IntPtr hDC, Int32 first, Int32 count, Int32 listBase);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontBitmapsW", ExactSpelling = true)]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontBitmapsW", CharSet = CharSet.Auto)]
|
||||
internal extern static Boolean UseFontBitmapsW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontOutlinesA", CharSet = CharSet.Auto)]
|
||||
internal extern static unsafe Boolean UseFontOutlinesA(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, API.GlyphMetricsFloat* glyphMetrics);
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
[System.Runtime.InteropServices.DllImport(Wgl.Library, EntryPoint = "wglUseFontOutlinesW", CharSet = CharSet.Auto)]
|
||||
internal extern static unsafe Boolean UseFontOutlinesW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, API.GlyphMetricsFloat* glyphMetrics);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
static Delegates()
|
||||
{
|
||||
Wgl.LoadAll();
|
||||
}
|
||||
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
|
@ -29,11 +28,11 @@ namespace OpenTK.Platform.Windows
|
|||
internal delegate Boolean CopyContext(IntPtr hglrcSrc, IntPtr hglrcDst, UInt32 mask);
|
||||
internal static CopyContext wglCopyContext = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate int ChoosePixelFormat(IntPtr hDc, OpenTK.Platform.Windows.API.PixelFormatDescriptor pPfd);
|
||||
internal static ChoosePixelFormat wglChoosePixelFormat = null;
|
||||
internal unsafe delegate int ChoosePixelFormat(IntPtr hDc, API.PixelFormatDescriptor* pPfd);
|
||||
internal unsafe static ChoosePixelFormat wglChoosePixelFormat = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, OpenTK.Platform.Windows.API.PixelFormatDescriptor ppfd);
|
||||
internal static DescribePixelFormat wglDescribePixelFormat = null;
|
||||
internal unsafe delegate int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, API.PixelFormatDescriptor* ppfd);
|
||||
internal unsafe static DescribePixelFormat wglDescribePixelFormat = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr GetCurrentDC();
|
||||
internal static GetCurrentDC wglGetCurrentDC = null;
|
||||
|
@ -47,8 +46,8 @@ namespace OpenTK.Platform.Windows
|
|||
internal delegate int GetPixelFormat(IntPtr hdc);
|
||||
internal static GetPixelFormat wglGetPixelFormat = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean SetPixelFormat(IntPtr hdc, int ipfd, OpenTK.Platform.Windows.API.PixelFormatDescriptor ppfd);
|
||||
internal static SetPixelFormat wglSetPixelFormat = null;
|
||||
internal unsafe delegate Boolean SetPixelFormat(IntPtr hdc, int ipfd, API.PixelFormatDescriptor* ppfd);
|
||||
internal unsafe static SetPixelFormat wglSetPixelFormat = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean SwapBuffers(IntPtr hdc);
|
||||
internal static SwapBuffers wglSwapBuffers = null;
|
||||
|
@ -59,14 +58,14 @@ namespace OpenTK.Platform.Windows
|
|||
internal delegate IntPtr CreateLayerContext(IntPtr hDc, int level);
|
||||
internal static CreateLayerContext wglCreateLayerContext = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean DescribeLayerPlane(IntPtr hDc, int pixelFormat, int layerPlane, UInt32 nBytes, OpenTK.Platform.Windows.API.LayerPlaneDescriptor plpd);
|
||||
internal static DescribeLayerPlane wglDescribeLayerPlane = null;
|
||||
internal unsafe delegate Boolean DescribeLayerPlane(IntPtr hDc, int pixelFormat, int layerPlane, UInt32 nBytes, API.LayerPlaneDescriptor* plpd);
|
||||
internal unsafe static DescribeLayerPlane wglDescribeLayerPlane = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate int SetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32 pcr);
|
||||
internal static SetLayerPaletteEntries wglSetLayerPaletteEntries = null;
|
||||
internal unsafe delegate int SetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32* pcr);
|
||||
internal unsafe static SetLayerPaletteEntries wglSetLayerPaletteEntries = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate int GetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32 pcr);
|
||||
internal static GetLayerPaletteEntries wglGetLayerPaletteEntries = null;
|
||||
internal unsafe delegate int GetLayerPaletteEntries(IntPtr hdc, int iLayerPlane, int iStart, int cEntries, Int32* pcr);
|
||||
internal unsafe static GetLayerPaletteEntries wglGetLayerPaletteEntries = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean RealizeLayerPalette(IntPtr hdc, int iLayerPlane, Boolean bRealize);
|
||||
internal static RealizeLayerPalette wglRealizeLayerPalette = null;
|
||||
|
@ -80,6 +79,12 @@ namespace OpenTK.Platform.Windows
|
|||
internal delegate Boolean UseFontBitmapsW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase);
|
||||
internal static UseFontBitmapsW wglUseFontBitmapsW = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean UseFontOutlinesA(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, API.GlyphMetricsFloat* glyphMetrics);
|
||||
internal unsafe static UseFontOutlinesA wglUseFontOutlinesA = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean UseFontOutlinesW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, API.GlyphMetricsFloat* glyphMetrics);
|
||||
internal unsafe static UseFontOutlinesW wglUseFontOutlinesW = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr CreateBufferRegionARB(IntPtr hDC, int iLayerPlane, UInt32 uType);
|
||||
internal static CreateBufferRegionARB wglCreateBufferRegionARB = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
|
@ -101,7 +106,7 @@ namespace OpenTK.Platform.Windows
|
|||
internal unsafe delegate Boolean GetPixelFormatAttribfvARB(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, int* piAttributes, [Out] Single* pfValues);
|
||||
internal unsafe static GetPixelFormatAttribfvARB wglGetPixelFormatAttribfvARB = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean ChoosePixelFormatARB(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32 nNumFormats);
|
||||
internal unsafe delegate Boolean ChoosePixelFormatARB(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats);
|
||||
internal unsafe static ChoosePixelFormatARB wglChoosePixelFormatARB = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean MakeContextCurrentARB(IntPtr hDrawDC, IntPtr hReadDC, IntPtr hglrc);
|
||||
|
@ -122,8 +127,8 @@ namespace OpenTK.Platform.Windows
|
|||
internal delegate Boolean DestroyPbufferARB(IntPtr hPbuffer);
|
||||
internal static DestroyPbufferARB wglDestroyPbufferARB = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean QueryPbufferARB(IntPtr hPbuffer, int iAttribute, [Out] int piValue);
|
||||
internal static QueryPbufferARB wglQueryPbufferARB = null;
|
||||
internal unsafe delegate Boolean QueryPbufferARB(IntPtr hPbuffer, int iAttribute, [Out] int* piValue);
|
||||
internal unsafe static QueryPbufferARB wglQueryPbufferARB = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean BindTexImageARB(IntPtr hPbuffer, int iBuffer);
|
||||
internal static BindTexImageARB wglBindTexImageARB = null;
|
||||
|
@ -167,8 +172,8 @@ namespace OpenTK.Platform.Windows
|
|||
internal delegate Boolean DestroyPbufferEXT(IntPtr hPbuffer);
|
||||
internal static DestroyPbufferEXT wglDestroyPbufferEXT = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean QueryPbufferEXT(IntPtr hPbuffer, int iAttribute, [Out] int piValue);
|
||||
internal static QueryPbufferEXT wglQueryPbufferEXT = null;
|
||||
internal unsafe delegate Boolean QueryPbufferEXT(IntPtr hPbuffer, int iAttribute, [Out] int* piValue);
|
||||
internal unsafe static QueryPbufferEXT wglQueryPbufferEXT = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean GetPixelFormatAttribivEXT(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] int* piValues);
|
||||
internal unsafe static GetPixelFormatAttribivEXT wglGetPixelFormatAttribivEXT = null;
|
||||
|
@ -176,7 +181,7 @@ namespace OpenTK.Platform.Windows
|
|||
internal unsafe delegate Boolean GetPixelFormatAttribfvEXT(IntPtr hdc, int iPixelFormat, int iLayerPlane, UInt32 nAttributes, [Out] int* piAttributes, [Out] Single* pfValues);
|
||||
internal unsafe static GetPixelFormatAttribfvEXT wglGetPixelFormatAttribfvEXT = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal unsafe delegate Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32 nNumFormats);
|
||||
internal unsafe delegate Boolean ChoosePixelFormatEXT(IntPtr hdc, int* piAttribIList, Single* pfAttribFList, UInt32 nMaxFormats, [Out] int* piFormats, [Out] UInt32* nNumFormats);
|
||||
internal unsafe static ChoosePixelFormatEXT wglChoosePixelFormatEXT = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean SwapIntervalEXT(int interval);
|
||||
|
@ -233,35 +238,35 @@ namespace OpenTK.Platform.Windows
|
|||
internal delegate Boolean DisableGenlockI3D(IntPtr hDC);
|
||||
internal static DisableGenlockI3D wglDisableGenlockI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean IsEnabledGenlockI3D(IntPtr hDC, [Out] Boolean pFlag);
|
||||
internal static IsEnabledGenlockI3D wglIsEnabledGenlockI3D = null;
|
||||
internal unsafe delegate Boolean IsEnabledGenlockI3D(IntPtr hDC, [Out] Boolean* pFlag);
|
||||
internal unsafe static IsEnabledGenlockI3D wglIsEnabledGenlockI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GenlockSourceI3D(IntPtr hDC, UInt32 uSource);
|
||||
internal static GenlockSourceI3D wglGenlockSourceI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GetGenlockSourceI3D(IntPtr hDC, [Out] UInt32 uSource);
|
||||
internal static GetGenlockSourceI3D wglGetGenlockSourceI3D = null;
|
||||
internal unsafe delegate Boolean GetGenlockSourceI3D(IntPtr hDC, [Out] UInt32* uSource);
|
||||
internal unsafe static GetGenlockSourceI3D wglGetGenlockSourceI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GenlockSourceEdgeI3D(IntPtr hDC, UInt32 uEdge);
|
||||
internal static GenlockSourceEdgeI3D wglGenlockSourceEdgeI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GetGenlockSourceEdgeI3D(IntPtr hDC, [Out] UInt32 uEdge);
|
||||
internal static GetGenlockSourceEdgeI3D wglGetGenlockSourceEdgeI3D = null;
|
||||
internal unsafe delegate Boolean GetGenlockSourceEdgeI3D(IntPtr hDC, [Out] UInt32* uEdge);
|
||||
internal unsafe static GetGenlockSourceEdgeI3D wglGetGenlockSourceEdgeI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GenlockSampleRateI3D(IntPtr hDC, UInt32 uRate);
|
||||
internal static GenlockSampleRateI3D wglGenlockSampleRateI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GetGenlockSampleRateI3D(IntPtr hDC, [Out] UInt32 uRate);
|
||||
internal static GetGenlockSampleRateI3D wglGetGenlockSampleRateI3D = null;
|
||||
internal unsafe delegate Boolean GetGenlockSampleRateI3D(IntPtr hDC, [Out] UInt32* uRate);
|
||||
internal unsafe static GetGenlockSampleRateI3D wglGetGenlockSampleRateI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GenlockSourceDelayI3D(IntPtr hDC, UInt32 uDelay);
|
||||
internal static GenlockSourceDelayI3D wglGenlockSourceDelayI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GetGenlockSourceDelayI3D(IntPtr hDC, [Out] UInt32 uDelay);
|
||||
internal static GetGenlockSourceDelayI3D wglGetGenlockSourceDelayI3D = null;
|
||||
internal unsafe delegate Boolean GetGenlockSourceDelayI3D(IntPtr hDC, [Out] UInt32* uDelay);
|
||||
internal unsafe static GetGenlockSourceDelayI3D wglGetGenlockSourceDelayI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean QueryGenlockMaxSourceDelayI3D(IntPtr hDC, [Out] UInt32 uMaxLineDelay, [Out] UInt32 uMaxPixelDelay);
|
||||
internal static QueryGenlockMaxSourceDelayI3D wglQueryGenlockMaxSourceDelayI3D = null;
|
||||
internal unsafe delegate Boolean QueryGenlockMaxSourceDelayI3D(IntPtr hDC, [Out] UInt32* uMaxLineDelay, [Out] UInt32* uMaxPixelDelay);
|
||||
internal unsafe static QueryGenlockMaxSourceDelayI3D wglQueryGenlockMaxSourceDelayI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate IntPtr CreateImageBufferI3D(IntPtr hDC, Int32 dwSize, UInt32 uFlags);
|
||||
internal static CreateImageBufferI3D wglCreateImageBufferI3D = null;
|
||||
|
@ -281,14 +286,14 @@ namespace OpenTK.Platform.Windows
|
|||
internal delegate Boolean DisableFrameLockI3D();
|
||||
internal static DisableFrameLockI3D wglDisableFrameLockI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean IsEnabledFrameLockI3D([Out] Boolean pFlag);
|
||||
internal static IsEnabledFrameLockI3D wglIsEnabledFrameLockI3D = null;
|
||||
internal unsafe delegate Boolean IsEnabledFrameLockI3D([Out] Boolean* pFlag);
|
||||
internal unsafe static IsEnabledFrameLockI3D wglIsEnabledFrameLockI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean QueryFrameLockMasterI3D([Out] Boolean pFlag);
|
||||
internal static QueryFrameLockMasterI3D wglQueryFrameLockMasterI3D = null;
|
||||
internal unsafe delegate Boolean QueryFrameLockMasterI3D([Out] Boolean* pFlag);
|
||||
internal unsafe static QueryFrameLockMasterI3D wglQueryFrameLockMasterI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean GetFrameUsageI3D([Out] float pUsage);
|
||||
internal static GetFrameUsageI3D wglGetFrameUsageI3D = null;
|
||||
internal unsafe delegate Boolean GetFrameUsageI3D([Out] float* pUsage);
|
||||
internal unsafe static GetFrameUsageI3D wglGetFrameUsageI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean BeginFrameTrackingI3D();
|
||||
internal static BeginFrameTrackingI3D wglBeginFrameTrackingI3D = null;
|
||||
|
@ -296,8 +301,8 @@ namespace OpenTK.Platform.Windows
|
|||
internal delegate Boolean EndFrameTrackingI3D();
|
||||
internal static EndFrameTrackingI3D wglEndFrameTrackingI3D = null;
|
||||
[System.Security.SuppressUnmanagedCodeSecurity()]
|
||||
internal delegate Boolean QueryFrameTrackingI3D([Out] Int32 pFrameCount, [Out] Int32 pMissedFrames, [Out] float pLastMissedUsage);
|
||||
internal static QueryFrameTrackingI3D wglQueryFrameTrackingI3D = null;
|
||||
internal unsafe delegate Boolean QueryFrameTrackingI3D([Out] Int32* pFrameCount, [Out] Int32* pMissedFrames, [Out] float* pLastMissedUsage);
|
||||
internal unsafe static QueryFrameTrackingI3D wglQueryFrameTrackingI3D = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,166 +6,166 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
public enum WGL_ARB_buffer_region
|
||||
{
|
||||
WGL_DEPTH_BUFFER_BIT_ARB = ((int)0x00000004),
|
||||
WGL_BACK_COLOR_BUFFER_BIT_ARB = ((int)0x00000002),
|
||||
WGL_STENCIL_BUFFER_BIT_ARB = ((int)0x00000008),
|
||||
WGL_FRONT_COLOR_BUFFER_BIT_ARB = ((int)0x00000001),
|
||||
STENCIL_BUFFER_BIT_ARB = ((int)0x00000008),
|
||||
DEPTH_BUFFER_BIT_ARB = ((int)0x00000004),
|
||||
BACK_COLOR_BUFFER_BIT_ARB = ((int)0x00000002),
|
||||
FRONT_COLOR_BUFFER_BIT_ARB = ((int)0x00000001),
|
||||
}
|
||||
|
||||
public enum WGL_EXT_pixel_format
|
||||
{
|
||||
WGL_RED_BITS_EXT = ((int)0x2015),
|
||||
WGL_GENERIC_ACCELERATION_EXT = ((int)0x2026),
|
||||
WGL_FULL_ACCELERATION_EXT = ((int)0x2027),
|
||||
WGL_ACCUM_RED_BITS_EXT = ((int)0x201E),
|
||||
WGL_SUPPORT_OPENGL_EXT = ((int)0x2010),
|
||||
WGL_DEPTH_BITS_EXT = ((int)0x2022),
|
||||
WGL_SHARE_STENCIL_EXT = ((int)0x200D),
|
||||
WGL_SWAP_LAYER_BUFFERS_EXT = ((int)0x2006),
|
||||
WGL_GREEN_BITS_EXT = ((int)0x2017),
|
||||
WGL_STENCIL_BITS_EXT = ((int)0x2023),
|
||||
WGL_NEED_PALETTE_EXT = ((int)0x2004),
|
||||
WGL_ACCELERATION_EXT = ((int)0x2003),
|
||||
WGL_TYPE_RGBA_EXT = ((int)0x202B),
|
||||
WGL_TYPE_COLORINDEX_EXT = ((int)0x202C),
|
||||
WGL_NUMBER_PIXEL_FORMATS_EXT = ((int)0x2000),
|
||||
WGL_ACCUM_GREEN_BITS_EXT = ((int)0x201F),
|
||||
WGL_NEED_SYSTEM_PALETTE_EXT = ((int)0x2005),
|
||||
WGL_ACCUM_BITS_EXT = ((int)0x201D),
|
||||
WGL_TRANSPARENT_EXT = ((int)0x200A),
|
||||
WGL_NUMBER_UNDERLAYS_EXT = ((int)0x2009),
|
||||
WGL_RED_SHIFT_EXT = ((int)0x2016),
|
||||
WGL_DRAW_TO_WINDOW_EXT = ((int)0x2001),
|
||||
WGL_BLUE_BITS_EXT = ((int)0x2019),
|
||||
WGL_SWAP_EXCHANGE_EXT = ((int)0x2028),
|
||||
WGL_SHARE_ACCUM_EXT = ((int)0x200E),
|
||||
WGL_DOUBLE_BUFFER_EXT = ((int)0x2011),
|
||||
WGL_BLUE_SHIFT_EXT = ((int)0x201A),
|
||||
WGL_PIXEL_TYPE_EXT = ((int)0x2013),
|
||||
WGL_AUX_BUFFERS_EXT = ((int)0x2024),
|
||||
WGL_DRAW_TO_BITMAP_EXT = ((int)0x2002),
|
||||
WGL_ACCUM_BLUE_BITS_EXT = ((int)0x2020),
|
||||
WGL_STEREO_EXT = ((int)0x2012),
|
||||
WGL_TRANSPARENT_VALUE_EXT = ((int)0x200B),
|
||||
WGL_SWAP_METHOD_EXT = ((int)0x2007),
|
||||
WGL_SWAP_COPY_EXT = ((int)0x2029),
|
||||
WGL_ACCUM_ALPHA_BITS_EXT = ((int)0x2021),
|
||||
WGL_ALPHA_BITS_EXT = ((int)0x201B),
|
||||
WGL_SUPPORT_GDI_EXT = ((int)0x200F),
|
||||
WGL_COLOR_BITS_EXT = ((int)0x2014),
|
||||
WGL_NUMBER_OVERLAYS_EXT = ((int)0x2008),
|
||||
WGL_ALPHA_SHIFT_EXT = ((int)0x201C),
|
||||
WGL_GREEN_SHIFT_EXT = ((int)0x2018),
|
||||
WGL_NO_ACCELERATION_EXT = ((int)0x2025),
|
||||
WGL_SWAP_UNDEFINED_EXT = ((int)0x202A),
|
||||
WGL_SHARE_DEPTH_EXT = ((int)0x200C),
|
||||
SWAP_LAYER_BUFFERS_EXT = ((int)0x2006),
|
||||
NUMBER_UNDERLAYS_EXT = ((int)0x2009),
|
||||
SHARE_STENCIL_EXT = ((int)0x200D),
|
||||
ACCELERATION_EXT = ((int)0x2003),
|
||||
GREEN_SHIFT_EXT = ((int)0x2018),
|
||||
TRANSPARENT_EXT = ((int)0x200A),
|
||||
DRAW_TO_WINDOW_EXT = ((int)0x2001),
|
||||
TYPE_COLORINDEX_EXT = ((int)0x202C),
|
||||
PIXEL_TYPE_EXT = ((int)0x2013),
|
||||
ACCUM_ALPHA_BITS_EXT = ((int)0x2021),
|
||||
STEREO_EXT = ((int)0x2012),
|
||||
BLUE_SHIFT_EXT = ((int)0x201A),
|
||||
GENERIC_ACCELERATION_EXT = ((int)0x2026),
|
||||
ACCUM_RED_BITS_EXT = ((int)0x201E),
|
||||
STENCIL_BITS_EXT = ((int)0x2023),
|
||||
FULL_ACCELERATION_EXT = ((int)0x2027),
|
||||
NO_ACCELERATION_EXT = ((int)0x2025),
|
||||
ALPHA_BITS_EXT = ((int)0x201B),
|
||||
DRAW_TO_BITMAP_EXT = ((int)0x2002),
|
||||
DEPTH_BITS_EXT = ((int)0x2022),
|
||||
SWAP_METHOD_EXT = ((int)0x2007),
|
||||
BLUE_BITS_EXT = ((int)0x2019),
|
||||
SWAP_UNDEFINED_EXT = ((int)0x202A),
|
||||
SUPPORT_OPENGL_EXT = ((int)0x2010),
|
||||
NUMBER_OVERLAYS_EXT = ((int)0x2008),
|
||||
AUX_BUFFERS_EXT = ((int)0x2024),
|
||||
SHARE_DEPTH_EXT = ((int)0x200C),
|
||||
TRANSPARENT_VALUE_EXT = ((int)0x200B),
|
||||
SUPPORT_GDI_EXT = ((int)0x200F),
|
||||
SWAP_COPY_EXT = ((int)0x2029),
|
||||
TYPE_RGBA_EXT = ((int)0x202B),
|
||||
SWAP_EXCHANGE_EXT = ((int)0x2028),
|
||||
NEED_SYSTEM_PALETTE_EXT = ((int)0x2005),
|
||||
DOUBLE_BUFFER_EXT = ((int)0x2011),
|
||||
ACCUM_GREEN_BITS_EXT = ((int)0x201F),
|
||||
RED_SHIFT_EXT = ((int)0x2016),
|
||||
COLOR_BITS_EXT = ((int)0x2014),
|
||||
ALPHA_SHIFT_EXT = ((int)0x201C),
|
||||
SHARE_ACCUM_EXT = ((int)0x200E),
|
||||
NUMBER_PIXEL_FORMATS_EXT = ((int)0x2000),
|
||||
RED_BITS_EXT = ((int)0x2015),
|
||||
GREEN_BITS_EXT = ((int)0x2017),
|
||||
ACCUM_BITS_EXT = ((int)0x201D),
|
||||
ACCUM_BLUE_BITS_EXT = ((int)0x2020),
|
||||
NEED_PALETTE_EXT = ((int)0x2004),
|
||||
}
|
||||
|
||||
public enum WGL_ARB_pixel_format
|
||||
{
|
||||
WGL_RED_BITS_ARB = ((int)0x2015),
|
||||
WGL_NEED_PALETTE_ARB = ((int)0x2004),
|
||||
WGL_ACCUM_ALPHA_BITS_ARB = ((int)0x2021),
|
||||
WGL_ALPHA_BITS_ARB = ((int)0x201B),
|
||||
WGL_DRAW_TO_BITMAP_ARB = ((int)0x2002),
|
||||
WGL_NUMBER_UNDERLAYS_ARB = ((int)0x2009),
|
||||
WGL_GREEN_SHIFT_ARB = ((int)0x2018),
|
||||
WGL_NUMBER_PIXEL_FORMATS_ARB = ((int)0x2000),
|
||||
WGL_GENERIC_ACCELERATION_ARB = ((int)0x2026),
|
||||
WGL_SWAP_UNDEFINED_ARB = ((int)0x202A),
|
||||
WGL_NUMBER_OVERLAYS_ARB = ((int)0x2008),
|
||||
WGL_BLUE_SHIFT_ARB = ((int)0x201A),
|
||||
WGL_ACCUM_BITS_ARB = ((int)0x201D),
|
||||
WGL_SWAP_LAYER_BUFFERS_ARB = ((int)0x2006),
|
||||
WGL_PBUFFER_HEIGHT_ARB = ((int)0x2035),
|
||||
WGL_TRANSPARENT_INDEX_VALUE_ARB = ((int)0x203B),
|
||||
WGL_ALPHA_SHIFT_ARB = ((int)0x201C),
|
||||
WGL_DEPTH_BITS_ARB = ((int)0x2022),
|
||||
WGL_SHARE_DEPTH_ARB = ((int)0x200C),
|
||||
WGL_TYPE_COLORINDEX_ARB = ((int)0x202C),
|
||||
WGL_FULL_ACCELERATION_ARB = ((int)0x2027),
|
||||
WGL_ACCUM_BLUE_BITS_ARB = ((int)0x2020),
|
||||
WGL_SWAP_COPY_ARB = ((int)0x2029),
|
||||
WGL_SHARE_ACCUM_ARB = ((int)0x200E),
|
||||
WGL_SUPPORT_OPENGL_ARB = ((int)0x2010),
|
||||
WGL_DRAW_TO_WINDOW_ARB = ((int)0x2001),
|
||||
WGL_SHARE_STENCIL_ARB = ((int)0x200D),
|
||||
WGL_RED_SHIFT_ARB = ((int)0x2016),
|
||||
WGL_GREEN_BITS_ARB = ((int)0x2017),
|
||||
WGL_SWAP_METHOD_ARB = ((int)0x2007),
|
||||
WGL_PIXEL_TYPE_ARB = ((int)0x2013),
|
||||
WGL_TYPE_RGBA_ARB = ((int)0x202B),
|
||||
WGL_AUX_BUFFERS_ARB = ((int)0x2024),
|
||||
WGL_TRANSPARENT_BLUE_VALUE_ARB = ((int)0x2039),
|
||||
WGL_PBUFFER_WIDTH_ARB = ((int)0x2034),
|
||||
WGL_DRAW_TO_PBUFFER_ARB = ((int)0x202D),
|
||||
WGL_SUPPORT_GDI_ARB = ((int)0x200F),
|
||||
WGL_DOUBLE_BUFFER_ARB = ((int)0x2011),
|
||||
WGL_NEED_SYSTEM_PALETTE_ARB = ((int)0x2005),
|
||||
WGL_TRANSPARENT_GREEN_VALUE_ARB = ((int)0x2038),
|
||||
WGL_STEREO_ARB = ((int)0x2012),
|
||||
WGL_BLUE_BITS_ARB = ((int)0x2019),
|
||||
WGL_ACCUM_GREEN_BITS_ARB = ((int)0x201F),
|
||||
WGL_SWAP_EXCHANGE_ARB = ((int)0x2028),
|
||||
WGL_TRANSPARENT_ARB = ((int)0x200A),
|
||||
WGL_MAX_PBUFFER_HEIGHT_ARB = ((int)0x2030),
|
||||
WGL_ACCUM_RED_BITS_ARB = ((int)0x201E),
|
||||
WGL_TRANSPARENT_RED_VALUE_ARB = ((int)0x2037),
|
||||
WGL_MAX_PBUFFER_PIXELS_ARB = ((int)0x202E),
|
||||
WGL_TRANSPARENT_ALPHA_VALUE_ARB = ((int)0x203A),
|
||||
WGL_PBUFFER_LARGEST_ARB = ((int)0x2033),
|
||||
WGL_COLOR_BITS_ARB = ((int)0x2014),
|
||||
WGL_MAX_PBUFFER_WIDTH_ARB = ((int)0x202F),
|
||||
WGL_ACCELERATION_ARB = ((int)0x2003),
|
||||
WGL_STENCIL_BITS_ARB = ((int)0x2023),
|
||||
WGL_NO_ACCELERATION_ARB = ((int)0x2025),
|
||||
SHARE_DEPTH_ARB = ((int)0x200C),
|
||||
RED_BITS_ARB = ((int)0x2015),
|
||||
BLUE_BITS_ARB = ((int)0x2019),
|
||||
BLUE_SHIFT_ARB = ((int)0x201A),
|
||||
GREEN_BITS_ARB = ((int)0x2017),
|
||||
MAX_PBUFFER_PIXELS_ARB = ((int)0x202E),
|
||||
TYPE_COLORINDEX_ARB = ((int)0x202C),
|
||||
NO_ACCELERATION_ARB = ((int)0x2025),
|
||||
SWAP_COPY_ARB = ((int)0x2029),
|
||||
PBUFFER_LARGEST_ARB = ((int)0x2033),
|
||||
ACCUM_BITS_ARB = ((int)0x201D),
|
||||
ACCUM_GREEN_BITS_ARB = ((int)0x201F),
|
||||
ALPHA_SHIFT_ARB = ((int)0x201C),
|
||||
FULL_ACCELERATION_ARB = ((int)0x2027),
|
||||
SWAP_METHOD_ARB = ((int)0x2007),
|
||||
STENCIL_BITS_ARB = ((int)0x2023),
|
||||
STEREO_ARB = ((int)0x2012),
|
||||
MAX_PBUFFER_WIDTH_ARB = ((int)0x202F),
|
||||
DRAW_TO_PBUFFER_ARB = ((int)0x202D),
|
||||
TYPE_RGBA_ARB = ((int)0x202B),
|
||||
MAX_PBUFFER_HEIGHT_ARB = ((int)0x2030),
|
||||
DRAW_TO_BITMAP_ARB = ((int)0x2002),
|
||||
GREEN_SHIFT_ARB = ((int)0x2018),
|
||||
SUPPORT_GDI_ARB = ((int)0x200F),
|
||||
PBUFFER_WIDTH_ARB = ((int)0x2034),
|
||||
DOUBLE_BUFFER_ARB = ((int)0x2011),
|
||||
TRANSPARENT_ALPHA_VALUE_ARB = ((int)0x203A),
|
||||
ACCUM_ALPHA_BITS_ARB = ((int)0x2021),
|
||||
AUX_BUFFERS_ARB = ((int)0x2024),
|
||||
ALPHA_BITS_ARB = ((int)0x201B),
|
||||
NUMBER_OVERLAYS_ARB = ((int)0x2008),
|
||||
SHARE_ACCUM_ARB = ((int)0x200E),
|
||||
SWAP_EXCHANGE_ARB = ((int)0x2028),
|
||||
ACCELERATION_ARB = ((int)0x2003),
|
||||
TRANSPARENT_GREEN_VALUE_ARB = ((int)0x2038),
|
||||
ACCUM_RED_BITS_ARB = ((int)0x201E),
|
||||
TRANSPARENT_BLUE_VALUE_ARB = ((int)0x2039),
|
||||
TRANSPARENT_INDEX_VALUE_ARB = ((int)0x203B),
|
||||
GENERIC_ACCELERATION_ARB = ((int)0x2026),
|
||||
TRANSPARENT_ARB = ((int)0x200A),
|
||||
NUMBER_UNDERLAYS_ARB = ((int)0x2009),
|
||||
SWAP_UNDEFINED_ARB = ((int)0x202A),
|
||||
DEPTH_BITS_ARB = ((int)0x2022),
|
||||
NUMBER_PIXEL_FORMATS_ARB = ((int)0x2000),
|
||||
TRANSPARENT_RED_VALUE_ARB = ((int)0x2037),
|
||||
SHARE_STENCIL_ARB = ((int)0x200D),
|
||||
DRAW_TO_WINDOW_ARB = ((int)0x2001),
|
||||
PBUFFER_HEIGHT_ARB = ((int)0x2035),
|
||||
PIXEL_TYPE_ARB = ((int)0x2013),
|
||||
COLOR_BITS_ARB = ((int)0x2014),
|
||||
NEED_PALETTE_ARB = ((int)0x2004),
|
||||
NEED_SYSTEM_PALETTE_ARB = ((int)0x2005),
|
||||
SWAP_LAYER_BUFFERS_ARB = ((int)0x2006),
|
||||
RED_SHIFT_ARB = ((int)0x2016),
|
||||
SUPPORT_OPENGL_ARB = ((int)0x2010),
|
||||
ACCUM_BLUE_BITS_ARB = ((int)0x2020),
|
||||
}
|
||||
|
||||
public enum WGL_EXT_pbuffer
|
||||
{
|
||||
WGL_MAX_PBUFFER_HEIGHT_EXT = ((int)0x2030),
|
||||
WGL_PBUFFER_LARGEST_EXT = ((int)0x2033),
|
||||
WGL_PBUFFER_WIDTH_EXT = ((int)0x2034),
|
||||
WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = ((int)0x2032),
|
||||
WGL_DRAW_TO_PBUFFER_EXT = ((int)0x202D),
|
||||
WGL_PBUFFER_HEIGHT_EXT = ((int)0x2035),
|
||||
WGL_MAX_PBUFFER_WIDTH_EXT = ((int)0x202F),
|
||||
WGL_MAX_PBUFFER_PIXELS_EXT = ((int)0x202E),
|
||||
WGL_OPTIMAL_PBUFFER_WIDTH_EXT = ((int)0x2031),
|
||||
DRAW_TO_PBUFFER_EXT = ((int)0x202D),
|
||||
OPTIMAL_PBUFFER_WIDTH_EXT = ((int)0x2031),
|
||||
PBUFFER_LARGEST_EXT = ((int)0x2033),
|
||||
PBUFFER_WIDTH_EXT = ((int)0x2034),
|
||||
OPTIMAL_PBUFFER_HEIGHT_EXT = ((int)0x2032),
|
||||
MAX_PBUFFER_HEIGHT_EXT = ((int)0x2030),
|
||||
PBUFFER_HEIGHT_EXT = ((int)0x2035),
|
||||
MAX_PBUFFER_WIDTH_EXT = ((int)0x202F),
|
||||
MAX_PBUFFER_PIXELS_EXT = ((int)0x202E),
|
||||
}
|
||||
|
||||
public enum WGL_ARB_pbuffer
|
||||
{
|
||||
WGL_PBUFFER_LARGEST_ARB = ((int)0x2033),
|
||||
WGL_PBUFFER_HEIGHT_ARB = ((int)0x2035),
|
||||
WGL_MAX_PBUFFER_WIDTH_ARB = ((int)0x202F),
|
||||
WGL_TRANSPARENT_BLUE_VALUE_ARB = ((int)0x2039),
|
||||
WGL_TRANSPARENT_INDEX_VALUE_ARB = ((int)0x203B),
|
||||
WGL_DRAW_TO_PBUFFER_ARB = ((int)0x202D),
|
||||
WGL_MAX_PBUFFER_PIXELS_ARB = ((int)0x202E),
|
||||
WGL_TRANSPARENT_ALPHA_VALUE_ARB = ((int)0x203A),
|
||||
WGL_PBUFFER_LOST_ARB = ((int)0x2036),
|
||||
WGL_TRANSPARENT_GREEN_VALUE_ARB = ((int)0x2038),
|
||||
WGL_MAX_PBUFFER_HEIGHT_ARB = ((int)0x2030),
|
||||
WGL_PBUFFER_WIDTH_ARB = ((int)0x2034),
|
||||
WGL_TRANSPARENT_RED_VALUE_ARB = ((int)0x2037),
|
||||
MAX_PBUFFER_WIDTH_ARB = ((int)0x202F),
|
||||
DRAW_TO_PBUFFER_ARB = ((int)0x202D),
|
||||
PBUFFER_WIDTH_ARB = ((int)0x2034),
|
||||
MAX_PBUFFER_HEIGHT_ARB = ((int)0x2030),
|
||||
PBUFFER_HEIGHT_ARB = ((int)0x2035),
|
||||
PBUFFER_LOST_ARB = ((int)0x2036),
|
||||
PBUFFER_LARGEST_ARB = ((int)0x2033),
|
||||
TRANSPARENT_BLUE_VALUE_ARB = ((int)0x2039),
|
||||
TRANSPARENT_INDEX_VALUE_ARB = ((int)0x203B),
|
||||
TRANSPARENT_ALPHA_VALUE_ARB = ((int)0x203A),
|
||||
MAX_PBUFFER_PIXELS_ARB = ((int)0x202E),
|
||||
TRANSPARENT_GREEN_VALUE_ARB = ((int)0x2038),
|
||||
TRANSPARENT_RED_VALUE_ARB = ((int)0x2037),
|
||||
}
|
||||
|
||||
public enum WGL_EXT_depth_float
|
||||
{
|
||||
WGL_DEPTH_FLOAT_EXT = ((int)0x2040),
|
||||
DEPTH_FLOAT_EXT = ((int)0x2040),
|
||||
}
|
||||
|
||||
public enum WGL_EXT_multisample
|
||||
{
|
||||
WGL_SAMPLE_BUFFERS_EXT = ((int)0x2041),
|
||||
WGL_SAMPLES_EXT = ((int)0x2042),
|
||||
SAMPLE_BUFFERS_EXT = ((int)0x2041),
|
||||
SAMPLES_EXT = ((int)0x2042),
|
||||
}
|
||||
|
||||
public enum WGL_ARB_multisample
|
||||
{
|
||||
WGL_SAMPLES_ARB = ((int)0x2042),
|
||||
WGL_SAMPLE_BUFFERS_ARB = ((int)0x2041),
|
||||
SAMPLE_BUFFERS_ARB = ((int)0x2041),
|
||||
SAMPLES_ARB = ((int)0x2042),
|
||||
}
|
||||
|
||||
public enum WGL_EXT_make_current_read
|
||||
|
@ -181,309 +181,315 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
public enum WGL_I3D_genlock
|
||||
{
|
||||
WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = ((int)0x2048),
|
||||
WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D = ((int)0x2046),
|
||||
WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = ((int)0x204A),
|
||||
WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D = ((int)0x2047),
|
||||
WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = ((int)0x2049),
|
||||
WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D = ((int)0x2045),
|
||||
WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = ((int)0x204C),
|
||||
WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = ((int)0x2044),
|
||||
WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = ((int)0x204B),
|
||||
GENLOCK_SOURCE_EDGE_BOTH_I3D = ((int)0x204C),
|
||||
GENLOCK_SOURCE_EXTENAL_SYNC_I3D = ((int)0x2045),
|
||||
GENLOCK_SOURCE_DIGITAL_FIELD_I3D = ((int)0x2049),
|
||||
GENLOCK_SOURCE_EDGE_FALLING_I3D = ((int)0x204A),
|
||||
GENLOCK_SOURCE_EDGE_RISING_I3D = ((int)0x204B),
|
||||
GENLOCK_SOURCE_DIGITAL_SYNC_I3D = ((int)0x2048),
|
||||
GENLOCK_SOURCE_EXTENAL_TTL_I3D = ((int)0x2047),
|
||||
GENLOCK_SOURCE_MULTIVIEW_I3D = ((int)0x2044),
|
||||
GENLOCK_SOURCE_EXTENAL_FIELD_I3D = ((int)0x2046),
|
||||
}
|
||||
|
||||
public enum WGL_I3D_gamma
|
||||
{
|
||||
WGL_GAMMA_TABLE_SIZE_I3D = ((int)0x204E),
|
||||
WGL_GAMMA_EXCLUDE_DESKTOP_I3D = ((int)0x204F),
|
||||
GAMMA_TABLE_SIZE_I3D = ((int)0x204E),
|
||||
GAMMA_EXCLUDE_DESKTOP_I3D = ((int)0x204F),
|
||||
}
|
||||
|
||||
public enum WGL_I3D_digital_video_control
|
||||
{
|
||||
WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = ((int)0x2053),
|
||||
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = ((int)0x2051),
|
||||
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = ((int)0x2050),
|
||||
WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = ((int)0x2052),
|
||||
DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = ((int)0x2053),
|
||||
DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = ((int)0x2050),
|
||||
DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = ((int)0x2052),
|
||||
DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = ((int)0x2051),
|
||||
}
|
||||
|
||||
public enum WGL_3DFX_multisample
|
||||
{
|
||||
WGL_SAMPLES_3DFX = ((int)0x2061),
|
||||
WGL_SAMPLE_BUFFERS_3DFX = ((int)0x2060),
|
||||
SAMPLES_3DFX = ((int)0x2061),
|
||||
SAMPLE_BUFFERS_3DFX = ((int)0x2060),
|
||||
}
|
||||
|
||||
public enum WGL_ARB_render_texture
|
||||
{
|
||||
WGL_BACK_LEFT_ARB = ((int)0x2085),
|
||||
WGL_AUX3_ARB = ((int)0x208A),
|
||||
WGL_TEXTURE_RGB_ARB = ((int)0x2075),
|
||||
WGL_TEXTURE_1D_ARB = ((int)0x2079),
|
||||
WGL_BIND_TO_TEXTURE_RGBA_ARB = ((int)0x2071),
|
||||
WGL_AUX5_ARB = ((int)0x208C),
|
||||
WGL_MIPMAP_LEVEL_ARB = ((int)0x207B),
|
||||
WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = ((int)0x207E),
|
||||
WGL_BIND_TO_TEXTURE_RGB_ARB = ((int)0x2070),
|
||||
WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = ((int)0x207F),
|
||||
WGL_CUBE_MAP_FACE_ARB = ((int)0x207C),
|
||||
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = ((int)0x2080),
|
||||
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = ((int)0x2082),
|
||||
WGL_AUX7_ARB = ((int)0x208E),
|
||||
WGL_TEXTURE_RGBA_ARB = ((int)0x2076),
|
||||
WGL_AUX2_ARB = ((int)0x2089),
|
||||
WGL_TEXTURE_2D_ARB = ((int)0x207A),
|
||||
WGL_AUX0_ARB = ((int)0x2087),
|
||||
WGL_AUX9_ARB = ((int)0x2090),
|
||||
WGL_FRONT_LEFT_ARB = ((int)0x2083),
|
||||
WGL_AUX8_ARB = ((int)0x208F),
|
||||
WGL_FRONT_RIGHT_ARB = ((int)0x2084),
|
||||
WGL_AUX6_ARB = ((int)0x208D),
|
||||
WGL_AUX1_ARB = ((int)0x2088),
|
||||
WGL_NO_TEXTURE_ARB = ((int)0x2077),
|
||||
WGL_BACK_RIGHT_ARB = ((int)0x2086),
|
||||
WGL_AUX4_ARB = ((int)0x208B),
|
||||
WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = ((int)0x2081),
|
||||
WGL_TEXTURE_FORMAT_ARB = ((int)0x2072),
|
||||
WGL_TEXTURE_TARGET_ARB = ((int)0x2073),
|
||||
WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = ((int)0x207D),
|
||||
WGL_TEXTURE_CUBE_MAP_ARB = ((int)0x2078),
|
||||
WGL_MIPMAP_TEXTURE_ARB = ((int)0x2074),
|
||||
CUBE_MAP_FACE_ARB = ((int)0x207C),
|
||||
TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = ((int)0x2081),
|
||||
AUX0_ARB = ((int)0x2087),
|
||||
TEXTURE_CUBE_MAP_ARB = ((int)0x2078),
|
||||
TEXTURE_1D_ARB = ((int)0x2079),
|
||||
AUX3_ARB = ((int)0x208A),
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = ((int)0x207E),
|
||||
NO_TEXTURE_ARB = ((int)0x2077),
|
||||
TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = ((int)0x207F),
|
||||
AUX1_ARB = ((int)0x2088),
|
||||
BACK_LEFT_ARB = ((int)0x2085),
|
||||
AUX7_ARB = ((int)0x208E),
|
||||
FRONT_LEFT_ARB = ((int)0x2083),
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = ((int)0x2080),
|
||||
BIND_TO_TEXTURE_RGB_ARB = ((int)0x2070),
|
||||
AUX8_ARB = ((int)0x208F),
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = ((int)0x2082),
|
||||
TEXTURE_CUBE_MAP_POSITIVE_X_ARB = ((int)0x207D),
|
||||
BIND_TO_TEXTURE_RGBA_ARB = ((int)0x2071),
|
||||
AUX6_ARB = ((int)0x208D),
|
||||
TEXTURE_TARGET_ARB = ((int)0x2073),
|
||||
AUX2_ARB = ((int)0x2089),
|
||||
AUX5_ARB = ((int)0x208C),
|
||||
TEXTURE_2D_ARB = ((int)0x207A),
|
||||
AUX4_ARB = ((int)0x208B),
|
||||
FRONT_RIGHT_ARB = ((int)0x2084),
|
||||
TEXTURE_RGB_ARB = ((int)0x2075),
|
||||
MIPMAP_TEXTURE_ARB = ((int)0x2074),
|
||||
MIPMAP_LEVEL_ARB = ((int)0x207B),
|
||||
TEXTURE_RGBA_ARB = ((int)0x2076),
|
||||
AUX9_ARB = ((int)0x2090),
|
||||
BACK_RIGHT_ARB = ((int)0x2086),
|
||||
TEXTURE_FORMAT_ARB = ((int)0x2072),
|
||||
}
|
||||
|
||||
public enum WGL_NV_render_texture_rectangle
|
||||
{
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = ((int)0x20A1),
|
||||
WGL_TEXTURE_RECTANGLE_NV = ((int)0x20A2),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = ((int)0x20A0),
|
||||
BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = ((int)0x20A1),
|
||||
TEXTURE_RECTANGLE_NV = ((int)0x20A2),
|
||||
BIND_TO_TEXTURE_RECTANGLE_RGB_NV = ((int)0x20A0),
|
||||
}
|
||||
|
||||
public enum WGL_NV_render_depth_texture
|
||||
{
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = ((int)0x20A4),
|
||||
WGL_DEPTH_TEXTURE_FORMAT_NV = ((int)0x20A5),
|
||||
WGL_TEXTURE_DEPTH_COMPONENT_NV = ((int)0x20A6),
|
||||
WGL_BIND_TO_TEXTURE_DEPTH_NV = ((int)0x20A3),
|
||||
WGL_DEPTH_COMPONENT_NV = ((int)0x20A7),
|
||||
BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = ((int)0x20A4),
|
||||
TEXTURE_DEPTH_COMPONENT_NV = ((int)0x20A6),
|
||||
DEPTH_COMPONENT_NV = ((int)0x20A7),
|
||||
DEPTH_TEXTURE_FORMAT_NV = ((int)0x20A5),
|
||||
BIND_TO_TEXTURE_DEPTH_NV = ((int)0x20A3),
|
||||
}
|
||||
|
||||
public enum WGL_NV_float_buffer
|
||||
{
|
||||
WGL_TEXTURE_FLOAT_RG_NV = ((int)0x20B6),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = ((int)0x20B2),
|
||||
WGL_TEXTURE_FLOAT_R_NV = ((int)0x20B5),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = ((int)0x20B4),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = ((int)0x20B3),
|
||||
WGL_TEXTURE_FLOAT_RGB_NV = ((int)0x20B7),
|
||||
WGL_FLOAT_COMPONENTS_NV = ((int)0x20B0),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = ((int)0x20B1),
|
||||
WGL_TEXTURE_FLOAT_RGBA_NV = ((int)0x20B8),
|
||||
TEXTURE_FLOAT_RG_NV = ((int)0x20B6),
|
||||
BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = ((int)0x20B4),
|
||||
FLOAT_COMPONENTS_NV = ((int)0x20B0),
|
||||
BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = ((int)0x20B2),
|
||||
TEXTURE_FLOAT_RGB_NV = ((int)0x20B7),
|
||||
BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = ((int)0x20B3),
|
||||
TEXTURE_FLOAT_R_NV = ((int)0x20B5),
|
||||
TEXTURE_FLOAT_RGBA_NV = ((int)0x20B8),
|
||||
BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = ((int)0x20B1),
|
||||
}
|
||||
|
||||
public enum WGL_ARB_pixel_format_float
|
||||
{
|
||||
WGL_TYPE_RGBA_FLOAT_ARB = ((int)0x21A0),
|
||||
TYPE_RGBA_FLOAT_ARB = ((int)0x21A0),
|
||||
}
|
||||
|
||||
public enum WGL_ATI_pixel_format_float
|
||||
{
|
||||
WGL_TYPE_RGBA_FLOAT_ATI = ((int)0x21A0),
|
||||
TYPE_RGBA_FLOAT_ATI = ((int)0x21A0),
|
||||
}
|
||||
|
||||
public enum WGL_font_type
|
||||
{
|
||||
FONT_LINES = ((int)0),
|
||||
}
|
||||
|
||||
public enum All
|
||||
{
|
||||
WGL_SWAP_METHOD_EXT = ((int)0x2007),
|
||||
WGL_MIPMAP_TEXTURE_ARB = ((int)0x2074),
|
||||
WGL_AUX4_ARB = ((int)0x208B),
|
||||
WGL_SAMPLE_BUFFERS_EXT = ((int)0x2041),
|
||||
WGL_BIND_TO_TEXTURE_RGB_ARB = ((int)0x2070),
|
||||
WGL_AUX_BUFFERS_EXT = ((int)0x2024),
|
||||
WGL_AUX0_ARB = ((int)0x2087),
|
||||
WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = ((int)0x204A),
|
||||
WGL_ACCUM_ALPHA_BITS_EXT = ((int)0x2021),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = ((int)0x20B1),
|
||||
WGL_IMAGE_BUFFER_LOCK_I3D = ((int)0x00000002),
|
||||
WGL_BLUE_SHIFT_EXT = ((int)0x201A),
|
||||
WGL_NEED_SYSTEM_PALETTE_EXT = ((int)0x2005),
|
||||
WGL_SHARE_ACCUM_EXT = ((int)0x200E),
|
||||
WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = ((int)0x207E),
|
||||
WGL_DRAW_TO_PBUFFER_ARB = ((int)0x202D),
|
||||
WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = ((int)0x2053),
|
||||
WGL_TEXTURE_CUBE_MAP_ARB = ((int)0x2078),
|
||||
WGL_TYPE_RGBA_FLOAT_ARB = ((int)0x21A0),
|
||||
WGL_FULL_ACCELERATION_EXT = ((int)0x2027),
|
||||
WGL_ACCUM_GREEN_BITS_EXT = ((int)0x201F),
|
||||
WGL_BACK_COLOR_BUFFER_BIT_ARB = ((int)0x00000002),
|
||||
WGL_ACCUM_GREEN_BITS_ARB = ((int)0x201F),
|
||||
WGL_MAX_PBUFFER_WIDTH_EXT = ((int)0x202F),
|
||||
WGL_ACCUM_RED_BITS_EXT = ((int)0x201E),
|
||||
WGL_AUX9_ARB = ((int)0x2090),
|
||||
WGL_TRANSPARENT_EXT = ((int)0x200A),
|
||||
WGL_ACCUM_ALPHA_BITS_ARB = ((int)0x2021),
|
||||
WGL_GENERIC_ACCELERATION_EXT = ((int)0x2026),
|
||||
WGL_AUX2_ARB = ((int)0x2089),
|
||||
WGL_PIXEL_TYPE_EXT = ((int)0x2013),
|
||||
WGL_NUMBER_PIXEL_FORMATS_EXT = ((int)0x2000),
|
||||
WGL_ACCELERATION_ARB = ((int)0x2003),
|
||||
WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = ((int)0x00000001),
|
||||
WGL_DOUBLE_BUFFER_EXT = ((int)0x2011),
|
||||
WGL_NEED_PALETTE_EXT = ((int)0x2004),
|
||||
WGL_TEXTURE_FLOAT_RG_NV = ((int)0x20B6),
|
||||
WGL_DEPTH_FLOAT_EXT = ((int)0x2040),
|
||||
WGL_BLUE_BITS_ARB = ((int)0x2019),
|
||||
WGL_ACCUM_BITS_EXT = ((int)0x201D),
|
||||
WGL_MAX_PBUFFER_WIDTH_ARB = ((int)0x202F),
|
||||
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = ((int)0x2080),
|
||||
WGL_NUMBER_OVERLAYS_ARB = ((int)0x2008),
|
||||
WGL_TEXTURE_RGB_ARB = ((int)0x2075),
|
||||
WGL_SUPPORT_GDI_EXT = ((int)0x200F),
|
||||
WGL_PBUFFER_HEIGHT_EXT = ((int)0x2035),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = ((int)0x20A4),
|
||||
WGL_SAMPLE_BUFFERS_ARB = ((int)0x2041),
|
||||
WGL_TRANSPARENT_ALPHA_VALUE_ARB = ((int)0x203A),
|
||||
WGL_NEED_PALETTE_ARB = ((int)0x2004),
|
||||
WGL_GREEN_SHIFT_ARB = ((int)0x2018),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = ((int)0x20A1),
|
||||
WGL_TYPE_COLORINDEX_EXT = ((int)0x202C),
|
||||
WGL_SHARE_STENCIL_ARB = ((int)0x200D),
|
||||
WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = ((int)0x2048),
|
||||
WGL_SHARE_DEPTH_EXT = ((int)0x200C),
|
||||
WGL_NO_ACCELERATION_EXT = ((int)0x2025),
|
||||
WGL_BLUE_SHIFT_ARB = ((int)0x201A),
|
||||
WGL_SUPPORT_GDI_ARB = ((int)0x200F),
|
||||
WGL_NO_TEXTURE_ARB = ((int)0x2077),
|
||||
WGL_TEXTURE_FLOAT_RGBA_NV = ((int)0x20B8),
|
||||
WGL_DEPTH_TEXTURE_FORMAT_NV = ((int)0x20A5),
|
||||
WGL_TRANSPARENT_BLUE_VALUE_ARB = ((int)0x2039),
|
||||
WGL_DEPTH_BUFFER_BIT_ARB = ((int)0x00000004),
|
||||
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = ((int)0x2082),
|
||||
WGL_SWAP_EXCHANGE_ARB = ((int)0x2028),
|
||||
WGL_TRANSPARENT_RED_VALUE_ARB = ((int)0x2037),
|
||||
WGL_SWAP_COPY_ARB = ((int)0x2029),
|
||||
WGL_GREEN_SHIFT_EXT = ((int)0x2018),
|
||||
WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = ((int)0x2081),
|
||||
WGL_TYPE_RGBA_EXT = ((int)0x202B),
|
||||
WGL_TYPE_RGBA_FLOAT_ATI = ((int)0x21A0),
|
||||
WGL_NUMBER_PIXEL_FORMATS_ARB = ((int)0x2000),
|
||||
WGL_TEXTURE_RGBA_ARB = ((int)0x2076),
|
||||
WGL_SWAP_COPY_EXT = ((int)0x2029),
|
||||
WGL_NEED_SYSTEM_PALETTE_ARB = ((int)0x2005),
|
||||
WGL_TEXTURE_FLOAT_RGB_NV = ((int)0x20B7),
|
||||
WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = ((int)0x2032),
|
||||
WGL_SWAP_UNDEFINED_ARB = ((int)0x202A),
|
||||
WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = ((int)0x2049),
|
||||
WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = ((int)0x204B),
|
||||
WGL_SWAP_LAYER_BUFFERS_EXT = ((int)0x2006),
|
||||
WGL_SWAP_UNDEFINED_EXT = ((int)0x202A),
|
||||
WGL_FULL_ACCELERATION_ARB = ((int)0x2027),
|
||||
WGL_NUMBER_UNDERLAYS_ARB = ((int)0x2009),
|
||||
WGL_BIND_TO_TEXTURE_RGBA_ARB = ((int)0x2071),
|
||||
WGL_TRANSPARENT_GREEN_VALUE_ARB = ((int)0x2038),
|
||||
WGL_PIXEL_TYPE_ARB = ((int)0x2013),
|
||||
WGL_NO_ACCELERATION_ARB = ((int)0x2025),
|
||||
WGL_NUMBER_OVERLAYS_EXT = ((int)0x2008),
|
||||
WGL_DEPTH_BITS_EXT = ((int)0x2022),
|
||||
WGL_AUX3_ARB = ((int)0x208A),
|
||||
WGL_DEPTH_BITS_ARB = ((int)0x2022),
|
||||
WGL_GENERIC_ACCELERATION_ARB = ((int)0x2026),
|
||||
WGL_TYPE_RGBA_ARB = ((int)0x202B),
|
||||
WGL_DRAW_TO_WINDOW_EXT = ((int)0x2001),
|
||||
WGL_TEXTURE_2D_ARB = ((int)0x207A),
|
||||
WGL_STENCIL_BUFFER_BIT_ARB = ((int)0x00000008),
|
||||
WGL_SWAP_EXCHANGE_EXT = ((int)0x2028),
|
||||
WGL_SHARE_STENCIL_EXT = ((int)0x200D),
|
||||
WGL_STEREO_ARB = ((int)0x2012),
|
||||
WGL_SHARE_ACCUM_ARB = ((int)0x200E),
|
||||
WGL_TEXTURE_RECTANGLE_NV = ((int)0x20A2),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = ((int)0x20B3),
|
||||
WGL_STENCIL_BITS_EXT = ((int)0x2023),
|
||||
WGL_MIPMAP_LEVEL_ARB = ((int)0x207B),
|
||||
WGL_DRAW_TO_WINDOW_ARB = ((int)0x2001),
|
||||
WGL_AUX5_ARB = ((int)0x208C),
|
||||
WGL_DEPTH_COMPONENT_NV = ((int)0x20A7),
|
||||
WGL_AUX1_ARB = ((int)0x2088),
|
||||
WGL_TEXTURE_DEPTH_COMPONENT_NV = ((int)0x20A6),
|
||||
WGL_FRONT_LEFT_ARB = ((int)0x2083),
|
||||
WGL_MAX_PBUFFER_HEIGHT_EXT = ((int)0x2030),
|
||||
WGL_RED_BITS_EXT = ((int)0x2015),
|
||||
WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D = ((int)0x2047),
|
||||
WGL_RED_SHIFT_ARB = ((int)0x2016),
|
||||
WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = ((int)0x207F),
|
||||
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = ((int)0x2051),
|
||||
WGL_TRANSPARENT_INDEX_VALUE_ARB = ((int)0x203B),
|
||||
WGL_ALPHA_BITS_EXT = ((int)0x201B),
|
||||
WGL_TRANSPARENT_VALUE_EXT = ((int)0x200B),
|
||||
WGL_BIND_TO_TEXTURE_DEPTH_NV = ((int)0x20A3),
|
||||
WGL_TEXTURE_1D_ARB = ((int)0x2079),
|
||||
WGL_MAX_PBUFFER_PIXELS_ARB = ((int)0x202E),
|
||||
WGL_SUPPORT_OPENGL_ARB = ((int)0x2010),
|
||||
WGL_TEXTURE_TARGET_ARB = ((int)0x2073),
|
||||
WGL_SAMPLE_BUFFERS_3DFX = ((int)0x2060),
|
||||
WGL_TEXTURE_FLOAT_R_NV = ((int)0x20B5),
|
||||
WGL_COLOR_BITS_EXT = ((int)0x2014),
|
||||
WGL_BACK_RIGHT_ARB = ((int)0x2086),
|
||||
WGL_PBUFFER_HEIGHT_ARB = ((int)0x2035),
|
||||
WGL_ACCUM_BLUE_BITS_ARB = ((int)0x2020),
|
||||
WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = ((int)0x207D),
|
||||
WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D = ((int)0x2045),
|
||||
WGL_SWAP_METHOD_ARB = ((int)0x2007),
|
||||
WGL_AUX8_ARB = ((int)0x208F),
|
||||
WGL_TYPE_COLORINDEX_ARB = ((int)0x202C),
|
||||
WGL_DRAW_TO_PBUFFER_EXT = ((int)0x202D),
|
||||
WGL_CUBE_MAP_FACE_ARB = ((int)0x207C),
|
||||
WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = ((int)0x204C),
|
||||
WGL_SAMPLES_3DFX = ((int)0x2061),
|
||||
WGL_MAX_PBUFFER_PIXELS_EXT = ((int)0x202E),
|
||||
WGL_DOUBLE_BUFFER_ARB = ((int)0x2011),
|
||||
WGL_STEREO_EXT = ((int)0x2012),
|
||||
WGL_RED_SHIFT_EXT = ((int)0x2016),
|
||||
WGL_ALPHA_BITS_ARB = ((int)0x201B),
|
||||
WGL_COLOR_BITS_ARB = ((int)0x2014),
|
||||
WGL_GAMMA_TABLE_SIZE_I3D = ((int)0x204E),
|
||||
WGL_AUX_BUFFERS_ARB = ((int)0x2024),
|
||||
GENLOCK_SOURCE_EXTENAL_SYNC_I3D = ((int)0x2045),
|
||||
NUMBER_PIXEL_FORMATS_EXT = ((int)0x2000),
|
||||
SAMPLES_EXT = ((int)0x2042),
|
||||
TYPE_RGBA_FLOAT_ARB = ((int)0x21A0),
|
||||
NEED_SYSTEM_PALETTE_ARB = ((int)0x2005),
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = ((int)0x2082),
|
||||
TEXTURE_1D_ARB = ((int)0x2079),
|
||||
ACCELERATION_ARB = ((int)0x2003),
|
||||
STEREO_ARB = ((int)0x2012),
|
||||
SHARE_ACCUM_ARB = ((int)0x200E),
|
||||
MAX_PBUFFER_PIXELS_ARB = ((int)0x202E),
|
||||
BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = ((int)0x20B3),
|
||||
DEPTH_COMPONENT_NV = ((int)0x20A7),
|
||||
GAMMA_TABLE_SIZE_I3D = ((int)0x204E),
|
||||
GENERIC_ACCELERATION_ARB = ((int)0x2026),
|
||||
NEED_SYSTEM_PALETTE_EXT = ((int)0x2005),
|
||||
MAX_PBUFFER_WIDTH_EXT = ((int)0x202F),
|
||||
TEXTURE_CUBE_MAP_ARB = ((int)0x2078),
|
||||
TEXTURE_2D_ARB = ((int)0x207A),
|
||||
TEXTURE_DEPTH_COMPONENT_NV = ((int)0x20A6),
|
||||
MIPMAP_LEVEL_ARB = ((int)0x207B),
|
||||
ALPHA_BITS_ARB = ((int)0x201B),
|
||||
TEXTURE_FLOAT_R_NV = ((int)0x20B5),
|
||||
PBUFFER_WIDTH_EXT = ((int)0x2034),
|
||||
BACK_LEFT_ARB = ((int)0x2085),
|
||||
MAX_PBUFFER_HEIGHT_EXT = ((int)0x2030),
|
||||
FULL_ACCELERATION_ARB = ((int)0x2027),
|
||||
TYPE_RGBA_FLOAT_ATI = ((int)0x21A0),
|
||||
SHARE_ACCUM_EXT = ((int)0x200E),
|
||||
FRONT_RIGHT_ARB = ((int)0x2084),
|
||||
ACCUM_BLUE_BITS_ARB = ((int)0x2020),
|
||||
BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = ((int)0x20B1),
|
||||
TRANSPARENT_BLUE_VALUE_ARB = ((int)0x2039),
|
||||
SWAP_LAYER_BUFFERS_EXT = ((int)0x2006),
|
||||
AUX8_ARB = ((int)0x208F),
|
||||
RED_BITS_EXT = ((int)0x2015),
|
||||
STENCIL_BITS_ARB = ((int)0x2023),
|
||||
NUMBER_OVERLAYS_ARB = ((int)0x2008),
|
||||
AUX4_ARB = ((int)0x208B),
|
||||
STENCIL_BUFFER_BIT_ARB = ((int)0x00000008),
|
||||
GREEN_BITS_ARB = ((int)0x2017),
|
||||
ACCUM_GREEN_BITS_ARB = ((int)0x201F),
|
||||
FULL_ACCELERATION_EXT = ((int)0x2027),
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = ((int)0x2080),
|
||||
OPTIMAL_PBUFFER_HEIGHT_EXT = ((int)0x2032),
|
||||
AUX_BUFFERS_ARB = ((int)0x2024),
|
||||
DRAW_TO_BITMAP_EXT = ((int)0x2002),
|
||||
AUX7_ARB = ((int)0x208E),
|
||||
SUPPORT_OPENGL_ARB = ((int)0x2010),
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = ((int)0x207E),
|
||||
PBUFFER_LARGEST_EXT = ((int)0x2033),
|
||||
GREEN_SHIFT_EXT = ((int)0x2018),
|
||||
BLUE_BITS_EXT = ((int)0x2019),
|
||||
ACCUM_BITS_ARB = ((int)0x201D),
|
||||
DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = ((int)0x2050),
|
||||
ACCUM_BITS_EXT = ((int)0x201D),
|
||||
SHARE_DEPTH_EXT = ((int)0x200C),
|
||||
STEREO_EXT = ((int)0x2012),
|
||||
GREEN_SHIFT_ARB = ((int)0x2018),
|
||||
SWAP_EXCHANGE_ARB = ((int)0x2028),
|
||||
GENLOCK_SOURCE_EXTENAL_TTL_I3D = ((int)0x2047),
|
||||
SUPPORT_GDI_EXT = ((int)0x200F),
|
||||
PBUFFER_HEIGHT_ARB = ((int)0x2035),
|
||||
TRANSPARENT_GREEN_VALUE_ARB = ((int)0x2038),
|
||||
AUX6_ARB = ((int)0x208D),
|
||||
FRONT_LEFT_ARB = ((int)0x2083),
|
||||
NUMBER_UNDERLAYS_ARB = ((int)0x2009),
|
||||
AUX2_ARB = ((int)0x2089),
|
||||
SAMPLE_BUFFERS_ARB = ((int)0x2041),
|
||||
RED_SHIFT_ARB = ((int)0x2016),
|
||||
MAX_PBUFFER_HEIGHT_ARB = ((int)0x2030),
|
||||
DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = ((int)0x2051),
|
||||
NUMBER_UNDERLAYS_EXT = ((int)0x2009),
|
||||
TRANSPARENT_ALPHA_VALUE_ARB = ((int)0x203A),
|
||||
SAMPLE_BUFFERS_3DFX = ((int)0x2060),
|
||||
IMAGE_BUFFER_LOCK_I3D = ((int)0x00000002),
|
||||
TRANSPARENT_RED_VALUE_ARB = ((int)0x2037),
|
||||
ACCUM_ALPHA_BITS_ARB = ((int)0x2021),
|
||||
SWAP_EXCHANGE_EXT = ((int)0x2028),
|
||||
DEPTH_BUFFER_BIT_ARB = ((int)0x00000004),
|
||||
ALPHA_BITS_EXT = ((int)0x201B),
|
||||
ACCELERATION_EXT = ((int)0x2003),
|
||||
GENLOCK_SOURCE_DIGITAL_SYNC_I3D = ((int)0x2048),
|
||||
DOUBLE_BUFFER_EXT = ((int)0x2011),
|
||||
BIND_TO_TEXTURE_RGBA_ARB = ((int)0x2071),
|
||||
SWAP_COPY_EXT = ((int)0x2029),
|
||||
FRONT_COLOR_BUFFER_BIT_ARB = ((int)0x00000001),
|
||||
BIND_TO_TEXTURE_RECTANGLE_RGB_NV = ((int)0x20A0),
|
||||
TYPE_COLORINDEX_EXT = ((int)0x202C),
|
||||
TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = ((int)0x207F),
|
||||
SAMPLE_BUFFERS_EXT = ((int)0x2041),
|
||||
IMAGE_BUFFER_MIN_ACCESS_I3D = ((int)0x00000001),
|
||||
GENLOCK_SOURCE_EDGE_FALLING_I3D = ((int)0x204A),
|
||||
BIND_TO_TEXTURE_RGB_ARB = ((int)0x2070),
|
||||
DRAW_TO_WINDOW_ARB = ((int)0x2001),
|
||||
AUX5_ARB = ((int)0x208C),
|
||||
DRAW_TO_PBUFFER_EXT = ((int)0x202D),
|
||||
GENLOCK_SOURCE_DIGITAL_FIELD_I3D = ((int)0x2049),
|
||||
DRAW_TO_WINDOW_EXT = ((int)0x2001),
|
||||
DEPTH_BITS_EXT = ((int)0x2022),
|
||||
SHARE_STENCIL_ARB = ((int)0x200D),
|
||||
TYPE_RGBA_EXT = ((int)0x202B),
|
||||
DEPTH_BITS_ARB = ((int)0x2022),
|
||||
TRANSPARENT_EXT = ((int)0x200A),
|
||||
MIPMAP_TEXTURE_ARB = ((int)0x2074),
|
||||
GENLOCK_SOURCE_EXTENAL_FIELD_I3D = ((int)0x2046),
|
||||
SWAP_LAYER_BUFFERS_ARB = ((int)0x2006),
|
||||
TEXTURE_TARGET_ARB = ((int)0x2073),
|
||||
PBUFFER_HEIGHT_EXT = ((int)0x2035),
|
||||
TRANSPARENT_ARB = ((int)0x200A),
|
||||
BIND_TO_TEXTURE_DEPTH_NV = ((int)0x20A3),
|
||||
SWAP_COPY_ARB = ((int)0x2029),
|
||||
NO_ACCELERATION_EXT = ((int)0x2025),
|
||||
TEXTURE_RECTANGLE_NV = ((int)0x20A2),
|
||||
SAMPLES_ARB = ((int)0x2042),
|
||||
BLUE_SHIFT_EXT = ((int)0x201A),
|
||||
BLUE_BITS_ARB = ((int)0x2019),
|
||||
BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = ((int)0x20A1),
|
||||
DRAW_TO_BITMAP_ARB = ((int)0x2002),
|
||||
TEXTURE_CUBE_MAP_POSITIVE_X_ARB = ((int)0x207D),
|
||||
NO_ACCELERATION_ARB = ((int)0x2025),
|
||||
PIXEL_TYPE_ARB = ((int)0x2013),
|
||||
ACCUM_ALPHA_BITS_EXT = ((int)0x2021),
|
||||
NEED_PALETTE_EXT = ((int)0x2004),
|
||||
BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = ((int)0x20A4),
|
||||
BACK_COLOR_BUFFER_BIT_ARB = ((int)0x00000002),
|
||||
DOUBLE_BUFFER_ARB = ((int)0x2011),
|
||||
NEED_PALETTE_ARB = ((int)0x2004),
|
||||
ALPHA_SHIFT_EXT = ((int)0x201C),
|
||||
NO_TEXTURE_ARB = ((int)0x2077),
|
||||
TEXTURE_FLOAT_RG_NV = ((int)0x20B6),
|
||||
SHARE_STENCIL_EXT = ((int)0x200D),
|
||||
TEXTURE_FLOAT_RGBA_NV = ((int)0x20B8),
|
||||
PBUFFER_LARGEST_ARB = ((int)0x2033),
|
||||
DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = ((int)0x2052),
|
||||
TYPE_RGBA_ARB = ((int)0x202B),
|
||||
ACCUM_RED_BITS_ARB = ((int)0x201E),
|
||||
GREEN_BITS_EXT = ((int)0x2017),
|
||||
GENLOCK_SOURCE_MULTIVIEW_I3D = ((int)0x2044),
|
||||
GENERIC_ACCELERATION_EXT = ((int)0x2026),
|
||||
FONT_LINES = ((int)0),
|
||||
ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = ((int)0x2054),
|
||||
WGL_FRONT_COLOR_BUFFER_BIT_ARB = ((int)0x00000001),
|
||||
WGL_SAMPLES_EXT = ((int)0x2042),
|
||||
WGL_ALPHA_SHIFT_EXT = ((int)0x201C),
|
||||
WGL_ACCELERATION_EXT = ((int)0x2003),
|
||||
WGL_AUX6_ARB = ((int)0x208D),
|
||||
WGL_FRONT_RIGHT_ARB = ((int)0x2084),
|
||||
WGL_PBUFFER_WIDTH_ARB = ((int)0x2034),
|
||||
WGL_PBUFFER_LARGEST_ARB = ((int)0x2033),
|
||||
WGL_NUMBER_UNDERLAYS_EXT = ((int)0x2009),
|
||||
WGL_ACCUM_BITS_ARB = ((int)0x201D),
|
||||
WGL_STENCIL_BITS_ARB = ((int)0x2023),
|
||||
WGL_ACCUM_BLUE_BITS_EXT = ((int)0x2020),
|
||||
WGL_MAX_PBUFFER_HEIGHT_ARB = ((int)0x2030),
|
||||
WGL_TEXTURE_FORMAT_ARB = ((int)0x2072),
|
||||
WGL_ACCUM_RED_BITS_ARB = ((int)0x201E),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = ((int)0x20B4),
|
||||
WGL_FLOAT_COMPONENTS_NV = ((int)0x20B0),
|
||||
WGL_TRANSPARENT_ARB = ((int)0x200A),
|
||||
WGL_RED_BITS_ARB = ((int)0x2015),
|
||||
WGL_GREEN_BITS_ARB = ((int)0x2017),
|
||||
WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = ((int)0x2044),
|
||||
WGL_BLUE_BITS_EXT = ((int)0x2019),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = ((int)0x20B2),
|
||||
WGL_GREEN_BITS_EXT = ((int)0x2017),
|
||||
WGL_SHARE_DEPTH_ARB = ((int)0x200C),
|
||||
WGL_ALPHA_SHIFT_ARB = ((int)0x201C),
|
||||
WGL_PBUFFER_WIDTH_EXT = ((int)0x2034),
|
||||
WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = ((int)0x20A0),
|
||||
WGL_SWAP_LAYER_BUFFERS_ARB = ((int)0x2006),
|
||||
SWAP_METHOD_EXT = ((int)0x2007),
|
||||
PIXEL_TYPE_EXT = ((int)0x2013),
|
||||
TEXTURE_FLOAT_RGB_NV = ((int)0x20B7),
|
||||
NUMBER_OVERLAYS_EXT = ((int)0x2008),
|
||||
GAMMA_EXCLUDE_DESKTOP_I3D = ((int)0x204F),
|
||||
COLOR_BITS_EXT = ((int)0x2014),
|
||||
DEPTH_FLOAT_EXT = ((int)0x2040),
|
||||
BACK_RIGHT_ARB = ((int)0x2086),
|
||||
MAX_PBUFFER_WIDTH_ARB = ((int)0x202F),
|
||||
OPTIMAL_PBUFFER_WIDTH_EXT = ((int)0x2031),
|
||||
AUX1_ARB = ((int)0x2088),
|
||||
COLOR_BITS_ARB = ((int)0x2014),
|
||||
ACCUM_BLUE_BITS_EXT = ((int)0x2020),
|
||||
TEXTURE_RGBA_ARB = ((int)0x2076),
|
||||
PBUFFER_LOST_ARB = ((int)0x2036),
|
||||
GENLOCK_SOURCE_EDGE_RISING_I3D = ((int)0x204B),
|
||||
AUX9_ARB = ((int)0x2090),
|
||||
NUMBER_PIXEL_FORMATS_ARB = ((int)0x2000),
|
||||
SWAP_METHOD_ARB = ((int)0x2007),
|
||||
RED_SHIFT_EXT = ((int)0x2016),
|
||||
MAX_PBUFFER_PIXELS_EXT = ((int)0x202E),
|
||||
AUX0_ARB = ((int)0x2087),
|
||||
TRANSPARENT_VALUE_EXT = ((int)0x200B),
|
||||
FLOAT_COMPONENTS_NV = ((int)0x20B0),
|
||||
BLUE_SHIFT_ARB = ((int)0x201A),
|
||||
TEXTURE_RGB_ARB = ((int)0x2075),
|
||||
BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = ((int)0x20B4),
|
||||
ACCUM_GREEN_BITS_EXT = ((int)0x201F),
|
||||
ERROR_INVALID_PIXEL_TYPE_ARB = ((int)0x2043),
|
||||
WGL_AUX7_ARB = ((int)0x208E),
|
||||
WGL_PBUFFER_LOST_ARB = ((int)0x2036),
|
||||
DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = ((int)0x2053),
|
||||
TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = ((int)0x2081),
|
||||
AUX_BUFFERS_EXT = ((int)0x2024),
|
||||
CUBE_MAP_FACE_ARB = ((int)0x207C),
|
||||
TYPE_COLORINDEX_ARB = ((int)0x202C),
|
||||
ERROR_INVALID_PIXEL_TYPE_EXT = ((int)0x2043),
|
||||
WGL_SAMPLES_ARB = ((int)0x2042),
|
||||
WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D = ((int)0x2046),
|
||||
WGL_GAMMA_EXCLUDE_DESKTOP_I3D = ((int)0x204F),
|
||||
WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = ((int)0x2052),
|
||||
WGL_PBUFFER_LARGEST_EXT = ((int)0x2033),
|
||||
WGL_DRAW_TO_BITMAP_EXT = ((int)0x2002),
|
||||
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = ((int)0x2050),
|
||||
WGL_OPTIMAL_PBUFFER_WIDTH_EXT = ((int)0x2031),
|
||||
WGL_DRAW_TO_BITMAP_ARB = ((int)0x2002),
|
||||
WGL_BACK_LEFT_ARB = ((int)0x2085),
|
||||
WGL_SUPPORT_OPENGL_EXT = ((int)0x2010),
|
||||
AUX3_ARB = ((int)0x208A),
|
||||
SHARE_DEPTH_ARB = ((int)0x200C),
|
||||
SAMPLES_3DFX = ((int)0x2061),
|
||||
ALPHA_SHIFT_ARB = ((int)0x201C),
|
||||
GENLOCK_SOURCE_EDGE_BOTH_I3D = ((int)0x204C),
|
||||
SUPPORT_OPENGL_EXT = ((int)0x2010),
|
||||
SWAP_UNDEFINED_ARB = ((int)0x202A),
|
||||
RED_BITS_ARB = ((int)0x2015),
|
||||
STENCIL_BITS_EXT = ((int)0x2023),
|
||||
DEPTH_TEXTURE_FORMAT_NV = ((int)0x20A5),
|
||||
ACCUM_RED_BITS_EXT = ((int)0x201E),
|
||||
PBUFFER_WIDTH_ARB = ((int)0x2034),
|
||||
SWAP_UNDEFINED_EXT = ((int)0x202A),
|
||||
DRAW_TO_PBUFFER_ARB = ((int)0x202D),
|
||||
BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = ((int)0x20B2),
|
||||
TEXTURE_FORMAT_ARB = ((int)0x2072),
|
||||
TRANSPARENT_INDEX_VALUE_ARB = ((int)0x203B),
|
||||
SUPPORT_GDI_ARB = ((int)0x200F),
|
||||
}
|
||||
|
||||
public enum WGL_ARB_extensions_string
|
||||
|
@ -492,8 +498,8 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
public enum WGL_I3D_image_buffer
|
||||
{
|
||||
WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = ((int)0x00000001),
|
||||
WGL_IMAGE_BUFFER_LOCK_I3D = ((int)0x00000002),
|
||||
IMAGE_BUFFER_LOCK_I3D = ((int)0x00000002),
|
||||
IMAGE_BUFFER_MIN_ACCESS_I3D = ((int)0x00000001),
|
||||
}
|
||||
|
||||
public enum WGL_I3D_swap_frame_lock
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#region --- License ---
|
||||
#region --- License ---
|
||||
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||
* See license.txt for license info
|
||||
*
|
||||
* Date: 12/8/2007
|
||||
* Time: 6:43 μμ
|
||||
* Time: 6:43 ìì
|
||||
*/
|
||||
#endregion
|
||||
|
||||
|
@ -102,6 +102,21 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
return f.GetValue(null) != null;
|
||||
}
|
||||
|
||||
/*
|
||||
/// <summary>
|
||||
/// Checks if an extension is supported by the given context.
|
||||
/// </summary>
|
||||
/// <param name="deviceContext">The device context to check.</param>
|
||||
/// <param name="ext">The extension to check.</param>
|
||||
/// <returns>True if the extension is supported by the given context, false otherwise</returns>
|
||||
public static bool SupportsExtensionARB(IntPtr deviceContext, string ext)
|
||||
{
|
||||
string extension_string = Wgl.ARB.GetExtensionsString(deviceContext);
|
||||
string[] extensions = extension_string.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
Array.Sort(extensions);
|
||||
return Array.BinarySearch(extensions, ext) != -1;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,44 +24,32 @@ namespace OpenTK.Platform.Windows
|
|||
static private readonly string opengl32Name = "OPENGL32.DLL";
|
||||
private IntPtr windowHandle;
|
||||
|
||||
private DisplayMode mode;
|
||||
|
||||
private bool disposed;
|
||||
|
||||
#region --- Contructors ---
|
||||
|
||||
public WinGLContext(IntPtr windowHandle)
|
||||
: this(windowHandle, new DisplayMode(640, 480, new ColorDepth(32), 16, 0, 0, 2, false, false, false, 0.0f))
|
||||
public WinGLContext()
|
||||
: this(new DisplayMode(640, 480, new ColorDepth(32), 16, 0, 0, 2, false, false, false, 0.0f))
|
||||
{
|
||||
}
|
||||
|
||||
public WinGLContext(IntPtr windowHandle, DisplayMode mode)
|
||||
public WinGLContext(DisplayMode mode)
|
||||
{
|
||||
Trace.WriteLine(String.Format("Creating opengl context (driver: {0})", this.ToString()));
|
||||
Trace.Indent();
|
||||
|
||||
this.windowHandle = windowHandle;
|
||||
Trace.WriteLine(String.Format("Window handle: {0}", windowHandle));
|
||||
|
||||
PrepareContext(mode);
|
||||
|
||||
Trace.Unindent();
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void CreateContext()
|
||||
{
|
||||
Trace.Write("Creating render context... ");
|
||||
// Do not rely on OpenTK.Platform.Windows.Wgl - the context is not ready yet,
|
||||
// and Wgl extensions will fail to load.
|
||||
//renderContext = Wgl.CreateContext(deviceContext);
|
||||
renderContext = Wgl.Imports.CreateContext(deviceContext);
|
||||
Trace.WriteLine(String.Format("done! (id: {0})", renderContext));
|
||||
Wgl.Imports.MakeCurrent(deviceContext, renderContext);
|
||||
Wgl.LoadAll();
|
||||
}
|
||||
|
||||
public void PrepareContext(DisplayMode mode)
|
||||
#region public void PrepareContext(IntPtr handle)
|
||||
|
||||
public void PrepareContext(IntPtr handle)
|
||||
{
|
||||
this.windowHandle = handle;
|
||||
Debug.WriteLine(String.Format("OpenGL context is bound to handle: {0}", windowHandle));
|
||||
|
||||
// Dynamically load the OpenGL32.dll in order to use the extension loading capabilities of Wgl.
|
||||
if (opengl32Handle == IntPtr.Zero)
|
||||
{
|
||||
|
@ -77,20 +65,33 @@ namespace OpenTK.Platform.Windows
|
|||
)
|
||||
);
|
||||
}
|
||||
Trace.WriteLine(String.Format("Loaded opengl32.dll: {0}", opengl32Handle));
|
||||
Debug.WriteLine(String.Format("Loaded opengl32.dll: {0}", opengl32Handle));
|
||||
}
|
||||
|
||||
deviceContext = API.GetDC(windowHandle);
|
||||
Trace.WriteLine(String.Format("Device context: {0}", deviceContext));
|
||||
Debug.WriteLine(String.Format("Device context: {0}", deviceContext));
|
||||
|
||||
Trace.Write("Setting pixel format... ");
|
||||
Debug.Write("Setting pixel format... ");
|
||||
API.PixelFormatDescriptor pixelFormat = new API.PixelFormatDescriptor();
|
||||
|
||||
pixelFormat.Size = API.PixelFormatDescriptorSize;
|
||||
pixelFormat.Version = API.PixelFormatDescriptorVersion;
|
||||
pixelFormat.Flags =
|
||||
API.PixelFormatDescriptorFlags.SUPPORT_OPENGL |
|
||||
API.PixelFormatDescriptorFlags.DRAW_TO_WINDOW;
|
||||
pixelFormat.ColorBits = (byte)(mode.Color.Red + mode.Color.Green + mode.Color.Blue);
|
||||
pixelFormat.RedBits = (byte)mode.Color.Red;
|
||||
pixelFormat.GreenBits = (byte)mode.Color.Green;
|
||||
pixelFormat.BlueBits = (byte)mode.Color.Blue;
|
||||
pixelFormat.AlphaBits = (byte)mode.Color.Alpha;
|
||||
if (mode.Color.IsIndexed)
|
||||
{
|
||||
pixelFormat.PixelType = API.PixelType.INDEXED;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixelFormat.PixelType = API.PixelType.RGBA;
|
||||
pixelFormat.RedBits = (byte)mode.Color.Red;
|
||||
pixelFormat.GreenBits = (byte)mode.Color.Green;
|
||||
pixelFormat.BlueBits = (byte)mode.Color.Blue;
|
||||
pixelFormat.AlphaBits = (byte)mode.Color.Alpha;
|
||||
}
|
||||
|
||||
/*
|
||||
if (accum != null)
|
||||
{
|
||||
|
@ -120,19 +121,55 @@ namespace OpenTK.Platform.Windows
|
|||
}
|
||||
|
||||
// TODO: More elaborate mode setting, using DescribePixelFormat.
|
||||
/*
|
||||
unsafe
|
||||
{
|
||||
int pixel = Wgl.Imports.ChoosePixelFormat(deviceContext, &pixelFormat);
|
||||
|
||||
int pixel = API.ChoosePixelFormat(deviceContext, pixelFormat);
|
||||
if (pixel == 0)
|
||||
{
|
||||
throw new ApplicationException("The requested pixel format is not supported by the hardware configuration.");
|
||||
}
|
||||
|
||||
Wgl.Imports.SetPixelFormat(deviceContext, pixel, &pixelFormat);
|
||||
|
||||
Debug.WriteLine(String.Format("done! (format: {0})", pixel));
|
||||
}
|
||||
*/
|
||||
int pixel = API.ChoosePixelFormat(deviceContext, ref pixelFormat);
|
||||
if (pixel == 0)
|
||||
{
|
||||
throw new ApplicationException("The requested pixel format is not supported by the hardware configuration.");
|
||||
}
|
||||
API.SetPixelFormat(deviceContext, pixel, ref pixelFormat);
|
||||
|
||||
API.SetPixelFormat(deviceContext, pixel, pixelFormat);
|
||||
|
||||
Trace.WriteLine(String.Format("done! (format: {0})", pixel));
|
||||
Debug.Print("done! (format: {0})", pixel);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public void CreateContext()
|
||||
|
||||
public void CreateContext()
|
||||
{
|
||||
Debug.Write("Creating render context... ");
|
||||
// Do not rely on OpenTK.Platform.Windows.Wgl - the context is not ready yet,
|
||||
// and Wgl extensions will fail to load.
|
||||
renderContext = Wgl.Imports.CreateContext(deviceContext);
|
||||
if (renderContext != IntPtr.Zero)
|
||||
{
|
||||
Debug.WriteLine(String.Format("done! (id: {0})", renderContext));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException("Could not create opengl Rendering Context.");
|
||||
}
|
||||
Wgl.Imports.MakeCurrent(deviceContext, renderContext);
|
||||
Wgl.LoadAll();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IGLContext Members ---
|
||||
|
||||
#region public void SwapBuffers()
|
||||
|
@ -148,7 +185,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
public IntPtr GetAddress(string function_string)
|
||||
{
|
||||
return Wgl.GetProcAddress(function_string);
|
||||
return Wgl.Imports.GetProcAddress(function_string);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -157,7 +194,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
public void MakeCurrent()
|
||||
{
|
||||
Wgl.MakeCurrent(deviceContext, renderContext);
|
||||
Wgl.Imports.MakeCurrent(deviceContext, renderContext);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -219,6 +256,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
Debug.Print("Manually disposing WinGLContext {0}.", this.renderContext);
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
@ -228,10 +266,7 @@ namespace OpenTK.Platform.Windows
|
|||
if (!disposed)
|
||||
{
|
||||
// Clean unmanaged resources here:
|
||||
Wgl.MakeCurrent(deviceContext, renderContext);
|
||||
Wgl.DeleteContext(renderContext);
|
||||
API.ReleaseDC(windowHandle, deviceContext);
|
||||
API.FreeLibrary(opengl32Handle);
|
||||
ReleaseResources();
|
||||
|
||||
if (calledManually)
|
||||
{
|
||||
|
@ -252,7 +287,8 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
if (renderContext != IntPtr.Zero)
|
||||
{
|
||||
if (!Wgl.DeleteContext(renderContext))
|
||||
Wgl.Imports.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
|
||||
if (!Wgl.Imports.DeleteContext(renderContext))
|
||||
{
|
||||
throw new ApplicationException(
|
||||
"Could not destroy the OpenGL render context. Error: " + Marshal.GetLastWin32Error()
|
||||
|
@ -261,6 +297,15 @@ namespace OpenTK.Platform.Windows
|
|||
renderContext = IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (deviceContext != IntPtr.Zero)
|
||||
{
|
||||
if (!API.ReleaseDC(windowHandle, deviceContext))
|
||||
{
|
||||
throw new ApplicationException(
|
||||
"Could not release device context. Error: " + Marshal.GetLastWin32Error());
|
||||
}
|
||||
}
|
||||
|
||||
if (opengl32Handle != IntPtr.Zero)
|
||||
{
|
||||
if (!API.FreeLibrary(opengl32Handle))
|
||||
|
|
|
@ -11,6 +11,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -21,39 +22,52 @@ namespace OpenTK.Platform.Windows
|
|||
private WinGLContext glContext;
|
||||
private bool fullscreen;
|
||||
private ResizeEventArgs resizeEventArgs = new ResizeEventArgs();
|
||||
private DisplayMode mode;
|
||||
|
||||
private bool disposed;
|
||||
private Message msg; // Used only by the IsIdle event.
|
||||
|
||||
#region --- Constructors ---
|
||||
|
||||
public WinGLControl(Control c, DisplayMode mode)
|
||||
public WinGLControl(UserControl c, DisplayMode mode)
|
||||
{
|
||||
glContext = new WinGLContext(c.Handle, mode);
|
||||
this.mode = mode;
|
||||
|
||||
c.HandleCreated += new EventHandler(c_HandleCreated);
|
||||
c.HandleDestroyed += new EventHandler(c_HandleDestroyed);
|
||||
|
||||
glContext.CreateContext();
|
||||
glContext = new WinGLContext(mode);
|
||||
|
||||
// Create the actual context
|
||||
c.Visible = true;
|
||||
//c.CreateControl();
|
||||
glContext.MakeCurrent();
|
||||
}
|
||||
|
||||
[Obsolete("Use WinGLControl(Control c, DisplayMode mode) instead")]
|
||||
public WinGLControl(Control c, int width, int height, bool fullscreen)
|
||||
void c_HandleCreated(object sender, EventArgs e)
|
||||
{
|
||||
glContext = new WinGLContext(
|
||||
c.Handle,
|
||||
new DisplayMode(
|
||||
width, height,
|
||||
new ColorDepth(32),
|
||||
16, 0, 0, 2,
|
||||
fullscreen,
|
||||
false,
|
||||
false,
|
||||
0.0f
|
||||
)
|
||||
);
|
||||
Debug.Print("GLControl handle created, creating WinGLContext.");
|
||||
Debug.Indent();
|
||||
|
||||
glContext.CreateContext();
|
||||
try
|
||||
{
|
||||
glContext.PrepareContext((sender as Control).Handle);
|
||||
glContext.CreateContext();
|
||||
}
|
||||
catch (ApplicationException expt)
|
||||
{
|
||||
Debug.Print(expt.ToString());
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Debug.Unindent();
|
||||
}
|
||||
}
|
||||
|
||||
glContext.MakeCurrent();
|
||||
OpenTK.OpenGL.GL.LoadAll();
|
||||
void c_HandleDestroyed(object sender, EventArgs e)
|
||||
{
|
||||
glContext.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -106,7 +120,6 @@ namespace OpenTK.Platform.Windows
|
|||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
|
||||
}
|
||||
|
||||
private void Dispose(bool calledManually)
|
||||
|
|
|
@ -258,22 +258,17 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
Debug.Print("Window created: {0}", window);
|
||||
|
||||
glContext = new WinGLContext(
|
||||
this.Handle,
|
||||
new DisplayMode(
|
||||
width, height,
|
||||
new ColorDepth(32),
|
||||
16, 0, 0, 2,
|
||||
fullscreen,
|
||||
false,
|
||||
false,
|
||||
0.0f
|
||||
)
|
||||
);
|
||||
|
||||
glContext.CreateContext();
|
||||
|
||||
OpenTK.OpenGL.GL.LoadAll();
|
||||
try
|
||||
{
|
||||
glContext = new WinGLContext(this.mode);
|
||||
glContext.PrepareContext(this.Handle);
|
||||
glContext.CreateContext();
|
||||
}
|
||||
catch (ApplicationException expt)
|
||||
{
|
||||
Debug.Print("Could not create opengl context, error: {0}", expt.ToString());
|
||||
throw;
|
||||
}
|
||||
|
||||
if (this.Create != null)
|
||||
{
|
||||
|
|
|
@ -144,21 +144,12 @@ namespace OpenTK.Platform.X11
|
|||
);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "XPeekEvent")]
|
||||
extern internal static void PeekEvent(
|
||||
Display display,
|
||||
[In, Out]XEvent event_return
|
||||
);
|
||||
extern internal static void PeekEvent(Display display, [In, Out]XEvent event_return);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "XSendEvent")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
extern internal static bool SendEvent(
|
||||
Display display,
|
||||
Window window,
|
||||
bool propagate,
|
||||
[MarshalAs(UnmanagedType.SysInt)]
|
||||
EventMask event_mask,
|
||||
ref XEvent event_send
|
||||
);
|
||||
extern internal static bool SendEvent(Display display, Window window, bool propagate,
|
||||
[MarshalAs(UnmanagedType.SysInt)]EventMask event_mask, ref XEvent event_send);
|
||||
|
||||
/// <summary>
|
||||
/// The XSelectInput() function requests that the X server report the events associated
|
||||
|
@ -197,8 +188,12 @@ namespace OpenTK.Platform.X11
|
|||
internal static extern bool CheckIfEvent(Display display, ref XEvent event_return,
|
||||
/*[MarshalAs(UnmanagedType.FunctionPtr)] */ CheckEventPredicate predicate, /*XPointer*/ IntPtr arg);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
[DllImport(_dll_name, EntryPoint = "XIfEvent")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal static extern bool IfEvent(Display display, ref XEvent event_return,
|
||||
/*[MarshalAs(UnmanagedType.FunctionPtr)] */ CheckEventPredicate predicate, /*XPointer*/ IntPtr arg);
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
internal delegate bool CheckEventPredicate(Display display, ref XEvent @event, IntPtr arg);
|
||||
|
||||
[DllImport(_dll_name, EntryPoint = "XCheckMaskEvent")]
|
||||
|
@ -551,8 +546,8 @@ XF86VidModeGetGammaRampSize(
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
// return base.ToString();
|
||||
return String.Format("id ({0}), screen ({1}), depth ({2}), class ({3})",
|
||||
// return base.ToString();
|
||||
return String.Format("id ({0}), screen ({1}), depth ({2}), class ({3})",
|
||||
visualid, screen, depth, @class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1654,4 +1654,4 @@ namespace OpenTK.Platform.X11
|
|||
UnregisterAccelerator = 13,
|
||||
ActivateAccelerator = 14
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,7 @@ namespace OpenTK.Platform.X11
|
|||
/// </summary>
|
||||
public sealed class X11GLContext : OpenTK.Platform.IGLContext
|
||||
{
|
||||
private IntPtr x11context;
|
||||
|
||||
private IntPtr context;
|
||||
private DisplayMode mode;// = new DisplayMode();
|
||||
internal WindowInfo windowInfo;
|
||||
|
||||
|
@ -37,25 +36,132 @@ namespace OpenTK.Platform.X11
|
|||
#region --- Public Constructor ---
|
||||
|
||||
internal X11GLContext()
|
||||
: this(new DisplayMode())
|
||||
{
|
||||
this.windowInfo = new WindowInfo();
|
||||
this.mode = new DisplayMode();
|
||||
}
|
||||
|
||||
internal X11GLContext(WindowInfo window, DisplayMode mode)
|
||||
internal X11GLContext(DisplayMode mode)
|
||||
{
|
||||
this.windowInfo = new WindowInfo(window);
|
||||
this.windowInfo = new WindowInfo();
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region internal DisplayMode Mode
|
||||
|
||||
internal DisplayMode Mode
|
||||
{
|
||||
get { return mode; }
|
||||
set
|
||||
{
|
||||
if (context == IntPtr.Zero)
|
||||
{
|
||||
mode = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Print("Cannot change DisplayMode of an existing context.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region internal void PrepareContext(X11.WindowInfo info)
|
||||
|
||||
internal void PrepareContext(X11.WindowInfo info)
|
||||
{
|
||||
this.windowInfo = new WindowInfo(info);
|
||||
|
||||
Debug.Print("Preparing visual for DisplayMode: {0}", mode.ToString());
|
||||
|
||||
/*
|
||||
int[] attrib =
|
||||
{
|
||||
(int)Glx.Enums.GLXAttribute.RGBA,
|
||||
(int)Glx.Enums.GLXAttribute.RED_SIZE, 1,
|
||||
(int)Glx.Enums.GLXAttribute.GREEN_SIZE, 1,
|
||||
(int)Glx.Enums.GLXAttribute.BLUE_SIZE, 1,
|
||||
(int)Glx.Enums.GLXAttribute.DEPTH_SIZE, 1,
|
||||
(int)Glx.Enums.GLXAttribute.DOUBLEBUFFER,
|
||||
0
|
||||
};
|
||||
visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, attrib);
|
||||
*/
|
||||
|
||||
List<int> visualAttributes = new List<int>();
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Red);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.GREEN_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Green);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.BLUE_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Blue);
|
||||
//visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE);
|
||||
//visualAttributes.Add((int)mode.Color.Alpha);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
|
||||
visualAttributes.Add((int)mode.DepthBits);
|
||||
visualAttributes.Add((int)1);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
||||
visualAttributes.Add((int)0);
|
||||
|
||||
//try
|
||||
//{
|
||||
visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, visualAttributes.ToArray());
|
||||
if (visual == IntPtr.Zero)
|
||||
{
|
||||
throw new ApplicationException(String.Format("Requested DisplayMode not available ({0}).", mode.ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
windowInfo.VisualInfo = (VisualInfo)Marshal.PtrToStructure(visual, typeof(VisualInfo));
|
||||
Debug.Print("Prepared visual: {0}", windowInfo.VisualInfo.ToString());
|
||||
}
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// Debug.Print(e.ToString());
|
||||
// throw;
|
||||
//}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region internal void CreateContext(X11GLContext shareContext, bool direct)
|
||||
|
||||
internal void CreateContext(X11GLContext shareContext, bool direct)
|
||||
{
|
||||
Debug.WriteLine("Creating opengl context.");
|
||||
Debug.Indent();
|
||||
|
||||
IntPtr shareHandle = shareContext != null ? shareContext.windowInfo.Handle : IntPtr.Zero;
|
||||
Debug.WriteLine(shareHandle == IntPtr.Zero ? "Context is not shared." :
|
||||
String.Format("Context is shared with context: {0}", shareHandle));
|
||||
|
||||
Debug.WriteLine(direct ? "Context is direct." : "Context is indirect.");
|
||||
|
||||
context = Glx.CreateContext(windowInfo.Display, visual, shareHandle, direct);
|
||||
if (context != IntPtr.Zero)
|
||||
{
|
||||
Debug.WriteLine(String.Format("New opengl context created. (id: {0})", context));
|
||||
Debug.Unindent();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException("Glx.CreateContext call failed (returned 0).");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IGLContext Members ---
|
||||
|
||||
#region public void SwapBuffers()
|
||||
|
||||
public void SwapBuffers()
|
||||
{
|
||||
Debug.Print("Swapping buffers");
|
||||
Glx.SwapBuffers(windowInfo.Display, windowInfo.Handle);
|
||||
}
|
||||
|
||||
|
@ -63,29 +169,27 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#region public void MakeCurrent()
|
||||
|
||||
bool result;
|
||||
public void MakeCurrent()
|
||||
{
|
||||
Debug.Write(
|
||||
String.Format(
|
||||
"Making context {0} current on thread {1} (Display: {2}, Screen: {3}, Window: {4})... ",
|
||||
x11context,
|
||||
System.Threading.Thread.CurrentThread.ManagedThreadId,
|
||||
windowInfo.Display,
|
||||
windowInfo.Screen,
|
||||
windowInfo.Handle
|
||||
)
|
||||
);
|
||||
bool result = Glx.MakeCurrent(windowInfo.Display, windowInfo.Handle, x11context);
|
||||
Debug.Write(String.Format("Making context {0} current on thread {1} (Display: {2}, Screen: {3}, Window: {4})... ",
|
||||
context, System.Threading.Thread.CurrentThread.ManagedThreadId, windowInfo.Display, windowInfo.Screen, windowInfo.Handle));
|
||||
|
||||
if (!result)
|
||||
if (windowInfo.Display != IntPtr.Zero && windowInfo.Handle != IntPtr.Zero && context != IntPtr.Zero)
|
||||
{
|
||||
Debug.WriteLine("failed...");
|
||||
// probably need to recreate context here.
|
||||
//throw new Exception(String.Format("Failed to make context {0} current.", x11context));
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine("done!");
|
||||
result = Glx.MakeCurrent(windowInfo.Display, windowInfo.Handle, context);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
Debug.WriteLine("failed.");
|
||||
// probably need to recreate context here.
|
||||
//throw new ApplicationException(String.Format("Failed to make context {0} current on thread {1}.",
|
||||
// context, System.Threading.Thread.CurrentThread.ManagedThreadId));
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.WriteLine("done!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +229,8 @@ namespace OpenTK.Platform.X11
|
|||
if (!disposed)
|
||||
{
|
||||
// Clean unmanaged resources:
|
||||
Glx.DestroyContext(windowInfo.Display, x11context);
|
||||
Glx.MakeCurrent(windowInfo.Display, IntPtr.Zero, IntPtr.Zero);
|
||||
Glx.DestroyContext(windowInfo.Display, context);
|
||||
API.Free(visual);
|
||||
|
||||
if (manuallyCalled)
|
||||
|
@ -142,101 +247,5 @@ namespace OpenTK.Platform.X11
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public void CreateContext(X11GLContext shareContext, bool direct)
|
||||
|
||||
public void CreateContext(X11GLContext shareContext, bool direct)
|
||||
{
|
||||
Debug.WriteLine("Creating opengl context.");
|
||||
Debug.Indent();
|
||||
|
||||
IntPtr shareHandle = shareContext != null ? shareContext.windowInfo.Handle : IntPtr.Zero;
|
||||
Debug.WriteLine(
|
||||
shareHandle == IntPtr.Zero ?
|
||||
"Context is not shared." :
|
||||
String.Format("Context is shared with context: {0}", shareHandle)
|
||||
);
|
||||
Debug.WriteLine(
|
||||
direct ?
|
||||
"Context is direct." :
|
||||
"Context is indirect."
|
||||
);
|
||||
x11context = Glx.CreateContext(
|
||||
windowInfo.Display,
|
||||
visual,
|
||||
shareHandle,
|
||||
direct
|
||||
);
|
||||
if (x11context != IntPtr.Zero)
|
||||
{
|
||||
Debug.WriteLine(String.Format("New opengl context created. (id: {0})", x11context));
|
||||
Debug.Unindent();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException("Could not create opengl context.");
|
||||
}
|
||||
|
||||
this.MakeCurrent();
|
||||
OpenTK.OpenGL.GL.LoadAll();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public void CreateVisual()
|
||||
|
||||
internal VisualInfo CreateVisual()
|
||||
{
|
||||
Debug.WriteLine("Creating visual.");
|
||||
Debug.Indent();
|
||||
|
||||
Debug.Print("Requesting DisplayMode: {0}. ", mode.ToString());
|
||||
|
||||
List<int> visualAttributes = new List<int>();
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RGBA);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.RED_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Red);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.GREEN_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Green);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.BLUE_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Blue);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE);
|
||||
visualAttributes.Add((int)mode.Color.Alpha);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE);
|
||||
visualAttributes.Add((int)mode.DepthBits);
|
||||
visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER);
|
||||
visualAttributes.Add((int)0);
|
||||
|
||||
visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, visualAttributes.ToArray());
|
||||
if (visual == IntPtr.Zero)
|
||||
{
|
||||
throw new ApplicationException("Requested mode not available (Glx.ChooseVisual returned 0).");
|
||||
}
|
||||
windowInfo.VisualInfo = (VisualInfo)Marshal.PtrToStructure(visual, typeof(VisualInfo));
|
||||
Debug.Print("Got visual: {0}", windowInfo.VisualInfo.ToString());
|
||||
|
||||
Debug.Unindent();
|
||||
|
||||
return windowInfo.VisualInfo;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[Obsolete]
|
||||
internal IntPtr XVisual
|
||||
{
|
||||
get { return this.visual; }
|
||||
}
|
||||
|
||||
internal VisualInfo XVisualInfo
|
||||
{
|
||||
get { return windowInfo.VisualInfo; }
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
internal IntPtr Handle
|
||||
{
|
||||
get { return this.x11context; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace OpenTK.Platform.X11
|
|||
sealed class X11GLControl : IGLControl
|
||||
{
|
||||
WindowInfo info = new WindowInfo();
|
||||
DisplayMode mode;
|
||||
private Type xplatui;
|
||||
X11GLContext glContext;
|
||||
|
||||
|
@ -24,25 +25,25 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#region --- Contructors ---
|
||||
|
||||
[Obsolete("Use X11GLControl(UserControl c, DisplayMode mode) instead.")]
|
||||
public X11GLControl(UserControl c, int width, int height, bool fullscreen)
|
||||
: this(c, new DisplayMode(width, height, new ColorDepth(32), 16,
|
||||
0, 0, 2, false, false, false, 0.0f)) { }
|
||||
|
||||
public X11GLControl(UserControl c, DisplayMode mode)
|
||||
{
|
||||
Debug.WriteLine("Creating opengl control (X11GLControl driver)");
|
||||
Debug.Indent();
|
||||
|
||||
|
||||
if (c == null/* || c.TopLevelControl == null*/)
|
||||
{
|
||||
throw new ArgumentException("UserControl c may not be null.");
|
||||
}
|
||||
|
||||
//c.ParentChanged += new EventHandler(c_ParentChanged);
|
||||
this.mode = mode;//new DisplayMode(mode);
|
||||
glContext = new X11GLContext(mode);
|
||||
|
||||
info.Handle = c.Handle;
|
||||
Debug.Print("Binding to control: {0}", String.IsNullOrEmpty(c.Name) ? c.Text : c.Name);
|
||||
c.HandleCreated += new EventHandler(c_HandleCreated);
|
||||
c.HandleDestroyed += new EventHandler(c_HandleDestroyed);
|
||||
//c.ParentChanged += new EventHandler(c_ParentChanged);
|
||||
//c.Load += new EventHandler(c_Load);
|
||||
//Debug.Print("GLControl events hooked to X11GLControl.");
|
||||
|
||||
xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
|
||||
Debug.Write("System.Windows.Forms.XplatUIX11: ");
|
||||
|
@ -50,73 +51,151 @@ namespace OpenTK.Platform.X11
|
|||
if (xplatui != null)
|
||||
{
|
||||
info.Display = (IntPtr)xplatui.GetField("DisplayHandle",
|
||||
System.Reflection.BindingFlags.Static |
|
||||
System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||
|
||||
info.RootWindow = (IntPtr)xplatui.GetField("RootWindow",
|
||||
System.Reflection.BindingFlags.Static |
|
||||
System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||
|
||||
info.Screen = (int)xplatui.GetField("ScreenNo",
|
||||
System.Reflection.BindingFlags.Static |
|
||||
System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||
|
||||
Debug.Print(
|
||||
"Screen: {0}, Display: {1}, Root Window: {2}, Handle: {3}",
|
||||
info.Screen, info.Display, info.RootWindow, info.Handle);
|
||||
|
||||
glContext = new X11GLContext(info, mode);
|
||||
Debug.Print("Display: {0}, Screen: {1}, Root Window: {2}, GLControl: {3}",
|
||||
info.Display, info.Screen, info.RootWindow, info.Handle);
|
||||
|
||||
info.VisualInfo = glContext.CreateVisual();
|
||||
glContext.PrepareContext(info);
|
||||
info.VisualInfo = glContext.windowInfo.VisualInfo;
|
||||
xplatui.GetField("CustomVisual", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)
|
||||
.SetValue(null, info.VisualInfo.visual);
|
||||
|
||||
xplatui.GetField(
|
||||
"CustomVisual",
|
||||
System.Reflection.BindingFlags.Static |
|
||||
System.Reflection.BindingFlags.NonPublic).SetValue(
|
||||
null,
|
||||
//glContext.XVisual
|
||||
info.VisualInfo.visual
|
||||
);
|
||||
xplatui.GetField("CustomColormap", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)
|
||||
.SetValue(null, API.CreateColormap(info.Display, info.RootWindow, info.VisualInfo.visual, 0));
|
||||
|
||||
xplatui.GetField(
|
||||
"CustomColormap",
|
||||
System.Reflection.BindingFlags.Static |
|
||||
System.Reflection.BindingFlags.NonPublic).SetValue(
|
||||
null,
|
||||
API.CreateColormap(info.Display, info.RootWindow, info.VisualInfo.visual, 0/*AllocNone*/)
|
||||
//glContext.colormap
|
||||
);
|
||||
|
||||
glContext.CreateContext(null, true);
|
||||
this.c_ParentChanged(c, EventArgs.Empty);
|
||||
c.Visible = true;
|
||||
glContext.windowInfo.Handle = info.Handle = c.Handle;
|
||||
}
|
||||
|
||||
//Debug.Print("Parent: {0}", c.ParentForm.Handle);
|
||||
//API.MapRaised(info.Display, info.Handle);
|
||||
//API.MapRaised(info.Display, c.ParentForm.Handle);
|
||||
|
||||
//OpenTK.OpenGL.GL.Imports.Flush();
|
||||
|
||||
/*
|
||||
// Wait until the GLControl is mapped.
|
||||
XEvent ev = new XEvent();
|
||||
API.IfEvent(info.Display, ref ev,
|
||||
delegate(IntPtr display, ref XEvent @event, IntPtr arg)
|
||||
{
|
||||
Debug.Print("Checking event: {0}", @event.type);
|
||||
if (@event.type == XEventName.MapNotify)
|
||||
{
|
||||
Debug.Print("Map event for window: {0}", @event.MapEvent.window);
|
||||
}
|
||||
return (@event.type == XEventName.MapNotify) && (@event.MapEvent.window == arg);
|
||||
},
|
||||
info.Handle);
|
||||
*/
|
||||
//glContext.MakeCurrent();
|
||||
//OpenTK.OpenGL.GL.LoadAll();
|
||||
}
|
||||
|
||||
void c_HandleCreated(object sender, EventArgs e)
|
||||
{
|
||||
UserControl c = (sender as UserControl);
|
||||
Debug.Print("GLControl handle created, creating X11GLContext.");
|
||||
Debug.Indent();
|
||||
glContext.windowInfo.Handle = info.Handle = (sender as UserControl).Handle;
|
||||
|
||||
try
|
||||
{
|
||||
glContext.CreateContext(null, true);
|
||||
}
|
||||
catch (ApplicationException expt)
|
||||
{
|
||||
Debug.Print(expt.ToString());
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Debug.Unindent();
|
||||
/*
|
||||
Debug.WriteLine(String.Format("Mapping control {0} to parent {1}", c.Handle, c.Handle));
|
||||
API.MapRaised(info.Display, c.Handle);
|
||||
|
||||
Context.MakeCurrent();
|
||||
OpenTK.OpenGL.GL.LoadAll();
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void c_HandleDestroyed(object sender, EventArgs e)
|
||||
{
|
||||
Debug.Print("X11GLControl handle destroyed, disposing X11GLContext.");
|
||||
glContext.Dispose();
|
||||
}
|
||||
|
||||
void c_ParentChanged(object sender, EventArgs e)
|
||||
{
|
||||
UserControl c = sender as UserControl;
|
||||
Debug.WriteLine(
|
||||
String.Format(
|
||||
"TopLevel control is {0}",
|
||||
c.TopLevelControl != null ? c.TopLevelControl.ToString() : "not available"
|
||||
)
|
||||
);
|
||||
Debug.Print("Mapping X11GLControl.");
|
||||
Debug.Indent();
|
||||
|
||||
Control c = sender as Control;
|
||||
Debug.Print("TopLevel control is {0}",
|
||||
c.TopLevelControl != null ? c.TopLevelControl.ToString() : "not available");
|
||||
|
||||
if (c.TopLevelControl == null)
|
||||
{
|
||||
info.TopLevelWindow = c.Handle;
|
||||
throw new Exception("GLControl does not have a parent.");
|
||||
throw new ApplicationException("Problem: GLControl does not have a parent, aborting.");
|
||||
}
|
||||
else
|
||||
{
|
||||
info.TopLevelWindow = c.TopLevelControl.Handle;
|
||||
}
|
||||
|
||||
Debug.WriteLine(String.Format("Mapping window to top level: {0}", info.TopLevelWindow));
|
||||
API.MapRaised(info.Display, info.TopLevelWindow);
|
||||
Debug.WriteLine(String.Format("Mapping GLControl {0} to window {1}", info.Handle, info.TopLevelWindow));
|
||||
//API.MapRaised(info.Display, info.TopLevelWindow);
|
||||
/*
|
||||
// Wait until the GLControl is mapped.
|
||||
XEvent ev = new XEvent();
|
||||
API.IfEvent(info.Display, ref ev,
|
||||
delegate(IntPtr display, ref XEvent @event, IntPtr arg)
|
||||
{
|
||||
//Debug.Print("Checking event: {0}", @event.type);
|
||||
return (@event.type == XEventName.MapNotify) && (@event.MapEvent.window == arg);
|
||||
},
|
||||
info.Handle);
|
||||
|
||||
glContext.MakeCurrent();
|
||||
OpenTK.OpenGL.GL.LoadAll();*/
|
||||
Debug.Unindent();
|
||||
}
|
||||
|
||||
void c_Load(object sender, EventArgs e)
|
||||
{
|
||||
Debug.Print("GLControl loaded, will now try to make context current and load all GL functions.");
|
||||
Context.MakeCurrent();
|
||||
OpenTK.OpenGL.GL.LoadAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds a colormap suitable for use with the GLControl.
|
||||
/// </summary>
|
||||
/// <returns>A pointer to the colormap</returns>
|
||||
/// <remarks>
|
||||
/// If the visual of the GLControl matches the default visual, the function returns
|
||||
/// the default colormap (i.e. the colormap of the root window). Otherwise, it creates
|
||||
/// a new, private colormap.
|
||||
/// </remarks>
|
||||
private IntPtr FindColormap()
|
||||
{
|
||||
if (info.VisualInfo.visual == Functions.XDefaultVisual(info.Display, info.Screen))
|
||||
{
|
||||
return Functions.XDefaultColormap(info.Display, info.Screen);
|
||||
}
|
||||
|
||||
return API.CreateColormap(info.Display, info.RootWindow, glContext.windowInfo.VisualInfo.visual, 0/*AllocNone*/);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IGLControl Members ---
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace OpenTK.Platform.X11
|
|||
public X11GLNative()
|
||||
{
|
||||
Debug.Print("Native window driver: {0}", this.ToString());
|
||||
window = new WindowInfo();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -225,7 +226,7 @@ namespace OpenTK.Platform.X11
|
|||
}
|
||||
else
|
||||
{
|
||||
Debug.Print("Creating native window with mode: {0}", mode.ToString());
|
||||
Debug.Print("Creating GameWindow with mode: {0}", mode.ToString());
|
||||
Debug.Indent();
|
||||
|
||||
window.Display = API.OpenDisplay(null); // null == default display
|
||||
|
@ -243,11 +244,12 @@ namespace OpenTK.Platform.X11
|
|||
window.RootWindow
|
||||
);
|
||||
|
||||
glContext = new X11GLContext(window, mode);
|
||||
window.VisualInfo = glContext.CreateVisual();
|
||||
glContext = new X11GLContext(mode);
|
||||
glContext.PrepareContext(window);
|
||||
window.VisualInfo = glContext.windowInfo.VisualInfo;
|
||||
|
||||
// Create a window on this display using the visual above
|
||||
Debug.Write("Creating output window... ");
|
||||
Debug.Write("Opening render window... ");
|
||||
|
||||
XSetWindowAttributes attributes = new XSetWindowAttributes();
|
||||
attributes.background_pixel = IntPtr.Zero;
|
||||
|
@ -267,7 +269,7 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
if (window.Handle == IntPtr.Zero)
|
||||
{
|
||||
throw new ApplicationException("Could not create window.");
|
||||
throw new ApplicationException("XCreateWindow call failed (returned 0).");
|
||||
}
|
||||
/*
|
||||
// Set the window hints
|
||||
|
@ -295,6 +297,24 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
Debug.Print("done! (id: {0})", window.Handle);
|
||||
|
||||
API.MapRaised(window.Display, window.Handle);
|
||||
|
||||
/*Debug.WriteLine("Mapped window.");
|
||||
|
||||
XEvent ev = new XEvent();
|
||||
API.IfEvent(window.Display, ref ev,
|
||||
delegate(IntPtr display, ref XEvent @event, IntPtr arg)
|
||||
{
|
||||
Debug.Print("Checking event: {0}", @event.type);
|
||||
if (@event.type == XEventName.MapNotify)
|
||||
{
|
||||
Debug.Print("Map event for window: {0}", @event.MapEvent.window);
|
||||
}
|
||||
return (@event.type == XEventName.MapNotify) && (@event.MapEvent.window == arg);
|
||||
},
|
||||
window.Handle);
|
||||
*/
|
||||
glContext.Mode = mode;//new DisplayMode(mode);
|
||||
glContext.windowInfo.Handle = window.Handle;
|
||||
glContext.CreateContext(null, true);
|
||||
|
||||
|
|
|
@ -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.9.7")]
|
||||
[assembly: AssemblyFileVersion("0.3.9.7")]
|
||||
[assembly: AssemblyVersion("0.3.10.1")]
|
||||
[assembly: AssemblyFileVersion("0.3.10.1")]
|
||||
|
|
Loading…
Reference in a new issue