Fixed line endings and set svn:eol-style to native and svn:mime-type to text/plain for .cs files.

This commit is contained in:
the_fiddler 2009-09-03 19:01:11 +00:00
parent 126280fc64
commit f6da09177e
142 changed files with 543759 additions and 543759 deletions

View file

@ -1,132 +1,132 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.XPath;
using Bind.GL2;
using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
namespace Bind.CL
{
class CLGenerator : Generator
{
public CLGenerator(string name)
{
if (String.IsNullOrEmpty(name))
throw new ArgumentNullException("name");
glTypemap = null;
csTypemap = "csharp.tm";
enumSpec = name + "/signatures.xml";
enumSpecExt = String.Empty;
glSpec = name + "/signatures.xml";
glSpecExt = String.Empty;
functionOverridesFile = name + "/overrides.xml";
importsFile = "Core.cs";
delegatesFile = "Delegates.cs";
enumsFile = "Enums.cs";
wrappersFile = "CL.cs";
Settings.ImportsClass = "Core";
Settings.DelegatesClass = "Delegates";
Settings.FunctionPrefix = "cl";
Settings.ConstantPrefix = "CL_";
Settings.EnumPrefix = "Cl";
Settings.OutputClass = "CL";
Settings.OutputNamespace = "OpenTK.Compute." + name;
Settings.OutputPath = Path.Combine("../../../Source/OpenTK/Compute", name);
//Settings.Compatibility &= ~Settings.Legacy.TurnVoidPointersToIntPtr;
Settings.Compatibility |= Settings.Legacy.NoDebugHelpers;
}
public override DelegateCollection ReadDelegates(StreamReader specFile)
{
DelegateCollection delegates = new DelegateCollection();
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
XPathNavigator nav = new XPathDocument(specFile).CreateNavigator().SelectSingleNode("/signatures");
foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
{
Delegate d = new Delegate();
d.Name = node.GetAttribute("name", String.Empty);
//d.Extension = node.GetAttribute("extension");
d.Version = node.GetAttribute("version", String.Empty);
d.Category = node.GetAttribute("category", String.Empty);
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
switch (param.Name)
{
case "returns":
d.ReturnType.CurrentType = param.GetAttribute("type", String.Empty);
break;
case "param":
Parameter p = new Parameter();
p.CurrentType = param.GetAttribute("type", String.Empty);
p.Name = param.GetAttribute("name", String.Empty);
string element_count = param.GetAttribute("elementcount", String.Empty);
if (!String.IsNullOrEmpty(element_count))
p.ElementCount = Int32.Parse(element_count);
p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty));
d.Parameters.Add(p);
break;
}
}
d.Translate(overrides);
delegates.Add(d);
}
return delegates;
}
public override Dictionary<string, string> ReadTypeMap(StreamReader specFile)
{
return base.ReadTypeMap(specFile);
}
public override Dictionary<string, string> ReadCSTypeMap(StreamReader specFile)
{
return base.ReadCSTypeMap(specFile);
}
public override EnumCollection ReadEnums(StreamReader specFile)
{
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
EnumCollection enums = new EnumCollection();
Enum all = new Enum(Settings.CompleteEnumName);
XPathDocument doc = new XPathDocument(specFile);
XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("/signatures");
foreach (XPathNavigator node in nav.SelectChildren("enum", String.Empty))
{
Enum e = new Enum(node.GetAttribute("name", String.Empty));
if (String.IsNullOrEmpty(e.Name))
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
Constant c = new Constant(param.GetAttribute("name", String.Empty), param.GetAttribute("value", String.Empty));
Utilities.Merge(all, c);
e.ConstantCollection.Add(c.Name, c);
}
Utilities.Merge(enums, e);
}
Utilities.Merge(enums, all);
enums.Translate(overrides);
return enums;
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.XPath;
using Bind.GL2;
using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
namespace Bind.CL
{
class CLGenerator : Generator
{
public CLGenerator(string name)
{
if (String.IsNullOrEmpty(name))
throw new ArgumentNullException("name");
glTypemap = null;
csTypemap = "csharp.tm";
enumSpec = name + "/signatures.xml";
enumSpecExt = String.Empty;
glSpec = name + "/signatures.xml";
glSpecExt = String.Empty;
functionOverridesFile = name + "/overrides.xml";
importsFile = "Core.cs";
delegatesFile = "Delegates.cs";
enumsFile = "Enums.cs";
wrappersFile = "CL.cs";
Settings.ImportsClass = "Core";
Settings.DelegatesClass = "Delegates";
Settings.FunctionPrefix = "cl";
Settings.ConstantPrefix = "CL_";
Settings.EnumPrefix = "Cl";
Settings.OutputClass = "CL";
Settings.OutputNamespace = "OpenTK.Compute." + name;
Settings.OutputPath = Path.Combine("../../../Source/OpenTK/Compute", name);
//Settings.Compatibility &= ~Settings.Legacy.TurnVoidPointersToIntPtr;
Settings.Compatibility |= Settings.Legacy.NoDebugHelpers;
}
public override DelegateCollection ReadDelegates(StreamReader specFile)
{
DelegateCollection delegates = new DelegateCollection();
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
XPathNavigator nav = new XPathDocument(specFile).CreateNavigator().SelectSingleNode("/signatures");
foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
{
Delegate d = new Delegate();
d.Name = node.GetAttribute("name", String.Empty);
//d.Extension = node.GetAttribute("extension");
d.Version = node.GetAttribute("version", String.Empty);
d.Category = node.GetAttribute("category", String.Empty);
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
switch (param.Name)
{
case "returns":
d.ReturnType.CurrentType = param.GetAttribute("type", String.Empty);
break;
case "param":
Parameter p = new Parameter();
p.CurrentType = param.GetAttribute("type", String.Empty);
p.Name = param.GetAttribute("name", String.Empty);
string element_count = param.GetAttribute("elementcount", String.Empty);
if (!String.IsNullOrEmpty(element_count))
p.ElementCount = Int32.Parse(element_count);
p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty));
d.Parameters.Add(p);
break;
}
}
d.Translate(overrides);
delegates.Add(d);
}
return delegates;
}
public override Dictionary<string, string> ReadTypeMap(StreamReader specFile)
{
return base.ReadTypeMap(specFile);
}
public override Dictionary<string, string> ReadCSTypeMap(StreamReader specFile)
{
return base.ReadCSTypeMap(specFile);
}
public override EnumCollection ReadEnums(StreamReader specFile)
{
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
EnumCollection enums = new EnumCollection();
Enum all = new Enum(Settings.CompleteEnumName);
XPathDocument doc = new XPathDocument(specFile);
XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("/signatures");
foreach (XPathNavigator node in nav.SelectChildren("enum", String.Empty))
{
Enum e = new Enum(node.GetAttribute("name", String.Empty));
if (String.IsNullOrEmpty(e.Name))
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
Constant c = new Constant(param.GetAttribute("name", String.Empty), param.GetAttribute("value", String.Empty));
Utilities.Merge(all, c);
e.ConstantCollection.Add(c.Name, c);
}
Utilities.Merge(enums, e);
}
Utilities.Merge(enums, all);
enums.Translate(overrides);
return enums;
}
}
}

View file

@ -1,127 +1,127 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.XPath;
using Bind.GL2;
using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
namespace Bind.ES
{
class ESGenerator : Generator
{
public ESGenerator(string nsName, string dirName)
{
if (String.IsNullOrEmpty(nsName))
throw new ArgumentNullException("nsName");
if (dirName == null)
dirName = nsName;
glTypemap = "GL2/gl.tm";
csTypemap = "csharp.tm";
enumSpec = dirName + "/signatures.xml";
enumSpecExt = String.Empty;
glSpec = dirName + "/signatures.xml";
glSpecExt = String.Empty;
functionOverridesFile = dirName + "/overrides.xml";
importsFile = "Core.cs";
delegatesFile = "Delegates.cs";
enumsFile = "Enums.cs";
wrappersFile = "ES.cs";
Settings.ImportsClass = "Core";
Settings.DelegatesClass = "Delegates";
Settings.OutputClass = "GL";
Settings.OutputNamespace = "OpenTK.Graphics." + nsName;
Settings.OutputPath = Path.Combine(Settings.OutputPath, dirName);
}
public override DelegateCollection ReadDelegates(StreamReader specFile)
{
DelegateCollection delegates = new DelegateCollection();
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
XPathNavigator nav = new XPathDocument(specFile).CreateNavigator().SelectSingleNode("/signatures");
foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
{
Delegate d = new Delegate();
d.Name = node.GetAttribute("name", String.Empty);
//d.Extension = node.GetAttribute("extension");
d.Version = node.GetAttribute("version", String.Empty);
d.Category = node.GetAttribute("category", String.Empty);
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
switch (param.Name)
{
case "returns":
d.ReturnType.CurrentType = param.GetAttribute("type", String.Empty);
break;
case "param":
Parameter p = new Parameter();
p.CurrentType = param.GetAttribute("type", String.Empty);
p.Name = param.GetAttribute("name", String.Empty);
string element_count = param.GetAttribute("elementcount", String.Empty);
if (!String.IsNullOrEmpty(element_count))
p.ElementCount = Int32.Parse(element_count);
p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty));
d.Parameters.Add(p);
break;
}
}
d.Translate(overrides);
delegates.Add(d);
}
return delegates;
}
public override Dictionary<string, string> ReadTypeMap(StreamReader specFile)
{
return base.ReadTypeMap(specFile);
}
public override Dictionary<string, string> ReadCSTypeMap(StreamReader specFile)
{
return base.ReadCSTypeMap(specFile);
}
public override EnumCollection ReadEnums(StreamReader specFile)
{
EnumCollection enums = new EnumCollection();
Enum all = new Enum(Settings.CompleteEnumName);
XPathDocument doc = new XPathDocument(specFile);
XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("/signatures");
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
foreach (XPathNavigator node in nav.SelectChildren("enum", String.Empty))
{
Enum e = new Enum(node.GetAttribute("name", String.Empty));
if (String.IsNullOrEmpty(e.Name))
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
Constant c = new Constant(param.GetAttribute("name", String.Empty), param.GetAttribute("value", String.Empty));
Utilities.Merge(all, c);
e.ConstantCollection.Add(c.Name, c);
}
Utilities.Merge(enums, e);
}
Utilities.Merge(enums, all);
enums.Translate(overrides);
return enums;
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.XPath;
using Bind.GL2;
using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
namespace Bind.ES
{
class ESGenerator : Generator
{
public ESGenerator(string nsName, string dirName)
{
if (String.IsNullOrEmpty(nsName))
throw new ArgumentNullException("nsName");
if (dirName == null)
dirName = nsName;
glTypemap = "GL2/gl.tm";
csTypemap = "csharp.tm";
enumSpec = dirName + "/signatures.xml";
enumSpecExt = String.Empty;
glSpec = dirName + "/signatures.xml";
glSpecExt = String.Empty;
functionOverridesFile = dirName + "/overrides.xml";
importsFile = "Core.cs";
delegatesFile = "Delegates.cs";
enumsFile = "Enums.cs";
wrappersFile = "ES.cs";
Settings.ImportsClass = "Core";
Settings.DelegatesClass = "Delegates";
Settings.OutputClass = "GL";
Settings.OutputNamespace = "OpenTK.Graphics." + nsName;
Settings.OutputPath = Path.Combine(Settings.OutputPath, dirName);
}
public override DelegateCollection ReadDelegates(StreamReader specFile)
{
DelegateCollection delegates = new DelegateCollection();
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
XPathNavigator nav = new XPathDocument(specFile).CreateNavigator().SelectSingleNode("/signatures");
foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
{
Delegate d = new Delegate();
d.Name = node.GetAttribute("name", String.Empty);
//d.Extension = node.GetAttribute("extension");
d.Version = node.GetAttribute("version", String.Empty);
d.Category = node.GetAttribute("category", String.Empty);
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
switch (param.Name)
{
case "returns":
d.ReturnType.CurrentType = param.GetAttribute("type", String.Empty);
break;
case "param":
Parameter p = new Parameter();
p.CurrentType = param.GetAttribute("type", String.Empty);
p.Name = param.GetAttribute("name", String.Empty);
string element_count = param.GetAttribute("elementcount", String.Empty);
if (!String.IsNullOrEmpty(element_count))
p.ElementCount = Int32.Parse(element_count);
p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty));
d.Parameters.Add(p);
break;
}
}
d.Translate(overrides);
delegates.Add(d);
}
return delegates;
}
public override Dictionary<string, string> ReadTypeMap(StreamReader specFile)
{
return base.ReadTypeMap(specFile);
}
public override Dictionary<string, string> ReadCSTypeMap(StreamReader specFile)
{
return base.ReadCSTypeMap(specFile);
}
public override EnumCollection ReadEnums(StreamReader specFile)
{
EnumCollection enums = new EnumCollection();
Enum all = new Enum(Settings.CompleteEnumName);
XPathDocument doc = new XPathDocument(specFile);
XPathNavigator nav = doc.CreateNavigator().SelectSingleNode("/signatures");
XPathDocument overrides = new XPathDocument(new StreamReader(Path.Combine(Settings.InputPath, functionOverridesFile)));
foreach (XPathNavigator node in nav.SelectChildren("enum", String.Empty))
{
Enum e = new Enum(node.GetAttribute("name", String.Empty));
if (String.IsNullOrEmpty(e.Name))
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{
Constant c = new Constant(param.GetAttribute("name", String.Empty), param.GetAttribute("value", String.Empty));
Utilities.Merge(all, c);
e.ConstantCollection.Add(c.Name, c);
}
Utilities.Merge(enums, e);
}
Utilities.Merge(enums, all);
enums.Translate(overrides);
return enums;
}
}
}

View file

@ -1,170 +1,170 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4918
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.Build.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenTK.Build.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
///&lt;Prebuild xmlns=&quot;http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd&quot;&gt;
///
/// &lt;Solution name=&quot;Generator&quot;&gt;
///
/// &lt;Configuration name=&quot;Debug&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;DEBUG;TRACE;&lt;/CompilerDefines&gt;
/// &lt;OptimizeCode&gt;false&lt;/OptimizeCode&gt;
/// &lt;DebugInformation&gt;true&lt;/DebugInformation&gt;
/// &lt;/Options&gt;
/// &lt;/Configuration&gt;
///
/// &lt;Configuration name=&quot;Release&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;TRACE;&lt;/CompilerDefines&gt;
/// &lt;Optim [rest of string was truncated]&quot;;.
/// </summary>
internal static string Generator {
get {
return ResourceManager.GetString("Generator", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
///&lt;Prebuild xmlns=&quot;http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd&quot;&gt;
///
/// &lt;Solution name=&quot;OpenTK&quot;&gt;
///
/// &lt;Configuration name=&quot;Debug&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;DEBUG;TRACE;&lt;/CompilerDefines&gt;
/// &lt;OptimizeCode&gt;false&lt;/OptimizeCode&gt;
/// &lt;DebugInformation&gt;true&lt;/DebugInformation&gt;
/// &lt;/Options&gt;
/// &lt;/Configuration&gt;
///
/// &lt;Configuration name=&quot;Release&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;TRACE;&lt;/CompilerDefines&gt;
/// &lt;Optimize [rest of string was truncated]&quot;;.
/// </summary>
internal static string OpenTK {
get {
return ResourceManager.GetString("OpenTK", resourceCulture);
}
}
internal static byte[] Prebuild {
get {
object obj = ResourceManager.GetObject("Prebuild", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized string similar to BSD License
///Copyright (c)2004-2008
///
///See AUTHORS file for list of copyright holders
///
///Dave Hudson (jendave@yahoo.com),
///Matthew Holmes (matthew@wildfiregames.com)
///Dan Moorehead (dan05a@gmail.com)
///Rob Loach (http://www.robloach.net)
///C.J. Adams-Collier (cjac@colliertech.org)
///
///http://dnpb.sourceforge.net
///All rights reserved.
///
///Redistribution and use in source and binary forms, with or without
///modification, are permitted provided that the following conditions
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string Prebuild_License {
get {
return ResourceManager.GetString("Prebuild_License", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
///&lt;Prebuild xmlns=&quot;http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd&quot;&gt;
///
/// &lt;Solution name=&quot;QuickStart&quot;&gt;
///
/// &lt;Configuration name=&quot;Debug&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;DEBUG;TRACE;&lt;/CompilerDefines&gt;
/// &lt;OptimizeCode&gt;false&lt;/OptimizeCode&gt;
/// &lt;DebugInformation&gt;true&lt;/DebugInformation&gt;
/// &lt;/Options&gt;
/// &lt;/Configuration&gt;
///
/// &lt;Configuration name=&quot;Release&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;TRACE;&lt;/CompilerDefines&gt;
/// &lt;Opti [rest of string was truncated]&quot;;.
/// </summary>
internal static string QuickStart {
get {
return ResourceManager.GetString("QuickStart", resourceCulture);
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4918
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.Build.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenTK.Build.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
///&lt;Prebuild xmlns=&quot;http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd&quot;&gt;
///
/// &lt;Solution name=&quot;Generator&quot;&gt;
///
/// &lt;Configuration name=&quot;Debug&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;DEBUG;TRACE;&lt;/CompilerDefines&gt;
/// &lt;OptimizeCode&gt;false&lt;/OptimizeCode&gt;
/// &lt;DebugInformation&gt;true&lt;/DebugInformation&gt;
/// &lt;/Options&gt;
/// &lt;/Configuration&gt;
///
/// &lt;Configuration name=&quot;Release&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;TRACE;&lt;/CompilerDefines&gt;
/// &lt;Optim [rest of string was truncated]&quot;;.
/// </summary>
internal static string Generator {
get {
return ResourceManager.GetString("Generator", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
///&lt;Prebuild xmlns=&quot;http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd&quot;&gt;
///
/// &lt;Solution name=&quot;OpenTK&quot;&gt;
///
/// &lt;Configuration name=&quot;Debug&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;DEBUG;TRACE;&lt;/CompilerDefines&gt;
/// &lt;OptimizeCode&gt;false&lt;/OptimizeCode&gt;
/// &lt;DebugInformation&gt;true&lt;/DebugInformation&gt;
/// &lt;/Options&gt;
/// &lt;/Configuration&gt;
///
/// &lt;Configuration name=&quot;Release&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;TRACE;&lt;/CompilerDefines&gt;
/// &lt;Optimize [rest of string was truncated]&quot;;.
/// </summary>
internal static string OpenTK {
get {
return ResourceManager.GetString("OpenTK", resourceCulture);
}
}
internal static byte[] Prebuild {
get {
object obj = ResourceManager.GetObject("Prebuild", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized string similar to BSD License
///Copyright (c)2004-2008
///
///See AUTHORS file for list of copyright holders
///
///Dave Hudson (jendave@yahoo.com),
///Matthew Holmes (matthew@wildfiregames.com)
///Dan Moorehead (dan05a@gmail.com)
///Rob Loach (http://www.robloach.net)
///C.J. Adams-Collier (cjac@colliertech.org)
///
///http://dnpb.sourceforge.net
///All rights reserved.
///
///Redistribution and use in source and binary forms, with or without
///modification, are permitted provided that the following conditions
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string Prebuild_License {
get {
return ResourceManager.GetString("Prebuild_License", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
///&lt;Prebuild xmlns=&quot;http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd&quot;&gt;
///
/// &lt;Solution name=&quot;QuickStart&quot;&gt;
///
/// &lt;Configuration name=&quot;Debug&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;DEBUG;TRACE;&lt;/CompilerDefines&gt;
/// &lt;OptimizeCode&gt;false&lt;/OptimizeCode&gt;
/// &lt;DebugInformation&gt;true&lt;/DebugInformation&gt;
/// &lt;/Options&gt;
/// &lt;/Configuration&gt;
///
/// &lt;Configuration name=&quot;Release&quot;&gt;
/// &lt;Options&gt;
/// &lt;CompilerDefines&gt;TRACE;&lt;/CompilerDefines&gt;
/// &lt;Opti [rest of string was truncated]&quot;;.
/// </summary>
internal static string QuickStart {
get {
return ResourceManager.GetString("QuickStart", resourceCulture);
}
}
}
}

View file

@ -1,135 +1,135 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace OpenTK.Graphics
{
// Used in debug-mode only, for automatic OpenGL error-checking.
//
// Works like this: an instance is created before each OpenGL function is called.
// The constructor resets the OpenGL error state. Once the native function returns,
// the error state is checked again, raising the relevant exceptions.
//
// A using-region is used to ensure Dispose() is called.
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
[Obsolete]
struct ErrorHelper : IDisposable
{
#region Fields
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
#endregion
#region Constructors
public ErrorHelper(IGraphicsContext context)
{
if (context == null)
throw new GraphicsContextMissingException();
Context = (GraphicsContext)context;
lock (SyncRoot)
{
if (!ContextErrors.ContainsKey(Context))
ContextErrors.Add(Context, new List<ErrorCode>());
}
ResetErrors();
}
#endregion
#region Public Members
// Retrieve all OpenGL errors to clear the error list.
// See http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html
[Conditional("DEBUG")]
internal void ResetErrors()
{
if (Context.ErrorChecking)
{
while (GL.GetError() != ErrorCode.NoError)
{ }
}
}
// Retrieve all OpenGL errors and throw an exception if anything other than NoError is returned.
[Conditional("DEBUG")]
internal void CheckErrors()
{
if (Context.ErrorChecking)
{
List<ErrorCode> error_list = ContextErrors[Context];
error_list.Clear();
ErrorCode error;
do
{
error = GL.GetError();
error_list.Add(error);
} while (error != ErrorCode.NoError);
if (error_list.Count != 1)
{
StringBuilder sb = new StringBuilder();
foreach (ErrorCode e in error_list)
{
if (e != ErrorCode.NoError)
{
sb.Append(e.ToString());
sb.Append(", ");
}
else
break;
}
sb.Remove(sb.Length - 2, 2); // Remove the last comma
throw new GraphicsErrorException(sb.ToString());
}
}
}
#endregion
#region IDisposable Members
public void Dispose()
{
CheckErrors();
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace OpenTK.Graphics
{
// Used in debug-mode only, for automatic OpenGL error-checking.
//
// Works like this: an instance is created before each OpenGL function is called.
// The constructor resets the OpenGL error state. Once the native function returns,
// the error state is checked again, raising the relevant exceptions.
//
// A using-region is used to ensure Dispose() is called.
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
[Obsolete]
struct ErrorHelper : IDisposable
{
#region Fields
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
#endregion
#region Constructors
public ErrorHelper(IGraphicsContext context)
{
if (context == null)
throw new GraphicsContextMissingException();
Context = (GraphicsContext)context;
lock (SyncRoot)
{
if (!ContextErrors.ContainsKey(Context))
ContextErrors.Add(Context, new List<ErrorCode>());
}
ResetErrors();
}
#endregion
#region Public Members
// Retrieve all OpenGL errors to clear the error list.
// See http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html
[Conditional("DEBUG")]
internal void ResetErrors()
{
if (Context.ErrorChecking)
{
while (GL.GetError() != ErrorCode.NoError)
{ }
}
}
// Retrieve all OpenGL errors and throw an exception if anything other than NoError is returned.
[Conditional("DEBUG")]
internal void CheckErrors()
{
if (Context.ErrorChecking)
{
List<ErrorCode> error_list = ContextErrors[Context];
error_list.Clear();
ErrorCode error;
do
{
error = GL.GetError();
error_list.Add(error);
} while (error != ErrorCode.NoError);
if (error_list.Count != 1)
{
StringBuilder sb = new StringBuilder();
foreach (ErrorCode e in error_list)
{
if (e != ErrorCode.NoError)
{
sb.Append(e.ToString());
sb.Append(", ");
}
else
break;
}
sb.Remove(sb.Length - 2, 2); // Remove the last comma
throw new GraphicsErrorException(sb.ToString());
}
}
}
#endregion
#region IDisposable Members
public void Dispose()
{
CheckErrors();
}
#endregion
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,190 +1,190 @@
namespace OpenTK.Graphics
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 3019
#pragma warning disable 1591
partial class Glu
{
[Obsolete]
internal static partial class Imports
{
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginCurve", ExactSpelling = true)]
internal extern static void BeginCurve(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginPolygon", ExactSpelling = true)]
internal extern static void BeginPolygon(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginSurface", ExactSpelling = true)]
internal extern static void BeginSurface(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginTrim", ExactSpelling = true)]
internal extern static void BeginTrim(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild1DMipmapLevels", ExactSpelling = true)]
internal extern static Int32 Build1DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild1DMipmaps", ExactSpelling = true)]
internal extern static Int32 Build1DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild2DMipmapLevels", ExactSpelling = true)]
internal extern static Int32 Build2DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild2DMipmaps", ExactSpelling = true)]
internal extern static Int32 Build2DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, PixelFormat format, PixelType type, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild3DMipmapLevels", ExactSpelling = true)]
internal extern static Int32 Build3DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild3DMipmaps", ExactSpelling = true)]
internal extern static Int32 Build3DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, PixelFormat format, PixelType type, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluCheckExtension", ExactSpelling = true)]
internal extern static unsafe bool CheckExtension(Byte* extName, Byte* extString);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluCylinder", ExactSpelling = true)]
internal extern static void Cylinder(IntPtr quad, double @base, double top, double height, Int32 slices, Int32 stacks);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDeleteNurbsRenderer", ExactSpelling = true)]
internal extern static void DeleteNurbsRenderer(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDeleteQuadric", ExactSpelling = true)]
internal extern static void DeleteQuadric(IntPtr quad);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDeleteTess", ExactSpelling = true)]
internal extern static void DeleteTess(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDisk", ExactSpelling = true)]
internal extern static void Disk(IntPtr quad, double inner, double outer, Int32 slices, Int32 loops);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndCurve", ExactSpelling = true)]
internal extern static void EndCurve(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndPolygon", ExactSpelling = true)]
internal extern static void EndPolygon(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndSurface", ExactSpelling = true)]
internal extern static void EndSurface(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndTrim", ExactSpelling = true)]
internal extern static void EndTrim(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluErrorString", ExactSpelling = true)]
internal extern static IntPtr ErrorString(OpenTK.Graphics.GluErrorCode error);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluGetString", ExactSpelling = true)]
internal extern static IntPtr GetString(OpenTK.Graphics.GluStringName name);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluGetNurbsProperty", ExactSpelling = true)]
internal extern static unsafe void GetNurbsProperty(IntPtr nurb, OpenTK.Graphics.NurbsProperty property, [Out] float* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluGetTessProperty", ExactSpelling = true)]
internal extern static unsafe void GetTessProperty(IntPtr tess, OpenTK.Graphics.TessParameter which, [Out] double* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluLoadSamplingMatrices", ExactSpelling = true)]
internal extern static unsafe void LoadSamplingMatrices(IntPtr nurb, float* model, float* perspective, Int32* view);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluLookAt", ExactSpelling = true)]
internal extern static void LookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNewNurbsRenderer", ExactSpelling = true)]
internal extern static IntPtr NewNurbsRenderer();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNewQuadric", ExactSpelling = true)]
internal extern static IntPtr NewQuadric();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNewTess", ExactSpelling = true)]
internal extern static IntPtr NewTess();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNextContour", ExactSpelling = true)]
internal extern static void NextContour(IntPtr tess, OpenTK.Graphics.TessContour type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsCallback", ExactSpelling = true)]
internal extern static void NurbsCallback(IntPtr nurb, OpenTK.Graphics.NurbsCallback which, Delegate CallBackFunc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsCallbackData", ExactSpelling = true)]
internal extern static void NurbsCallbackData(IntPtr nurb, IntPtr userData);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsCurve", ExactSpelling = true)]
internal extern static unsafe void NurbsCurve(IntPtr nurb, Int32 knotCount, [Out] float* knots, Int32 stride, [Out] float* control, Int32 order, MapTarget type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsProperty", ExactSpelling = true)]
internal extern static void NurbsProperty(IntPtr nurb, OpenTK.Graphics.NurbsProperty property, float value);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsSurface", ExactSpelling = true)]
internal extern static unsafe void NurbsSurface(IntPtr nurb, Int32 sKnotCount, float* sKnots, Int32 tKnotCount, float* tKnots, Int32 sStride, Int32 tStride, float* control, Int32 sOrder, Int32 tOrder, MapTarget type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluOrtho2D", ExactSpelling = true)]
internal extern static void Ortho2D(double left, double right, double bottom, double top);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPartialDisk", ExactSpelling = true)]
internal extern static void PartialDisk(IntPtr quad, double inner, double outer, Int32 slices, Int32 loops, double start, double sweep);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPerspective", ExactSpelling = true)]
internal extern static void Perspective(double fovy, double aspect, double zNear, double zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPickMatrix", ExactSpelling = true)]
internal extern static unsafe void PickMatrix(double x, double y, double delX, double delY, [Out] Int32* viewport);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluProject", ExactSpelling = true)]
internal extern static unsafe Int32 Project(double objX, double objY, double objZ, double* model, double* proj, Int32* view, double* winX, double* winY, double* winZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPwlCurve", ExactSpelling = true)]
internal extern static unsafe void PwlCurve(IntPtr nurb, Int32 count, float* data, Int32 stride, OpenTK.Graphics.NurbsTrim type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricCallback", ExactSpelling = true)]
internal extern static void QuadricCallback(IntPtr quad, OpenTK.Graphics.QuadricCallback which, Delegate CallBackFunc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricDrawStyle", ExactSpelling = true)]
internal extern static void QuadricDrawStyle(IntPtr quad, OpenTK.Graphics.QuadricDrawStyle draw);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricNormals", ExactSpelling = true)]
internal extern static void QuadricNormals(IntPtr quad, OpenTK.Graphics.QuadricNormal normal);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricOrientation", ExactSpelling = true)]
internal extern static void QuadricOrientation(IntPtr quad, OpenTK.Graphics.QuadricOrientation orientation);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricTexture", ExactSpelling = true)]
internal extern static void QuadricTexture(IntPtr quad, bool texture);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluScaleImage", ExactSpelling = true)]
internal extern static Int32 ScaleImage(PixelFormat format, Int32 wIn, Int32 hIn, PixelType typeIn, IntPtr dataIn, Int32 wOut, Int32 hOut, PixelType typeOut, [Out] IntPtr dataOut);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluSphere", ExactSpelling = true)]
internal extern static void Sphere(IntPtr quad, double radius, Int32 slices, Int32 stacks);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessBeginContour", ExactSpelling = true)]
internal extern static void TessBeginContour(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessBeginPolygon", ExactSpelling = true)]
internal extern static void TessBeginPolygon(IntPtr tess, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessCallback", ExactSpelling = true)]
internal extern static void TessCallback(IntPtr tess, OpenTK.Graphics.TessCallback which, Delegate CallBackFunc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessEndContour", ExactSpelling = true)]
internal extern static void TessEndContour(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessEndPolygon", ExactSpelling = true)]
internal extern static void TessEndPolygon(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessNormal", ExactSpelling = true)]
internal extern static void TessNormal(IntPtr tess, double valueX, double valueY, double valueZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessProperty", ExactSpelling = true)]
internal extern static void TessProperty(IntPtr tess, OpenTK.Graphics.TessParameter which, double data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessVertex", ExactSpelling = true)]
internal extern static unsafe void TessVertex(IntPtr tess, double* location, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluUnProject", ExactSpelling = true)]
internal extern static unsafe Int32 UnProject(double winX, double winY, double winZ, double* model, double* proj, Int32* view, double* objX, double* objY, double* objZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluUnProject4", ExactSpelling = true)]
internal extern static unsafe Int32 UnProject4(double winX, double winY, double winZ, double clipW, double* model, double* proj, Int32* view, double near, double far, double* objX, double* objY, double* objZ, double* objW);
}
}
}
namespace OpenTK.Graphics
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 3019
#pragma warning disable 1591
partial class Glu
{
[Obsolete]
internal static partial class Imports
{
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginCurve", ExactSpelling = true)]
internal extern static void BeginCurve(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginPolygon", ExactSpelling = true)]
internal extern static void BeginPolygon(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginSurface", ExactSpelling = true)]
internal extern static void BeginSurface(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBeginTrim", ExactSpelling = true)]
internal extern static void BeginTrim(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild1DMipmapLevels", ExactSpelling = true)]
internal extern static Int32 Build1DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild1DMipmaps", ExactSpelling = true)]
internal extern static Int32 Build1DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild2DMipmapLevels", ExactSpelling = true)]
internal extern static Int32 Build2DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild2DMipmaps", ExactSpelling = true)]
internal extern static Int32 Build2DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, PixelFormat format, PixelType type, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild3DMipmapLevels", ExactSpelling = true)]
internal extern static Int32 Build3DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluBuild3DMipmaps", ExactSpelling = true)]
internal extern static Int32 Build3DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, PixelFormat format, PixelType type, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluCheckExtension", ExactSpelling = true)]
internal extern static unsafe bool CheckExtension(Byte* extName, Byte* extString);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluCylinder", ExactSpelling = true)]
internal extern static void Cylinder(IntPtr quad, double @base, double top, double height, Int32 slices, Int32 stacks);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDeleteNurbsRenderer", ExactSpelling = true)]
internal extern static void DeleteNurbsRenderer(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDeleteQuadric", ExactSpelling = true)]
internal extern static void DeleteQuadric(IntPtr quad);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDeleteTess", ExactSpelling = true)]
internal extern static void DeleteTess(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluDisk", ExactSpelling = true)]
internal extern static void Disk(IntPtr quad, double inner, double outer, Int32 slices, Int32 loops);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndCurve", ExactSpelling = true)]
internal extern static void EndCurve(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndPolygon", ExactSpelling = true)]
internal extern static void EndPolygon(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndSurface", ExactSpelling = true)]
internal extern static void EndSurface(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluEndTrim", ExactSpelling = true)]
internal extern static void EndTrim(IntPtr nurb);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluErrorString", ExactSpelling = true)]
internal extern static IntPtr ErrorString(OpenTK.Graphics.GluErrorCode error);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluGetString", ExactSpelling = true)]
internal extern static IntPtr GetString(OpenTK.Graphics.GluStringName name);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluGetNurbsProperty", ExactSpelling = true)]
internal extern static unsafe void GetNurbsProperty(IntPtr nurb, OpenTK.Graphics.NurbsProperty property, [Out] float* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluGetTessProperty", ExactSpelling = true)]
internal extern static unsafe void GetTessProperty(IntPtr tess, OpenTK.Graphics.TessParameter which, [Out] double* data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluLoadSamplingMatrices", ExactSpelling = true)]
internal extern static unsafe void LoadSamplingMatrices(IntPtr nurb, float* model, float* perspective, Int32* view);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluLookAt", ExactSpelling = true)]
internal extern static void LookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNewNurbsRenderer", ExactSpelling = true)]
internal extern static IntPtr NewNurbsRenderer();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNewQuadric", ExactSpelling = true)]
internal extern static IntPtr NewQuadric();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNewTess", ExactSpelling = true)]
internal extern static IntPtr NewTess();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNextContour", ExactSpelling = true)]
internal extern static void NextContour(IntPtr tess, OpenTK.Graphics.TessContour type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsCallback", ExactSpelling = true)]
internal extern static void NurbsCallback(IntPtr nurb, OpenTK.Graphics.NurbsCallback which, Delegate CallBackFunc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsCallbackData", ExactSpelling = true)]
internal extern static void NurbsCallbackData(IntPtr nurb, IntPtr userData);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsCurve", ExactSpelling = true)]
internal extern static unsafe void NurbsCurve(IntPtr nurb, Int32 knotCount, [Out] float* knots, Int32 stride, [Out] float* control, Int32 order, MapTarget type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsProperty", ExactSpelling = true)]
internal extern static void NurbsProperty(IntPtr nurb, OpenTK.Graphics.NurbsProperty property, float value);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluNurbsSurface", ExactSpelling = true)]
internal extern static unsafe void NurbsSurface(IntPtr nurb, Int32 sKnotCount, float* sKnots, Int32 tKnotCount, float* tKnots, Int32 sStride, Int32 tStride, float* control, Int32 sOrder, Int32 tOrder, MapTarget type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluOrtho2D", ExactSpelling = true)]
internal extern static void Ortho2D(double left, double right, double bottom, double top);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPartialDisk", ExactSpelling = true)]
internal extern static void PartialDisk(IntPtr quad, double inner, double outer, Int32 slices, Int32 loops, double start, double sweep);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPerspective", ExactSpelling = true)]
internal extern static void Perspective(double fovy, double aspect, double zNear, double zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPickMatrix", ExactSpelling = true)]
internal extern static unsafe void PickMatrix(double x, double y, double delX, double delY, [Out] Int32* viewport);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluProject", ExactSpelling = true)]
internal extern static unsafe Int32 Project(double objX, double objY, double objZ, double* model, double* proj, Int32* view, double* winX, double* winY, double* winZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluPwlCurve", ExactSpelling = true)]
internal extern static unsafe void PwlCurve(IntPtr nurb, Int32 count, float* data, Int32 stride, OpenTK.Graphics.NurbsTrim type);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricCallback", ExactSpelling = true)]
internal extern static void QuadricCallback(IntPtr quad, OpenTK.Graphics.QuadricCallback which, Delegate CallBackFunc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricDrawStyle", ExactSpelling = true)]
internal extern static void QuadricDrawStyle(IntPtr quad, OpenTK.Graphics.QuadricDrawStyle draw);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricNormals", ExactSpelling = true)]
internal extern static void QuadricNormals(IntPtr quad, OpenTK.Graphics.QuadricNormal normal);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricOrientation", ExactSpelling = true)]
internal extern static void QuadricOrientation(IntPtr quad, OpenTK.Graphics.QuadricOrientation orientation);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluQuadricTexture", ExactSpelling = true)]
internal extern static void QuadricTexture(IntPtr quad, bool texture);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluScaleImage", ExactSpelling = true)]
internal extern static Int32 ScaleImage(PixelFormat format, Int32 wIn, Int32 hIn, PixelType typeIn, IntPtr dataIn, Int32 wOut, Int32 hOut, PixelType typeOut, [Out] IntPtr dataOut);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluSphere", ExactSpelling = true)]
internal extern static void Sphere(IntPtr quad, double radius, Int32 slices, Int32 stacks);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessBeginContour", ExactSpelling = true)]
internal extern static void TessBeginContour(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessBeginPolygon", ExactSpelling = true)]
internal extern static void TessBeginPolygon(IntPtr tess, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessCallback", ExactSpelling = true)]
internal extern static void TessCallback(IntPtr tess, OpenTK.Graphics.TessCallback which, Delegate CallBackFunc);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessEndContour", ExactSpelling = true)]
internal extern static void TessEndContour(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessEndPolygon", ExactSpelling = true)]
internal extern static void TessEndPolygon(IntPtr tess);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessNormal", ExactSpelling = true)]
internal extern static void TessNormal(IntPtr tess, double valueX, double valueY, double valueZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessProperty", ExactSpelling = true)]
internal extern static void TessProperty(IntPtr tess, OpenTK.Graphics.TessParameter which, double data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluTessVertex", ExactSpelling = true)]
internal extern static unsafe void TessVertex(IntPtr tess, double* location, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluUnProject", ExactSpelling = true)]
internal extern static unsafe Int32 UnProject(double winX, double winY, double winZ, double* model, double* proj, Int32* view, double* objX, double* objY, double* objZ);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(Glu.Library, EntryPoint = "gluUnProject4", ExactSpelling = true)]
internal extern static unsafe Int32 UnProject4(double winX, double winY, double winZ, double clipW, double* model, double* proj, Int32* view, double near, double far, double* objX, double* objY, double* objZ, double* objW);
}
}
}

View file

@ -1,195 +1,195 @@
namespace OpenTK.Graphics
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 0649
#pragma warning disable 3019
#pragma warning disable 1591
partial class Glu
{
internal static partial class Delegates
{
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginCurve(IntPtr nurb);
internal static BeginCurve gluBeginCurve;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginPolygon(IntPtr tess);
internal static BeginPolygon gluBeginPolygon;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginSurface(IntPtr nurb);
internal static BeginSurface gluBeginSurface;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginTrim(IntPtr nurb);
internal static BeginTrim gluBeginTrim;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build1DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
internal static Build1DMipmapLevels gluBuild1DMipmapLevels;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build1DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, IntPtr data);
internal static Build1DMipmaps gluBuild1DMipmaps;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build2DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
internal static Build2DMipmapLevels gluBuild2DMipmapLevels;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build2DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, PixelFormat format, PixelType type, IntPtr data);
internal static Build2DMipmaps gluBuild2DMipmaps;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build3DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
internal static Build3DMipmapLevels gluBuild3DMipmapLevels;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build3DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, PixelFormat format, PixelType type, IntPtr data);
internal static Build3DMipmaps gluBuild3DMipmaps;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate bool CheckExtension(Byte* extName, Byte* extString);
internal unsafe static CheckExtension gluCheckExtension;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Cylinder(IntPtr quad, double @base, double top, double height, Int32 slices, Int32 stacks);
internal static Cylinder gluCylinder;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteNurbsRenderer(IntPtr nurb);
internal static DeleteNurbsRenderer gluDeleteNurbsRenderer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteQuadric(IntPtr quad);
internal static DeleteQuadric gluDeleteQuadric;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteTess(IntPtr tess);
internal static DeleteTess gluDeleteTess;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Disk(IntPtr quad, double inner, double outer, Int32 slices, Int32 loops);
internal static Disk gluDisk;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndCurve(IntPtr nurb);
internal static EndCurve gluEndCurve;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndPolygon(IntPtr tess);
internal static EndPolygon gluEndPolygon;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndSurface(IntPtr nurb);
internal static EndSurface gluEndSurface;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndTrim(IntPtr nurb);
internal static EndTrim gluEndTrim;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr ErrorString(OpenTK.Graphics.GluErrorCode error);
internal static ErrorString gluErrorString;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetString(OpenTK.Graphics.GluStringName name);
internal static GetString gluGetString;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetNurbsProperty(IntPtr nurb, OpenTK.Graphics.NurbsProperty property, [Out] float* data);
internal unsafe static GetNurbsProperty gluGetNurbsProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetTessProperty(IntPtr tess, OpenTK.Graphics.TessParameter which, [Out] double* data);
internal unsafe static GetTessProperty gluGetTessProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LoadSamplingMatrices(IntPtr nurb, float* model, float* perspective, Int32* view);
internal unsafe static LoadSamplingMatrices gluLoadSamplingMatrices;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ);
internal static LookAt gluLookAt;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr NewNurbsRenderer();
internal static NewNurbsRenderer gluNewNurbsRenderer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr NewQuadric();
internal static NewQuadric gluNewQuadric;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr NewTess();
internal static NewTess gluNewTess;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NextContour(IntPtr tess, OpenTK.Graphics.TessContour type);
internal static NextContour gluNextContour;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsCallback(IntPtr nurb, OpenTK.Graphics.NurbsCallback which, Delegate CallBackFunc);
internal static NurbsCallback gluNurbsCallback;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsCallbackData(IntPtr nurb, IntPtr userData);
internal static NurbsCallbackData gluNurbsCallbackData;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsCallbackDataEXT(IntPtr nurb, IntPtr userData);
internal static NurbsCallbackDataEXT gluNurbsCallbackDataEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void NurbsCurve(IntPtr nurb, Int32 knotCount, [Out] float* knots, Int32 stride, [Out] float* control, Int32 order, MapTarget type);
internal unsafe static NurbsCurve gluNurbsCurve;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsProperty(IntPtr nurb, OpenTK.Graphics.NurbsProperty property, float value);
internal static NurbsProperty gluNurbsProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void NurbsSurface(IntPtr nurb, Int32 sKnotCount, float* sKnots, Int32 tKnotCount, float* tKnots, Int32 sStride, Int32 tStride, float* control, Int32 sOrder, Int32 tOrder, MapTarget type);
internal unsafe static NurbsSurface gluNurbsSurface;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Ortho2D(double left, double right, double bottom, double top);
internal static Ortho2D gluOrtho2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PartialDisk(IntPtr quad, double inner, double outer, Int32 slices, Int32 loops, double start, double sweep);
internal static PartialDisk gluPartialDisk;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Perspective(double fovy, double aspect, double zNear, double zFar);
internal static Perspective gluPerspective;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void PickMatrix(double x, double y, double delX, double delY, [Out] Int32* viewport);
internal unsafe static PickMatrix gluPickMatrix;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 Project(double objX, double objY, double objZ, double* model, double* proj, Int32* view, double* winX, double* winY, double* winZ);
internal unsafe static Project gluProject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void PwlCurve(IntPtr nurb, Int32 count, float* data, Int32 stride, OpenTK.Graphics.NurbsTrim type);
internal unsafe static PwlCurve gluPwlCurve;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricCallback(IntPtr quad, OpenTK.Graphics.QuadricCallback which, Delegate CallBackFunc);
internal static QuadricCallback gluQuadricCallback;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricDrawStyle(IntPtr quad, OpenTK.Graphics.QuadricDrawStyle draw);
internal static QuadricDrawStyle gluQuadricDrawStyle;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricNormals(IntPtr quad, OpenTK.Graphics.QuadricNormal normal);
internal static QuadricNormals gluQuadricNormals;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricOrientation(IntPtr quad, OpenTK.Graphics.QuadricOrientation orientation);
internal static QuadricOrientation gluQuadricOrientation;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricTexture(IntPtr quad, bool texture);
internal static QuadricTexture gluQuadricTexture;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 ScaleImage(PixelFormat format, Int32 wIn, Int32 hIn, PixelType typeIn, IntPtr dataIn, Int32 wOut, Int32 hOut, PixelType typeOut, [Out] IntPtr dataOut);
internal static ScaleImage gluScaleImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Sphere(IntPtr quad, double radius, Int32 slices, Int32 stacks);
internal static Sphere gluSphere;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessBeginContour(IntPtr tess);
internal static TessBeginContour gluTessBeginContour;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessBeginPolygon(IntPtr tess, IntPtr data);
internal static TessBeginPolygon gluTessBeginPolygon;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessCallback(IntPtr tess, OpenTK.Graphics.TessCallback which, Delegate CallBackFunc);
internal static TessCallback gluTessCallback;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessEndContour(IntPtr tess);
internal static TessEndContour gluTessEndContour;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessEndPolygon(IntPtr tess);
internal static TessEndPolygon gluTessEndPolygon;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessNormal(IntPtr tess, double valueX, double valueY, double valueZ);
internal static TessNormal gluTessNormal;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessProperty(IntPtr tess, OpenTK.Graphics.TessParameter which, double data);
internal static TessProperty gluTessProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void TessVertex(IntPtr tess, double* location, IntPtr data);
internal unsafe static TessVertex gluTessVertex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 TexFilterFuncSGI(TextureTarget target, SgisTextureFilter4 filtertype, float* parms, Int32 n, [Out] float* weights);
internal unsafe static TexFilterFuncSGI gluTexFilterFuncSGI;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 UnProject(double winX, double winY, double winZ, double* model, double* proj, Int32* view, double* objX, double* objY, double* objZ);
internal unsafe static UnProject gluUnProject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 UnProject4(double winX, double winY, double winZ, double clipW, double* model, double* proj, Int32* view, double near, double far, double* objX, double* objY, double* objZ, double* objW);
internal unsafe static UnProject4 gluUnProject4;
}
}
}
namespace OpenTK.Graphics
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 0649
#pragma warning disable 3019
#pragma warning disable 1591
partial class Glu
{
internal static partial class Delegates
{
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginCurve(IntPtr nurb);
internal static BeginCurve gluBeginCurve;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginPolygon(IntPtr tess);
internal static BeginPolygon gluBeginPolygon;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginSurface(IntPtr nurb);
internal static BeginSurface gluBeginSurface;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BeginTrim(IntPtr nurb);
internal static BeginTrim gluBeginTrim;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build1DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
internal static Build1DMipmapLevels gluBuild1DMipmapLevels;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build1DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, PixelFormat format, PixelType type, IntPtr data);
internal static Build1DMipmaps gluBuild1DMipmaps;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build2DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
internal static Build2DMipmapLevels gluBuild2DMipmapLevels;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build2DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, PixelFormat format, PixelType type, IntPtr data);
internal static Build2DMipmaps gluBuild2DMipmaps;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build3DMipmapLevels(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, PixelFormat format, PixelType type, Int32 level, Int32 @base, Int32 max, IntPtr data);
internal static Build3DMipmapLevels gluBuild3DMipmapLevels;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 Build3DMipmaps(TextureTarget target, Int32 internalFormat, Int32 width, Int32 height, Int32 depth, PixelFormat format, PixelType type, IntPtr data);
internal static Build3DMipmaps gluBuild3DMipmaps;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate bool CheckExtension(Byte* extName, Byte* extString);
internal unsafe static CheckExtension gluCheckExtension;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Cylinder(IntPtr quad, double @base, double top, double height, Int32 slices, Int32 stacks);
internal static Cylinder gluCylinder;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteNurbsRenderer(IntPtr nurb);
internal static DeleteNurbsRenderer gluDeleteNurbsRenderer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteQuadric(IntPtr quad);
internal static DeleteQuadric gluDeleteQuadric;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DeleteTess(IntPtr tess);
internal static DeleteTess gluDeleteTess;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Disk(IntPtr quad, double inner, double outer, Int32 slices, Int32 loops);
internal static Disk gluDisk;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndCurve(IntPtr nurb);
internal static EndCurve gluEndCurve;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndPolygon(IntPtr tess);
internal static EndPolygon gluEndPolygon;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndSurface(IntPtr nurb);
internal static EndSurface gluEndSurface;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EndTrim(IntPtr nurb);
internal static EndTrim gluEndTrim;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr ErrorString(OpenTK.Graphics.GluErrorCode error);
internal static ErrorString gluErrorString;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr GetString(OpenTK.Graphics.GluStringName name);
internal static GetString gluGetString;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetNurbsProperty(IntPtr nurb, OpenTK.Graphics.NurbsProperty property, [Out] float* data);
internal unsafe static GetNurbsProperty gluGetNurbsProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetTessProperty(IntPtr tess, OpenTK.Graphics.TessParameter which, [Out] double* data);
internal unsafe static GetTessProperty gluGetTessProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LoadSamplingMatrices(IntPtr nurb, float* model, float* perspective, Int32* view);
internal unsafe static LoadSamplingMatrices gluLoadSamplingMatrices;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ);
internal static LookAt gluLookAt;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr NewNurbsRenderer();
internal static NewNurbsRenderer gluNewNurbsRenderer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr NewQuadric();
internal static NewQuadric gluNewQuadric;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate IntPtr NewTess();
internal static NewTess gluNewTess;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NextContour(IntPtr tess, OpenTK.Graphics.TessContour type);
internal static NextContour gluNextContour;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsCallback(IntPtr nurb, OpenTK.Graphics.NurbsCallback which, Delegate CallBackFunc);
internal static NurbsCallback gluNurbsCallback;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsCallbackData(IntPtr nurb, IntPtr userData);
internal static NurbsCallbackData gluNurbsCallbackData;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsCallbackDataEXT(IntPtr nurb, IntPtr userData);
internal static NurbsCallbackDataEXT gluNurbsCallbackDataEXT;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void NurbsCurve(IntPtr nurb, Int32 knotCount, [Out] float* knots, Int32 stride, [Out] float* control, Int32 order, MapTarget type);
internal unsafe static NurbsCurve gluNurbsCurve;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NurbsProperty(IntPtr nurb, OpenTK.Graphics.NurbsProperty property, float value);
internal static NurbsProperty gluNurbsProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void NurbsSurface(IntPtr nurb, Int32 sKnotCount, float* sKnots, Int32 tKnotCount, float* tKnots, Int32 sStride, Int32 tStride, float* control, Int32 sOrder, Int32 tOrder, MapTarget type);
internal unsafe static NurbsSurface gluNurbsSurface;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Ortho2D(double left, double right, double bottom, double top);
internal static Ortho2D gluOrtho2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PartialDisk(IntPtr quad, double inner, double outer, Int32 slices, Int32 loops, double start, double sweep);
internal static PartialDisk gluPartialDisk;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Perspective(double fovy, double aspect, double zNear, double zFar);
internal static Perspective gluPerspective;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void PickMatrix(double x, double y, double delX, double delY, [Out] Int32* viewport);
internal unsafe static PickMatrix gluPickMatrix;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 Project(double objX, double objY, double objZ, double* model, double* proj, Int32* view, double* winX, double* winY, double* winZ);
internal unsafe static Project gluProject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void PwlCurve(IntPtr nurb, Int32 count, float* data, Int32 stride, OpenTK.Graphics.NurbsTrim type);
internal unsafe static PwlCurve gluPwlCurve;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricCallback(IntPtr quad, OpenTK.Graphics.QuadricCallback which, Delegate CallBackFunc);
internal static QuadricCallback gluQuadricCallback;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricDrawStyle(IntPtr quad, OpenTK.Graphics.QuadricDrawStyle draw);
internal static QuadricDrawStyle gluQuadricDrawStyle;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricNormals(IntPtr quad, OpenTK.Graphics.QuadricNormal normal);
internal static QuadricNormals gluQuadricNormals;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricOrientation(IntPtr quad, OpenTK.Graphics.QuadricOrientation orientation);
internal static QuadricOrientation gluQuadricOrientation;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void QuadricTexture(IntPtr quad, bool texture);
internal static QuadricTexture gluQuadricTexture;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate Int32 ScaleImage(PixelFormat format, Int32 wIn, Int32 hIn, PixelType typeIn, IntPtr dataIn, Int32 wOut, Int32 hOut, PixelType typeOut, [Out] IntPtr dataOut);
internal static ScaleImage gluScaleImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Sphere(IntPtr quad, double radius, Int32 slices, Int32 stacks);
internal static Sphere gluSphere;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessBeginContour(IntPtr tess);
internal static TessBeginContour gluTessBeginContour;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessBeginPolygon(IntPtr tess, IntPtr data);
internal static TessBeginPolygon gluTessBeginPolygon;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessCallback(IntPtr tess, OpenTK.Graphics.TessCallback which, Delegate CallBackFunc);
internal static TessCallback gluTessCallback;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessEndContour(IntPtr tess);
internal static TessEndContour gluTessEndContour;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessEndPolygon(IntPtr tess);
internal static TessEndPolygon gluTessEndPolygon;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessNormal(IntPtr tess, double valueX, double valueY, double valueZ);
internal static TessNormal gluTessNormal;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TessProperty(IntPtr tess, OpenTK.Graphics.TessParameter which, double data);
internal static TessProperty gluTessProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void TessVertex(IntPtr tess, double* location, IntPtr data);
internal unsafe static TessVertex gluTessVertex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 TexFilterFuncSGI(TextureTarget target, SgisTextureFilter4 filtertype, float* parms, Int32 n, [Out] float* weights);
internal unsafe static TexFilterFuncSGI gluTexFilterFuncSGI;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 UnProject(double winX, double winY, double winZ, double* model, double* proj, Int32* view, double* objX, double* objY, double* objZ);
internal unsafe static UnProject gluUnProject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate Int32 UnProject4(double winX, double winY, double winZ, double clipW, double* model, double* proj, Int32* view, double near, double far, double* objX, double* objY, double* objZ, double* objW);
internal unsafe static UnProject4 gluUnProject4;
}
}
}

View file

@ -1,390 +1,390 @@
namespace OpenTK.Graphics
{
#pragma warning disable 1591
public enum GluVersion
{
Version11 = ((int)1),
Version13 = ((int)1),
Version12 = ((int)1),
}
public enum GluStringName
{
Version = ((int)100800),
Extensions = ((int)100801),
}
public enum GluErrorCode
{
OutOfMemory = ((int)100902),
InvalidEnum = ((int)100900),
InvalidValue = ((int)100901),
InvalidOperation = ((int)100904),
}
public enum Filter4TypeSGIS
{
MitchellNetravaliSgi = ((int)100301),
LagrangianSgi = ((int)100300),
}
public enum NurbsDisplay
{
OutlinePolygon = ((int)100240),
OutlinePatch = ((int)100241),
Fill = ((int)QuadricDrawStyle.Fill),
}
public enum NurbsCallback
{
NurbsColorData = ((int)100173),
NurbsVertexData = ((int)100171),
NurbsNormal = ((int)100166),
NurbsError = ((int)100103),
NurbsTextureCoordExt = ((int)100168),
Error = ((int)100103),
NurbsEndDataExt = ((int)100175),
NurbsEnd = ((int)100169),
NurbsTextureCoord = ((int)100168),
NurbsEndExt = ((int)100169),
NurbsNormalDataExt = ((int)100172),
NurbsColor = ((int)100167),
NurbsColorExt = ((int)100167),
NurbsVertexExt = ((int)100165),
NurbsBeginExt = ((int)100164),
NurbsTextureCoordData = ((int)100174),
NurbsBeginData = ((int)100170),
NurbsColorDataExt = ((int)100173),
NurbsBeginDataExt = ((int)100170),
NurbsVertex = ((int)100165),
NurbsTextureCoordDataExt = ((int)100174),
NurbsNormalExt = ((int)100166),
NurbsVertexDataExt = ((int)100171),
NurbsBegin = ((int)100164),
NurbsEndData = ((int)100175),
NurbsNormalData = ((int)100172),
}
public enum NurbsError
{
NurbsError37 = ((int)100287),
NurbsError16 = ((int)100266),
NurbsError26 = ((int)100276),
NurbsError36 = ((int)100286),
NurbsError19 = ((int)100269),
NurbsError29 = ((int)100279),
NurbsError8 = ((int)100258),
NurbsError12 = ((int)100262),
NurbsError9 = ((int)100259),
NurbsError1 = ((int)100251),
NurbsError18 = ((int)100268),
NurbsError28 = ((int)100278),
NurbsError4 = ((int)100254),
NurbsError5 = ((int)100255),
NurbsError6 = ((int)100256),
NurbsError7 = ((int)100257),
NurbsError3 = ((int)100253),
NurbsError22 = ((int)100272),
NurbsError32 = ((int)100282),
NurbsError2 = ((int)100252),
NurbsError11 = ((int)100261),
NurbsError21 = ((int)100271),
NurbsError31 = ((int)100281),
NurbsError10 = ((int)100260),
NurbsError20 = ((int)100270),
NurbsError30 = ((int)100280),
NurbsError15 = ((int)100265),
NurbsError25 = ((int)100275),
NurbsError35 = ((int)100285),
NurbsError14 = ((int)100264),
NurbsError24 = ((int)100274),
NurbsError34 = ((int)100284),
NurbsError13 = ((int)100263),
NurbsError23 = ((int)100273),
NurbsError33 = ((int)100283),
NurbsError17 = ((int)100267),
NurbsError27 = ((int)100277),
}
public enum NurbsProperty
{
DisplayMode = ((int)100204),
ParametricTolerance = ((int)100202),
NurbsRenderer = ((int)100162),
NurbsTessellator = ((int)100161),
NurbsTessellatorExt = ((int)100161),
NurbsModeExt = ((int)100160),
UStep = ((int)100206),
SamplingMethod = ((int)100205),
AutoLoadMatrix = ((int)100200),
VStep = ((int)100207),
Culling = ((int)100201),
NurbsRendererExt = ((int)100162),
NurbsMode = ((int)100160),
SamplingTolerance = ((int)100203),
}
public enum NurbsSampling
{
ObjectParametricError = ((int)100208),
ObjectPathLength = ((int)100209),
PathLength = ((int)100215),
DomainDistance = ((int)100217),
ObjectPathLengthExt = ((int)100209),
ObjectParametricErrorExt = ((int)100208),
ParametricError = ((int)100216),
}
public enum NurbsTrim
{
Map1Trim3 = ((int)100211),
Map1Trim2 = ((int)100210),
}
public enum QuadricDrawStyle
{
Line = ((int)100011),
Silhouette = ((int)100013),
Point = ((int)100010),
Fill = ((int)100012),
}
public enum QuadricCallback
{
Error = ((int)NurbsCallback.Error),
}
public enum QuadricNormal
{
None = ((int)100002),
Flat = ((int)100001),
Smooth = ((int)100000),
}
public enum QuadricOrientation
{
Outside = ((int)100020),
Inside = ((int)100021),
}
public enum TessCallback
{
TessEdgeFlagData = ((int)100110),
Begin = ((int)100100),
TessError = ((int)100103),
EdgeFlag = ((int)100104),
End = ((int)100102),
TessCombine = ((int)100105),
Error = ((int)100103),
TessEndData = ((int)100108),
TessBeginData = ((int)100106),
TessErrorData = ((int)100109),
Vertex = ((int)100101),
TessVertexData = ((int)100107),
TessVertex = ((int)100101),
TessEdgeFlag = ((int)100104),
TessEnd = ((int)100102),
TessBegin = ((int)100100),
TessCombineData = ((int)100111),
}
public enum TessContour
{
Exterior = ((int)100123),
Ccw = ((int)100121),
Interior = ((int)100122),
Unknown = ((int)100124),
Cw = ((int)100120),
}
public enum TessParameter
{
TessWindingRule = ((int)100140),
TessBoundaryOnly = ((int)100141),
TessTolerance = ((int)100142),
}
public enum TessError
{
TessMissingBeginPolygon = ((int)100151),
TessMissingEndPolygon = ((int)100153),
TessError1 = ((int)100151),
TessMissingBeginContour = ((int)100152),
TessCoordTooLarge = ((int)100155),
TessError7 = ((int)100157),
TessError2 = ((int)100152),
TessError4 = ((int)100154),
TessNeedCombineCallback = ((int)100156),
TessError3 = ((int)100153),
TessError6 = ((int)100156),
TessError5 = ((int)100155),
TessError8 = ((int)100158),
TessMissingEndContour = ((int)100154),
}
public enum TessWinding
{
TessWindingNonzero = ((int)100131),
TessWindingOdd = ((int)100130),
TessWindingPositive = ((int)100132),
TessWindingAbsGeqTwo = ((int)100134),
TessWindingNegative = ((int)100133),
}
public enum AllGlu
{
None = ((int)100002),
TessWindingRule = ((int)100140),
TessWindingPositive = ((int)100132),
ObjectPathLength = ((int)100209),
NurbsTextureCoordExt = ((int)100168),
Vertex = ((int)100101),
TessCombine = ((int)100105),
AutoLoadMatrix = ((int)100200),
TessBoundaryOnly = ((int)100141),
NurbsEndExt = ((int)100169),
NurbsError17 = ((int)100267),
NurbsError27 = ((int)100277),
NurbsError37 = ((int)100287),
Interior = ((int)100122),
TessWindingOdd = ((int)100130),
InvalidValue = ((int)100901),
ParametricError = ((int)100216),
TessError8 = ((int)100158),
NurbsError14 = ((int)100264),
NurbsError24 = ((int)100274),
NurbsError34 = ((int)100284),
NurbsTextureCoordDataExt = ((int)100174),
TessMissingBeginContour = ((int)100152),
Silhouette = ((int)100013),
TessError7 = ((int)100157),
NurbsNormalDataExt = ((int)100172),
NurbsError21 = ((int)100271),
NurbsError31 = ((int)100281),
PathLength = ((int)100215),
OutlinePolygon = ((int)100240),
TessVertex = ((int)100101),
TessWindingAbsGeqTwo = ((int)100134),
Extensions = ((int)100801),
TessEdgeFlagData = ((int)100110),
EdgeFlag = ((int)100104),
TessError1 = ((int)100151),
Line = ((int)100011),
NurbsBeginExt = ((int)100164),
Point = ((int)100010),
Begin = ((int)100100),
Inside = ((int)100021),
Flat = ((int)100001),
TessBegin = ((int)100100),
NurbsNormal = ((int)100166),
NurbsColorData = ((int)100173),
NurbsBeginDataExt = ((int)100170),
NurbsRenderer = ((int)100162),
NurbsBeginData = ((int)100170),
Outside = ((int)100020),
DisplayMode = ((int)100204),
NurbsError15 = ((int)100265),
NurbsError25 = ((int)100275),
NurbsError35 = ((int)100285),
NurbsVertexExt = ((int)100165),
TessError5 = ((int)100155),
Unknown = ((int)100124),
NurbsEndDataExt = ((int)100175),
NurbsError12 = ((int)100262),
NurbsError22 = ((int)100272),
NurbsError32 = ((int)100282),
ObjectParametricErrorExt = ((int)100208),
NurbsRendererExt = ((int)100162),
TessError3 = ((int)100153),
Fill = ((int)100012),
TessError = ((int)100103),
ObjectPathLengthExt = ((int)100209),
TessWindingNegative = ((int)100133),
NurbsTessellator = ((int)100161),
NurbsColor = ((int)100167),
NurbsModeExt = ((int)100160),
SamplingTolerance = ((int)100203),
NurbsColorDataExt = ((int)100173),
Exterior = ((int)100123),
Ccw = ((int)100121),
Cw = ((int)100120),
NurbsNormalExt = ((int)100166),
NurbsError18 = ((int)100268),
NurbsError28 = ((int)100278),
LagrangianSgi = ((int)100300),
TessEnd = ((int)100102),
NurbsTessellatorExt = ((int)100161),
NurbsEnd = ((int)100169),
TessWindingNonzero = ((int)100131),
OutOfMemory = ((int)100902),
TessBeginData = ((int)100106),
Error = ((int)100103),
ObjectParametricError = ((int)100208),
NurbsBegin = ((int)100164),
TessCombineData = ((int)100111),
TessMissingEndPolygon = ((int)100153),
NurbsTextureCoord = ((int)100168),
Smooth = ((int)100000),
TessMissingBeginPolygon = ((int)100151),
NurbsEndData = ((int)100175),
NurbsVertexData = ((int)100171),
TessEndData = ((int)100108),
NurbsError11 = ((int)100261),
NurbsVertex = ((int)100165),
NurbsError30 = ((int)100280),
Version11 = ((int)1),
TessError6 = ((int)100156),
Version13 = ((int)1),
Version12 = ((int)1),
TessErrorData = ((int)100109),
NurbsError36 = ((int)100286),
End = ((int)100102),
SamplingMethod = ((int)100205),
TessNeedCombineCallback = ((int)100156),
UStep = ((int)100206),
DomainDistance = ((int)100217),
TessEdgeFlag = ((int)100104),
NurbsColorExt = ((int)100167),
NurbsError19 = ((int)100269),
NurbsError29 = ((int)100279),
InvalidOperation = ((int)100904),
TessCoordTooLarge = ((int)100155),
TessVertexData = ((int)100107),
NurbsMode = ((int)100160),
ParametricTolerance = ((int)100202),
NurbsError2 = ((int)100252),
VStep = ((int)100207),
TessMissingEndContour = ((int)100154),
Map1Trim2 = ((int)100210),
Map1Trim3 = ((int)100211),
Culling = ((int)100201),
NurbsError16 = ((int)100266),
NurbsError26 = ((int)100276),
NurbsVertexDataExt = ((int)100171),
NurbsNormalData = ((int)100172),
TessError2 = ((int)100152),
NurbsError13 = ((int)100263),
NurbsError23 = ((int)100273),
NurbsError33 = ((int)100283),
NurbsError8 = ((int)100258),
NurbsError9 = ((int)100259),
TessError4 = ((int)100154),
NurbsError10 = ((int)100260),
NurbsError20 = ((int)100270),
OutlinePatch = ((int)100241),
NurbsError = ((int)100103),
NurbsTextureCoordData = ((int)100174),
NurbsError1 = ((int)100251),
InvalidEnum = ((int)100900),
NurbsError3 = ((int)100253),
NurbsError4 = ((int)100254),
NurbsError5 = ((int)100255),
NurbsError6 = ((int)100256),
NurbsError7 = ((int)100257),
MitchellNetravaliSgi = ((int)100301),
Version = ((int)100800),
TessTolerance = ((int)100142),
}
}
namespace OpenTK.Graphics
{
#pragma warning disable 1591
public enum GluVersion
{
Version11 = ((int)1),
Version13 = ((int)1),
Version12 = ((int)1),
}
public enum GluStringName
{
Version = ((int)100800),
Extensions = ((int)100801),
}
public enum GluErrorCode
{
OutOfMemory = ((int)100902),
InvalidEnum = ((int)100900),
InvalidValue = ((int)100901),
InvalidOperation = ((int)100904),
}
public enum Filter4TypeSGIS
{
MitchellNetravaliSgi = ((int)100301),
LagrangianSgi = ((int)100300),
}
public enum NurbsDisplay
{
OutlinePolygon = ((int)100240),
OutlinePatch = ((int)100241),
Fill = ((int)QuadricDrawStyle.Fill),
}
public enum NurbsCallback
{
NurbsColorData = ((int)100173),
NurbsVertexData = ((int)100171),
NurbsNormal = ((int)100166),
NurbsError = ((int)100103),
NurbsTextureCoordExt = ((int)100168),
Error = ((int)100103),
NurbsEndDataExt = ((int)100175),
NurbsEnd = ((int)100169),
NurbsTextureCoord = ((int)100168),
NurbsEndExt = ((int)100169),
NurbsNormalDataExt = ((int)100172),
NurbsColor = ((int)100167),
NurbsColorExt = ((int)100167),
NurbsVertexExt = ((int)100165),
NurbsBeginExt = ((int)100164),
NurbsTextureCoordData = ((int)100174),
NurbsBeginData = ((int)100170),
NurbsColorDataExt = ((int)100173),
NurbsBeginDataExt = ((int)100170),
NurbsVertex = ((int)100165),
NurbsTextureCoordDataExt = ((int)100174),
NurbsNormalExt = ((int)100166),
NurbsVertexDataExt = ((int)100171),
NurbsBegin = ((int)100164),
NurbsEndData = ((int)100175),
NurbsNormalData = ((int)100172),
}
public enum NurbsError
{
NurbsError37 = ((int)100287),
NurbsError16 = ((int)100266),
NurbsError26 = ((int)100276),
NurbsError36 = ((int)100286),
NurbsError19 = ((int)100269),
NurbsError29 = ((int)100279),
NurbsError8 = ((int)100258),
NurbsError12 = ((int)100262),
NurbsError9 = ((int)100259),
NurbsError1 = ((int)100251),
NurbsError18 = ((int)100268),
NurbsError28 = ((int)100278),
NurbsError4 = ((int)100254),
NurbsError5 = ((int)100255),
NurbsError6 = ((int)100256),
NurbsError7 = ((int)100257),
NurbsError3 = ((int)100253),
NurbsError22 = ((int)100272),
NurbsError32 = ((int)100282),
NurbsError2 = ((int)100252),
NurbsError11 = ((int)100261),
NurbsError21 = ((int)100271),
NurbsError31 = ((int)100281),
NurbsError10 = ((int)100260),
NurbsError20 = ((int)100270),
NurbsError30 = ((int)100280),
NurbsError15 = ((int)100265),
NurbsError25 = ((int)100275),
NurbsError35 = ((int)100285),
NurbsError14 = ((int)100264),
NurbsError24 = ((int)100274),
NurbsError34 = ((int)100284),
NurbsError13 = ((int)100263),
NurbsError23 = ((int)100273),
NurbsError33 = ((int)100283),
NurbsError17 = ((int)100267),
NurbsError27 = ((int)100277),
}
public enum NurbsProperty
{
DisplayMode = ((int)100204),
ParametricTolerance = ((int)100202),
NurbsRenderer = ((int)100162),
NurbsTessellator = ((int)100161),
NurbsTessellatorExt = ((int)100161),
NurbsModeExt = ((int)100160),
UStep = ((int)100206),
SamplingMethod = ((int)100205),
AutoLoadMatrix = ((int)100200),
VStep = ((int)100207),
Culling = ((int)100201),
NurbsRendererExt = ((int)100162),
NurbsMode = ((int)100160),
SamplingTolerance = ((int)100203),
}
public enum NurbsSampling
{
ObjectParametricError = ((int)100208),
ObjectPathLength = ((int)100209),
PathLength = ((int)100215),
DomainDistance = ((int)100217),
ObjectPathLengthExt = ((int)100209),
ObjectParametricErrorExt = ((int)100208),
ParametricError = ((int)100216),
}
public enum NurbsTrim
{
Map1Trim3 = ((int)100211),
Map1Trim2 = ((int)100210),
}
public enum QuadricDrawStyle
{
Line = ((int)100011),
Silhouette = ((int)100013),
Point = ((int)100010),
Fill = ((int)100012),
}
public enum QuadricCallback
{
Error = ((int)NurbsCallback.Error),
}
public enum QuadricNormal
{
None = ((int)100002),
Flat = ((int)100001),
Smooth = ((int)100000),
}
public enum QuadricOrientation
{
Outside = ((int)100020),
Inside = ((int)100021),
}
public enum TessCallback
{
TessEdgeFlagData = ((int)100110),
Begin = ((int)100100),
TessError = ((int)100103),
EdgeFlag = ((int)100104),
End = ((int)100102),
TessCombine = ((int)100105),
Error = ((int)100103),
TessEndData = ((int)100108),
TessBeginData = ((int)100106),
TessErrorData = ((int)100109),
Vertex = ((int)100101),
TessVertexData = ((int)100107),
TessVertex = ((int)100101),
TessEdgeFlag = ((int)100104),
TessEnd = ((int)100102),
TessBegin = ((int)100100),
TessCombineData = ((int)100111),
}
public enum TessContour
{
Exterior = ((int)100123),
Ccw = ((int)100121),
Interior = ((int)100122),
Unknown = ((int)100124),
Cw = ((int)100120),
}
public enum TessParameter
{
TessWindingRule = ((int)100140),
TessBoundaryOnly = ((int)100141),
TessTolerance = ((int)100142),
}
public enum TessError
{
TessMissingBeginPolygon = ((int)100151),
TessMissingEndPolygon = ((int)100153),
TessError1 = ((int)100151),
TessMissingBeginContour = ((int)100152),
TessCoordTooLarge = ((int)100155),
TessError7 = ((int)100157),
TessError2 = ((int)100152),
TessError4 = ((int)100154),
TessNeedCombineCallback = ((int)100156),
TessError3 = ((int)100153),
TessError6 = ((int)100156),
TessError5 = ((int)100155),
TessError8 = ((int)100158),
TessMissingEndContour = ((int)100154),
}
public enum TessWinding
{
TessWindingNonzero = ((int)100131),
TessWindingOdd = ((int)100130),
TessWindingPositive = ((int)100132),
TessWindingAbsGeqTwo = ((int)100134),
TessWindingNegative = ((int)100133),
}
public enum AllGlu
{
None = ((int)100002),
TessWindingRule = ((int)100140),
TessWindingPositive = ((int)100132),
ObjectPathLength = ((int)100209),
NurbsTextureCoordExt = ((int)100168),
Vertex = ((int)100101),
TessCombine = ((int)100105),
AutoLoadMatrix = ((int)100200),
TessBoundaryOnly = ((int)100141),
NurbsEndExt = ((int)100169),
NurbsError17 = ((int)100267),
NurbsError27 = ((int)100277),
NurbsError37 = ((int)100287),
Interior = ((int)100122),
TessWindingOdd = ((int)100130),
InvalidValue = ((int)100901),
ParametricError = ((int)100216),
TessError8 = ((int)100158),
NurbsError14 = ((int)100264),
NurbsError24 = ((int)100274),
NurbsError34 = ((int)100284),
NurbsTextureCoordDataExt = ((int)100174),
TessMissingBeginContour = ((int)100152),
Silhouette = ((int)100013),
TessError7 = ((int)100157),
NurbsNormalDataExt = ((int)100172),
NurbsError21 = ((int)100271),
NurbsError31 = ((int)100281),
PathLength = ((int)100215),
OutlinePolygon = ((int)100240),
TessVertex = ((int)100101),
TessWindingAbsGeqTwo = ((int)100134),
Extensions = ((int)100801),
TessEdgeFlagData = ((int)100110),
EdgeFlag = ((int)100104),
TessError1 = ((int)100151),
Line = ((int)100011),
NurbsBeginExt = ((int)100164),
Point = ((int)100010),
Begin = ((int)100100),
Inside = ((int)100021),
Flat = ((int)100001),
TessBegin = ((int)100100),
NurbsNormal = ((int)100166),
NurbsColorData = ((int)100173),
NurbsBeginDataExt = ((int)100170),
NurbsRenderer = ((int)100162),
NurbsBeginData = ((int)100170),
Outside = ((int)100020),
DisplayMode = ((int)100204),
NurbsError15 = ((int)100265),
NurbsError25 = ((int)100275),
NurbsError35 = ((int)100285),
NurbsVertexExt = ((int)100165),
TessError5 = ((int)100155),
Unknown = ((int)100124),
NurbsEndDataExt = ((int)100175),
NurbsError12 = ((int)100262),
NurbsError22 = ((int)100272),
NurbsError32 = ((int)100282),
ObjectParametricErrorExt = ((int)100208),
NurbsRendererExt = ((int)100162),
TessError3 = ((int)100153),
Fill = ((int)100012),
TessError = ((int)100103),
ObjectPathLengthExt = ((int)100209),
TessWindingNegative = ((int)100133),
NurbsTessellator = ((int)100161),
NurbsColor = ((int)100167),
NurbsModeExt = ((int)100160),
SamplingTolerance = ((int)100203),
NurbsColorDataExt = ((int)100173),
Exterior = ((int)100123),
Ccw = ((int)100121),
Cw = ((int)100120),
NurbsNormalExt = ((int)100166),
NurbsError18 = ((int)100268),
NurbsError28 = ((int)100278),
LagrangianSgi = ((int)100300),
TessEnd = ((int)100102),
NurbsTessellatorExt = ((int)100161),
NurbsEnd = ((int)100169),
TessWindingNonzero = ((int)100131),
OutOfMemory = ((int)100902),
TessBeginData = ((int)100106),
Error = ((int)100103),
ObjectParametricError = ((int)100208),
NurbsBegin = ((int)100164),
TessCombineData = ((int)100111),
TessMissingEndPolygon = ((int)100153),
NurbsTextureCoord = ((int)100168),
Smooth = ((int)100000),
TessMissingBeginPolygon = ((int)100151),
NurbsEndData = ((int)100175),
NurbsVertexData = ((int)100171),
TessEndData = ((int)100108),
NurbsError11 = ((int)100261),
NurbsVertex = ((int)100165),
NurbsError30 = ((int)100280),
Version11 = ((int)1),
TessError6 = ((int)100156),
Version13 = ((int)1),
Version12 = ((int)1),
TessErrorData = ((int)100109),
NurbsError36 = ((int)100286),
End = ((int)100102),
SamplingMethod = ((int)100205),
TessNeedCombineCallback = ((int)100156),
UStep = ((int)100206),
DomainDistance = ((int)100217),
TessEdgeFlag = ((int)100104),
NurbsColorExt = ((int)100167),
NurbsError19 = ((int)100269),
NurbsError29 = ((int)100279),
InvalidOperation = ((int)100904),
TessCoordTooLarge = ((int)100155),
TessVertexData = ((int)100107),
NurbsMode = ((int)100160),
ParametricTolerance = ((int)100202),
NurbsError2 = ((int)100252),
VStep = ((int)100207),
TessMissingEndContour = ((int)100154),
Map1Trim2 = ((int)100210),
Map1Trim3 = ((int)100211),
Culling = ((int)100201),
NurbsError16 = ((int)100266),
NurbsError26 = ((int)100276),
NurbsVertexDataExt = ((int)100171),
NurbsNormalData = ((int)100172),
TessError2 = ((int)100152),
NurbsError13 = ((int)100263),
NurbsError23 = ((int)100273),
NurbsError33 = ((int)100283),
NurbsError8 = ((int)100258),
NurbsError9 = ((int)100259),
TessError4 = ((int)100154),
NurbsError10 = ((int)100260),
NurbsError20 = ((int)100270),
OutlinePatch = ((int)100241),
NurbsError = ((int)100103),
NurbsTextureCoordData = ((int)100174),
NurbsError1 = ((int)100251),
InvalidEnum = ((int)100900),
NurbsError3 = ((int)100253),
NurbsError4 = ((int)100254),
NurbsError5 = ((int)100255),
NurbsError6 = ((int)100256),
NurbsError7 = ((int)100257),
MitchellNetravaliSgi = ((int)100301),
Version = ((int)100800),
TessTolerance = ((int)100142),
}
}

View file

@ -1,446 +1,446 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* Contributions by Andy Gill.
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Reflection.Emit;
using OpenTK.Platform;
namespace OpenTK.Graphics
{
/// <summary>
/// Provides access to the OpenGL Utilities library.
/// Methods i this library are considered deprecated and should be avoided.
/// </summary>
[Obsolete("Use OpenTK math functions instead.")]
public static partial class Glu
{
private const string Library = "glu32.dll";
private static Dictionary<string, bool> AvailableExtensions = new Dictionary<string, bool>();
private static bool rebuildExtensionList = true;
private static Type importsClass = typeof(Imports);
static Glu()
{
// Glu doesn't have any extensions, so this is safe to call once and be done with it.
LoadAll();
}
#region private static Delegate LoadDelegate(string name, Type signature)
/// <summary>
/// Creates a System.Delegate that can be used to call a GLU function, core or extension.
/// </summary>
/// <param name="name">The name of the GLU function (eg. "gluBuild2DMipmaps")</param>
/// <param name="signature">The signature of the GLU function.</param>
/// <returns>
/// A System.Delegate that can be used to call this GLU function, or null if the specified
/// function name did not correspond to an GLU function.
/// </returns>
private static Delegate LoadDelegate(string name, Type signature)
{
MethodInfo m = importsClass.GetMethod(name.Substring(3), BindingFlags.Static | BindingFlags.NonPublic);
return
GL.GetExtensionDelegate(name, signature) ??
(m != null ? Delegate.CreateDelegate(signature, m) : null);
}
#endregion
#region public static void LoadAll()
/// <summary>
/// Loads all GLU functions (core and extensions).
/// </summary>
/// <remarks>
/// <para>
/// Call this function manually whenever you need to update GLU entry points.
/// This need will never arise under normal usage patterns.
/// </para>
/// </remarks>
public static void LoadAll()
{
int supported = 0;
Type extensions_class = typeof(Glu).GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
if (extensions_class == null)
throw new InvalidOperationException("The specified type does not have any loadable extensions.");
FieldInfo[] delegates = extensions_class.GetFields(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
if (delegates == null)
throw new InvalidOperationException("The specified type does not have any loadable extensions.");
foreach (FieldInfo f in delegates)
{
Delegate d = LoadDelegate(f.Name, f.FieldType);
if (d != null)
++supported;
f.SetValue(null, d);
}
rebuildExtensionList = true;
}
#endregion
#region public static bool Load(string function)
/// <summary>
/// Tries to reload the given GLU function (core or extension).
/// </summary>
/// <param name="function">The name of the GLU function.</param>
/// <returns>True if the function was found and reloaded, false otherwise.</returns>
/// <remarks>
/// <para>
/// While the automatic initialisation will load all GLU entry points, in some cases
/// the initialization can take place before a render context has been established.
/// In this case, use this function to load the entry points for the GLU functions
/// you will need, or use LoadAll() to load all available entry points.
/// </para>
/// <para>
/// This function returns true if the given GLU function is supported, false otherwise.
/// </para>
/// <para>
/// To query for supported extensions use the IsExtensionSupported() function instead.
/// </para>
/// </remarks>
public static bool Load(string function)
{
// Glu does not contain any extensions - this method does nothing.
return true;
}
#endregion
#region public static bool SupportsExtension(string name)
/// <summary>
/// Determines whether the specified GLU extension is available in
/// the current GLU context.
/// </summary>
/// <param name="name">The string for the GLU extension.</param>
/// <returns>True if the specified extension is available, false otherwise.</returns>
public static bool SupportsExtension(string name)
{
if (rebuildExtensionList)
{
BuildExtensionList();
}
// Search the cache for the string. Note that the cache substitutes
// strings "1.0" to "2.1" with "GL_VERSION_1_0" to "GL_VERSION_2_1"
if (AvailableExtensions.ContainsKey(name))
{
return AvailableExtensions[name];
}
return false;
}
#endregion
#region private static void BuildExtensionList()
/// <summary>
/// Builds a cache of the supported extensions to speed up searches.
/// </summary>
private static void BuildExtensionList()
{
// Assumes there is an opengl context current.
AvailableExtensions.Clear();
string version_string = Glu.GetString(GluStringName.Version);
if (String.IsNullOrEmpty(version_string))
{
throw new ApplicationException("Failed to build extension list. Is there an opengl context current?");
}
string version = version_string.Trim(' ');
if (version.StartsWith("1.0"))
{
AvailableExtensions.Add("VERSION_1_0", true);
}
else if (version.StartsWith("1.1"))
{
AvailableExtensions.Add("VERSION_1_0", true);
AvailableExtensions.Add("VERSION_1_1", true);
}
else if (version.StartsWith("1.2"))
{
AvailableExtensions.Add("VERSION_1_0", true);
AvailableExtensions.Add("VERSION_1_1", true);
AvailableExtensions.Add("VERSION_1_2", true);
}
else if (version.StartsWith("1.3"))
{
AvailableExtensions.Add("VERSION_1_0", true);
AvailableExtensions.Add("VERSION_1_1", true);
AvailableExtensions.Add("VERSION_1_2", true);
AvailableExtensions.Add("VERSION_1_3", true);
}
string extension_string = Glu.GetString(GluStringName.Extensions);
if (String.IsNullOrEmpty(extension_string))
{ // no extensions are available
return;
}
string[] extensions = extension_string.Split(' ');
foreach (string ext in extensions)
{
AvailableExtensions.Add(ext, true);
}
rebuildExtensionList = false;
}
#endregion
#region Overloads
public static void LookAt(Vector3 eye, Vector3 center, Vector3 up)
{
Delegates.gluLookAt((double)eye.X, (double)eye.Y, (double)eye.Z, (double)center.X, (double)center.Y, (double)center.Z, (double)up.X, (double)up.Y, (double)up.Z);
}
// One token Project overload, I picked this one because it's CLS compliant, and it
// makes reasonably clear which args are inputs and which are outputs.
public static Int32 Project(Vector3 obj, double[] model, double[] proj, Int32[] view, out Vector3 win)
{
unsafe
{
double winX, winY, winZ;
double* winX_ptr = &winX;
double* winY_ptr = &winY;
double* winZ_ptr = &winZ;
fixed (double* model_ptr = model)
fixed (double* proj_ptr = proj)
fixed (Int32* view_ptr = view)
{
Int32 retval = Delegates.gluProject((double)obj.X, (double)obj.Y, (double)obj.Z, (double*)model_ptr, (double*)proj_ptr, (Int32*)view_ptr, (double*)winX_ptr, (double*)winY_ptr, (double*)winZ_ptr);
win = new Vector3((float)*winX_ptr, (float)*winY_ptr, (float)*winZ_ptr);
return retval;
}
}
}
public static void TessNormal(IntPtr tess, Vector3 normal)
{
Delegates.gluTessNormal(tess, (double)normal.X, (double)normal.Y, (double)normal.Z);
}
public static Int32 UnProject(Vector3 win, double[] model, double[] proj, Int32[] view, out Vector3 obj)
{
unsafe
{
double objX, objY, objZ;
double* objX_ptr = &objX;
double* objY_ptr = &objY;
double* objZ_ptr = &objZ;
fixed (double* model_ptr = model)
fixed (double* proj_ptr = proj)
fixed (Int32* view_ptr = view)
{
Int32 retval = Delegates.gluUnProject((double)win.X, (double)win.Y, (double)win.Z, (double*)model_ptr, (double*)proj_ptr, (Int32*)view_ptr, (double*)objX_ptr, (double*)objY_ptr, (double*)objZ_ptr);
obj = new Vector3((float)*objX_ptr, (float)*objY_ptr, (float)*objZ_ptr);
return retval;
}
}
}
public static Int32 UnProject4(Vector4 win, double[] model, double[] proj, Int32[] view, double near, double far, out Vector4 obj)
{
unsafe
{
double objX, objY, objZ, objW;
double* objX_ptr = &objX;
double* objY_ptr = &objY;
double* objZ_ptr = &objZ;
double* objW_ptr = &objW;
fixed (double* model_ptr = model)
fixed (double* proj_ptr = proj)
fixed (Int32* view_ptr = view)
{
Int32 retval = Delegates.gluUnProject4((double)win.X, (double)win.Y, (double)win.Z, (double)win.W, (double*)model_ptr, (double*)proj_ptr, (Int32*)view_ptr, (double)near, (double)far, (double*)objX_ptr, (double*)objY_ptr, (double*)objZ_ptr, (double*)objW_ptr);
obj = new Vector4((float)*objX_ptr, (float)*objY_ptr, (float)*objZ_ptr, (float)*objW_ptr);
return retval;
}
}
}
public static string ErrorString(ErrorCode error)
{
return ErrorString((GluErrorCode)error);
}
public static void TessWindingRuleProperty(IntPtr tess, TessWinding property)
{
Glu.TessProperty(tess, TessParameter.TessWindingRule, (double)property);
}
#endregion
}
#if false
//public delegate object
public delegate void FastVoidInvokeHandler(object target, object[] paramters);
public delegate object FastInvokeHandler(object target, object[] paramters);
public static class FastInvoker
{
/// <summary>
/// Use this one instead of MethodInfo.Invoke, this way it is 50 times quicker.
///
/// <example>
/// string Filter = "FirstName = 'Ton'"
/// MethodInfo mi = typeof(Person).GetMethod("GetAll");
/// snoei.net.Reflection.FastInvoker.FastInvokeHandler fi = snoei.net.Reflection.FastInvoker.GetMethodInvoker( mi );
// return fi.Invoke( Person, new object[]{Filter} );
/// //Calls Person.GetAll(string Filter);
/// </example>
/// </summary>
/// <param name="methodInfo"></param>
/// <returns></returns>
public static Delegate GetMethodInvoker(MethodInfo methodInfo)
{
DynamicMethod dynamicMethod = new DynamicMethod(string.Empty, methodInfo.ReturnType, new Type[] { typeof(object), typeof(object[]) }, methodInfo.DeclaringType.Module);
ILGenerator il = dynamicMethod.GetILGenerator();
ParameterInfo[] ps = methodInfo.GetParameters();
Type[] paramTypes = new Type[ps.Length];
for (int i = 0; i < paramTypes.Length; i++)
{
if (ps[i].ParameterType.IsByRef)
paramTypes[i] = ps[i].ParameterType.GetElementType();
else
paramTypes[i] = ps[i].ParameterType;
}
LocalBuilder[] locals = new LocalBuilder[paramTypes.Length];
for (int i = 0; i < paramTypes.Length; i++)
locals[i] = il.DeclareLocal(paramTypes[i], true);
for (int i = 0; i < paramTypes.Length; i++)
{
il.Emit(OpCodes.Ldarg_1);
EmitFastInt(il, i);
il.Emit(OpCodes.Ldelem_Ref);
EmitCastToReference(il, paramTypes[i]);
il.Emit(OpCodes.Stloc, locals[i]);
}
if (!methodInfo.IsStatic)
il.Emit(OpCodes.Ldarg_0);
for (int i = 0; i < paramTypes.Length; i++)
{
if (ps[i].ParameterType.IsByRef)
il.Emit(OpCodes.Ldloca_S, locals[i]);
else
il.Emit(OpCodes.Ldloc, locals[i]);
}
if (methodInfo.IsStatic)
il.EmitCall(OpCodes.Call, methodInfo, null);
else
il.EmitCall(OpCodes.Callvirt, methodInfo, null);
if (methodInfo.ReturnType == typeof(void))
il.Emit(OpCodes.Ldnull);
else
EmitBoxIfNeeded(il, methodInfo.ReturnType);
for (int i = 0; i < paramTypes.Length; i++)
{
if (ps[i].ParameterType.IsByRef)
{
il.Emit(OpCodes.Ldarg_1);
EmitFastInt(il, i);
il.Emit(OpCodes.Ldloc, locals[i]);
if (locals[i].LocalType.IsValueType)
il.Emit(OpCodes.Box, locals[i].LocalType);
il.Emit(OpCodes.Stelem_Ref);
}
}
il.Emit(OpCodes.Ret);
if (methodInfo.ReturnType == typeof(void))
return dynamicMethod.CreateDelegate(typeof(FastVoidInvokeHandler));
else
return dynamicMethod.CreateDelegate(typeof(FastInvokeHandler));
}
private static void EmitCastToReference(ILGenerator il, System.Type type)
{
if (type.IsValueType)
il.Emit(OpCodes.Unbox_Any, type);
else
il.Emit(OpCodes.Castclass, type);
}
private static void EmitBoxIfNeeded(ILGenerator il, System.Type type)
{
if (type.IsValueType)
il.Emit(OpCodes.Box, type);
}
private static void EmitFastInt(ILGenerator il, int value)
{
switch (value)
{
case -1:
il.Emit(OpCodes.Ldc_I4_M1);
return;
case 0:
il.Emit(OpCodes.Ldc_I4_0);
return;
case 1:
il.Emit(OpCodes.Ldc_I4_1);
return;
case 2:
il.Emit(OpCodes.Ldc_I4_2);
return;
case 3:
il.Emit(OpCodes.Ldc_I4_3);
return;
case 4:
il.Emit(OpCodes.Ldc_I4_4);
return;
case 5:
il.Emit(OpCodes.Ldc_I4_5);
return;
case 6:
il.Emit(OpCodes.Ldc_I4_6);
return;
case 7:
il.Emit(OpCodes.Ldc_I4_7);
return;
case 8:
il.Emit(OpCodes.Ldc_I4_8);
return;
}
if (value > -129 && value < 128)
il.Emit(OpCodes.Ldc_I4_S, (SByte)value);
else
il.Emit(OpCodes.Ldc_I4, value);
}
}
#endif
}
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* Contributions by Andy Gill.
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Reflection.Emit;
using OpenTK.Platform;
namespace OpenTK.Graphics
{
/// <summary>
/// Provides access to the OpenGL Utilities library.
/// Methods i this library are considered deprecated and should be avoided.
/// </summary>
[Obsolete("Use OpenTK math functions instead.")]
public static partial class Glu
{
private const string Library = "glu32.dll";
private static Dictionary<string, bool> AvailableExtensions = new Dictionary<string, bool>();
private static bool rebuildExtensionList = true;
private static Type importsClass = typeof(Imports);
static Glu()
{
// Glu doesn't have any extensions, so this is safe to call once and be done with it.
LoadAll();
}
#region private static Delegate LoadDelegate(string name, Type signature)
/// <summary>
/// Creates a System.Delegate that can be used to call a GLU function, core or extension.
/// </summary>
/// <param name="name">The name of the GLU function (eg. "gluBuild2DMipmaps")</param>
/// <param name="signature">The signature of the GLU function.</param>
/// <returns>
/// A System.Delegate that can be used to call this GLU function, or null if the specified
/// function name did not correspond to an GLU function.
/// </returns>
private static Delegate LoadDelegate(string name, Type signature)
{
MethodInfo m = importsClass.GetMethod(name.Substring(3), BindingFlags.Static | BindingFlags.NonPublic);
return
GL.GetExtensionDelegate(name, signature) ??
(m != null ? Delegate.CreateDelegate(signature, m) : null);
}
#endregion
#region public static void LoadAll()
/// <summary>
/// Loads all GLU functions (core and extensions).
/// </summary>
/// <remarks>
/// <para>
/// Call this function manually whenever you need to update GLU entry points.
/// This need will never arise under normal usage patterns.
/// </para>
/// </remarks>
public static void LoadAll()
{
int supported = 0;
Type extensions_class = typeof(Glu).GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
if (extensions_class == null)
throw new InvalidOperationException("The specified type does not have any loadable extensions.");
FieldInfo[] delegates = extensions_class.GetFields(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
if (delegates == null)
throw new InvalidOperationException("The specified type does not have any loadable extensions.");
foreach (FieldInfo f in delegates)
{
Delegate d = LoadDelegate(f.Name, f.FieldType);
if (d != null)
++supported;
f.SetValue(null, d);
}
rebuildExtensionList = true;
}
#endregion
#region public static bool Load(string function)
/// <summary>
/// Tries to reload the given GLU function (core or extension).
/// </summary>
/// <param name="function">The name of the GLU function.</param>
/// <returns>True if the function was found and reloaded, false otherwise.</returns>
/// <remarks>
/// <para>
/// While the automatic initialisation will load all GLU entry points, in some cases
/// the initialization can take place before a render context has been established.
/// In this case, use this function to load the entry points for the GLU functions
/// you will need, or use LoadAll() to load all available entry points.
/// </para>
/// <para>
/// This function returns true if the given GLU function is supported, false otherwise.
/// </para>
/// <para>
/// To query for supported extensions use the IsExtensionSupported() function instead.
/// </para>
/// </remarks>
public static bool Load(string function)
{
// Glu does not contain any extensions - this method does nothing.
return true;
}
#endregion
#region public static bool SupportsExtension(string name)
/// <summary>
/// Determines whether the specified GLU extension is available in
/// the current GLU context.
/// </summary>
/// <param name="name">The string for the GLU extension.</param>
/// <returns>True if the specified extension is available, false otherwise.</returns>
public static bool SupportsExtension(string name)
{
if (rebuildExtensionList)
{
BuildExtensionList();
}
// Search the cache for the string. Note that the cache substitutes
// strings "1.0" to "2.1" with "GL_VERSION_1_0" to "GL_VERSION_2_1"
if (AvailableExtensions.ContainsKey(name))
{
return AvailableExtensions[name];
}
return false;
}
#endregion
#region private static void BuildExtensionList()
/// <summary>
/// Builds a cache of the supported extensions to speed up searches.
/// </summary>
private static void BuildExtensionList()
{
// Assumes there is an opengl context current.
AvailableExtensions.Clear();
string version_string = Glu.GetString(GluStringName.Version);
if (String.IsNullOrEmpty(version_string))
{
throw new ApplicationException("Failed to build extension list. Is there an opengl context current?");
}
string version = version_string.Trim(' ');
if (version.StartsWith("1.0"))
{
AvailableExtensions.Add("VERSION_1_0", true);
}
else if (version.StartsWith("1.1"))
{
AvailableExtensions.Add("VERSION_1_0", true);
AvailableExtensions.Add("VERSION_1_1", true);
}
else if (version.StartsWith("1.2"))
{
AvailableExtensions.Add("VERSION_1_0", true);
AvailableExtensions.Add("VERSION_1_1", true);
AvailableExtensions.Add("VERSION_1_2", true);
}
else if (version.StartsWith("1.3"))
{
AvailableExtensions.Add("VERSION_1_0", true);
AvailableExtensions.Add("VERSION_1_1", true);
AvailableExtensions.Add("VERSION_1_2", true);
AvailableExtensions.Add("VERSION_1_3", true);
}
string extension_string = Glu.GetString(GluStringName.Extensions);
if (String.IsNullOrEmpty(extension_string))
{ // no extensions are available
return;
}
string[] extensions = extension_string.Split(' ');
foreach (string ext in extensions)
{
AvailableExtensions.Add(ext, true);
}
rebuildExtensionList = false;
}
#endregion
#region Overloads
public static void LookAt(Vector3 eye, Vector3 center, Vector3 up)
{
Delegates.gluLookAt((double)eye.X, (double)eye.Y, (double)eye.Z, (double)center.X, (double)center.Y, (double)center.Z, (double)up.X, (double)up.Y, (double)up.Z);
}
// One token Project overload, I picked this one because it's CLS compliant, and it
// makes reasonably clear which args are inputs and which are outputs.
public static Int32 Project(Vector3 obj, double[] model, double[] proj, Int32[] view, out Vector3 win)
{
unsafe
{
double winX, winY, winZ;
double* winX_ptr = &winX;
double* winY_ptr = &winY;
double* winZ_ptr = &winZ;
fixed (double* model_ptr = model)
fixed (double* proj_ptr = proj)
fixed (Int32* view_ptr = view)
{
Int32 retval = Delegates.gluProject((double)obj.X, (double)obj.Y, (double)obj.Z, (double*)model_ptr, (double*)proj_ptr, (Int32*)view_ptr, (double*)winX_ptr, (double*)winY_ptr, (double*)winZ_ptr);
win = new Vector3((float)*winX_ptr, (float)*winY_ptr, (float)*winZ_ptr);
return retval;
}
}
}
public static void TessNormal(IntPtr tess, Vector3 normal)
{
Delegates.gluTessNormal(tess, (double)normal.X, (double)normal.Y, (double)normal.Z);
}
public static Int32 UnProject(Vector3 win, double[] model, double[] proj, Int32[] view, out Vector3 obj)
{
unsafe
{
double objX, objY, objZ;
double* objX_ptr = &objX;
double* objY_ptr = &objY;
double* objZ_ptr = &objZ;
fixed (double* model_ptr = model)
fixed (double* proj_ptr = proj)
fixed (Int32* view_ptr = view)
{
Int32 retval = Delegates.gluUnProject((double)win.X, (double)win.Y, (double)win.Z, (double*)model_ptr, (double*)proj_ptr, (Int32*)view_ptr, (double*)objX_ptr, (double*)objY_ptr, (double*)objZ_ptr);
obj = new Vector3((float)*objX_ptr, (float)*objY_ptr, (float)*objZ_ptr);
return retval;
}
}
}
public static Int32 UnProject4(Vector4 win, double[] model, double[] proj, Int32[] view, double near, double far, out Vector4 obj)
{
unsafe
{
double objX, objY, objZ, objW;
double* objX_ptr = &objX;
double* objY_ptr = &objY;
double* objZ_ptr = &objZ;
double* objW_ptr = &objW;
fixed (double* model_ptr = model)
fixed (double* proj_ptr = proj)
fixed (Int32* view_ptr = view)
{
Int32 retval = Delegates.gluUnProject4((double)win.X, (double)win.Y, (double)win.Z, (double)win.W, (double*)model_ptr, (double*)proj_ptr, (Int32*)view_ptr, (double)near, (double)far, (double*)objX_ptr, (double*)objY_ptr, (double*)objZ_ptr, (double*)objW_ptr);
obj = new Vector4((float)*objX_ptr, (float)*objY_ptr, (float)*objZ_ptr, (float)*objW_ptr);
return retval;
}
}
}
public static string ErrorString(ErrorCode error)
{
return ErrorString((GluErrorCode)error);
}
public static void TessWindingRuleProperty(IntPtr tess, TessWinding property)
{
Glu.TessProperty(tess, TessParameter.TessWindingRule, (double)property);
}
#endregion
}
#if false
//public delegate object
public delegate void FastVoidInvokeHandler(object target, object[] paramters);
public delegate object FastInvokeHandler(object target, object[] paramters);
public static class FastInvoker
{
/// <summary>
/// Use this one instead of MethodInfo.Invoke, this way it is 50 times quicker.
///
/// <example>
/// string Filter = "FirstName = 'Ton'"
/// MethodInfo mi = typeof(Person).GetMethod("GetAll");
/// snoei.net.Reflection.FastInvoker.FastInvokeHandler fi = snoei.net.Reflection.FastInvoker.GetMethodInvoker( mi );
// return fi.Invoke( Person, new object[]{Filter} );
/// //Calls Person.GetAll(string Filter);
/// </example>
/// </summary>
/// <param name="methodInfo"></param>
/// <returns></returns>
public static Delegate GetMethodInvoker(MethodInfo methodInfo)
{
DynamicMethod dynamicMethod = new DynamicMethod(string.Empty, methodInfo.ReturnType, new Type[] { typeof(object), typeof(object[]) }, methodInfo.DeclaringType.Module);
ILGenerator il = dynamicMethod.GetILGenerator();
ParameterInfo[] ps = methodInfo.GetParameters();
Type[] paramTypes = new Type[ps.Length];
for (int i = 0; i < paramTypes.Length; i++)
{
if (ps[i].ParameterType.IsByRef)
paramTypes[i] = ps[i].ParameterType.GetElementType();
else
paramTypes[i] = ps[i].ParameterType;
}
LocalBuilder[] locals = new LocalBuilder[paramTypes.Length];
for (int i = 0; i < paramTypes.Length; i++)
locals[i] = il.DeclareLocal(paramTypes[i], true);
for (int i = 0; i < paramTypes.Length; i++)
{
il.Emit(OpCodes.Ldarg_1);
EmitFastInt(il, i);
il.Emit(OpCodes.Ldelem_Ref);
EmitCastToReference(il, paramTypes[i]);
il.Emit(OpCodes.Stloc, locals[i]);
}
if (!methodInfo.IsStatic)
il.Emit(OpCodes.Ldarg_0);
for (int i = 0; i < paramTypes.Length; i++)
{
if (ps[i].ParameterType.IsByRef)
il.Emit(OpCodes.Ldloca_S, locals[i]);
else
il.Emit(OpCodes.Ldloc, locals[i]);
}
if (methodInfo.IsStatic)
il.EmitCall(OpCodes.Call, methodInfo, null);
else
il.EmitCall(OpCodes.Callvirt, methodInfo, null);
if (methodInfo.ReturnType == typeof(void))
il.Emit(OpCodes.Ldnull);
else
EmitBoxIfNeeded(il, methodInfo.ReturnType);
for (int i = 0; i < paramTypes.Length; i++)
{
if (ps[i].ParameterType.IsByRef)
{
il.Emit(OpCodes.Ldarg_1);
EmitFastInt(il, i);
il.Emit(OpCodes.Ldloc, locals[i]);
if (locals[i].LocalType.IsValueType)
il.Emit(OpCodes.Box, locals[i].LocalType);
il.Emit(OpCodes.Stelem_Ref);
}
}
il.Emit(OpCodes.Ret);
if (methodInfo.ReturnType == typeof(void))
return dynamicMethod.CreateDelegate(typeof(FastVoidInvokeHandler));
else
return dynamicMethod.CreateDelegate(typeof(FastInvokeHandler));
}
private static void EmitCastToReference(ILGenerator il, System.Type type)
{
if (type.IsValueType)
il.Emit(OpCodes.Unbox_Any, type);
else
il.Emit(OpCodes.Castclass, type);
}
private static void EmitBoxIfNeeded(ILGenerator il, System.Type type)
{
if (type.IsValueType)
il.Emit(OpCodes.Box, type);
}
private static void EmitFastInt(ILGenerator il, int value)
{
switch (value)
{
case -1:
il.Emit(OpCodes.Ldc_I4_M1);
return;
case 0:
il.Emit(OpCodes.Ldc_I4_0);
return;
case 1:
il.Emit(OpCodes.Ldc_I4_1);
return;
case 2:
il.Emit(OpCodes.Ldc_I4_2);
return;
case 3:
il.Emit(OpCodes.Ldc_I4_3);
return;
case 4:
il.Emit(OpCodes.Ldc_I4_4);
return;
case 5:
il.Emit(OpCodes.Ldc_I4_5);
return;
case 6:
il.Emit(OpCodes.Ldc_I4_6);
return;
case 7:
il.Emit(OpCodes.Ldc_I4_7);
return;
case 8:
il.Emit(OpCodes.Ldc_I4_8);
return;
}
if (value > -129 && value < 128)
il.Emit(OpCodes.Ldc_I4_S, (SByte)value);
else
il.Emit(OpCodes.Ldc_I4, value);
}
}
#endif
}

View file

@ -1,22 +1,22 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
/// <summary>
/// Represents an item that can be packed with the TexturePacker.
/// </summary>
/// <typeparam name="T">The type of the packable item.</typeparam>
interface IPackable<T> : IEquatable<T>
{
int Width { get; }
int Height { get; }
}
}
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
/// <summary>
/// Represents an item that can be packed with the TexturePacker.
/// </summary>
/// <typeparam name="T">The type of the packable item.</typeparam>
interface IPackable<T> : IEquatable<T>
{
int Width { get; }
int Height { get; }
}
}

View file

@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
interface IPoolable : IDisposable
{
void OnAcquire();
void OnRelease();
}
interface IPoolable<T> : IPoolable where T : IPoolable<T>, new()
{
ObjectPool<T> Owner { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
interface IPoolable : IDisposable
{
void OnAcquire();
void OnRelease();
}
interface IPoolable<T> : IPoolable where T : IPoolable<T>, new()
{
ObjectPool<T> Owner { get; set; }
}
}

View file

@ -1,42 +1,42 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
class ObjectPool<T> where T : IPoolable<T>, new()
{
Queue<T> pool = new Queue<T>();
public ObjectPool()
{ }
public T Acquire()
{
T item;
if (pool.Count > 0)
{
item = pool.Dequeue();
item.OnAcquire();
}
else
{
item = new T();
item.Owner = this;
item.OnAcquire();
}
return item;
}
public void Release(T item)
{
if (item == null)
throw new ArgumentNullException("item");
item.OnRelease();
pool.Enqueue(item);
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
class ObjectPool<T> where T : IPoolable<T>, new()
{
Queue<T> pool = new Queue<T>();
public ObjectPool()
{ }
public T Acquire()
{
T item;
if (pool.Count > 0)
{
item = pool.Dequeue();
item.OnAcquire();
}
else
{
item = new T();
item.Owner = this;
item.OnAcquire();
}
return item;
}
public void Release(T item)
{
if (item == null)
throw new ArgumentNullException("item");
item.OnRelease();
pool.Enqueue(item);
}
}
}

View file

@ -1,35 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("The Open Toolkit Compatilibity library")]
[assembly: AssemblyDescription("Provides compatibility with previous versions of OpenTK")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Open Toolkit Library")]
[assembly: AssemblyProduct("The Open Toolkit Library")]
[assembly: AssemblyCopyright("Copyright © 2006-2009 the Open Toolkit team")]
[assembly: AssemblyTrademark("OpenTK")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7c495044-4b1a-4bff-aee9-ff9dbf85433f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.9.9.2")]
[assembly: AssemblyFileVersion("0.9.9.2")]
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("The Open Toolkit Compatilibity library")]
[assembly: AssemblyDescription("Provides compatibility with previous versions of OpenTK")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("The Open Toolkit Library")]
[assembly: AssemblyProduct("The Open Toolkit Library")]
[assembly: AssemblyCopyright("Copyright © 2006-2009 the Open Toolkit team")]
[assembly: AssemblyTrademark("OpenTK")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7c495044-4b1a-4bff-aee9-ff9dbf85433f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.9.9.2")]
[assembly: AssemblyFileVersion("0.9.9.2")]
[assembly: System.CLSCompliant(true)]

View file

@ -1,70 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4918
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.Compatibility.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenTK.Compatibility.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
internal static System.Drawing.Bitmap TaoButton {
get {
object obj = ResourceManager.GetObject("TaoButton", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4918
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.Compatibility.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenTK.Compatibility.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
internal static System.Drawing.Bitmap TaoButton {
get {
object obj = ResourceManager.GetObject("TaoButton", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View file

@ -1,248 +1,248 @@
#region License
/*
MIT License
Copyright ©2003-2006 Tao Framework Team
http://www.taoframework.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion License
namespace Tao.OpenAl
{
using System;
using System.Runtime.InteropServices;
[Obsolete]
internal static class Delegates
{
static Delegates()
{
}
/// <summary>
/// Creates a System.Delegate that can be used to call a dynamically exported OpenAL function.
/// </summary>
/// <param name="name">The function string for the OpenAL function</param>
/// <param name="signature">The signature of the OpenAL function.</param>
/// <returns>
/// A System.Delegate that can be used to call this OpenAL function or null
/// if the function is not available in the current OpenAL context.
/// </returns>
public static Delegate GetDelegateForExtensionMethod(string name, Type signature)
{
IntPtr address = Al.alGetProcAddress(name);
if (address == IntPtr.Zero)
{
return null;
}
else
{
return Marshal.GetDelegateForFunctionPointer(address, signature);
}
}
#region X-RAM
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void EAXSetBufferModeDelegate(int n, [Out] int* buffers, int value);
internal static EAXSetBufferModeDelegate EAXSetBufferMode = (EAXSetBufferModeDelegate)GetDelegateForExtensionMethod("EAXSetBufferMode", typeof(EAXSetBufferModeDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EAXGetBufferModeDelegate(int buffer, [Out] int* reserved);
internal static EAXGetBufferModeDelegate EAXGetBufferMode = (EAXGetBufferModeDelegate)GetDelegateForExtensionMethod("EAXGetBufferMode", typeof(EAXGetBufferModeDelegate));
#endregion
#region EFX_EXT
#region alEffect
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGenEffectsDelegate(int size, [Out] int* effects);
internal static alGenEffectsDelegate alGenEffects = (alGenEffectsDelegate)GetDelegateForExtensionMethod("alGenEffects", typeof(alGenEffectsDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alDeleteEffectsDelegate(int size, int* effects);
internal static alDeleteEffectsDelegate alDeleteEffects = (alDeleteEffectsDelegate)GetDelegateForExtensionMethod("alDeleteEffects", typeof(alDeleteEffectsDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate bool alIsEffectDelegate(int effect);
internal static alIsEffectDelegate alIsEffect = (alIsEffectDelegate)GetDelegateForExtensionMethod("alIsEffect", typeof(alIsEffectDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alEffectiDelegate(int effect, int param, int value);
internal static alEffectiDelegate alEffecti = (alEffectiDelegate)GetDelegateForExtensionMethod("alEffecti", typeof(alEffectiDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alEffectivDelegate(int effect, int param, int* value);
internal static alEffectivDelegate alEffectiv = (alEffectivDelegate)GetDelegateForExtensionMethod("alEffectiv", typeof(alEffectivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alEffectfDelegate(int effect, int param, float value);
internal static alEffectfDelegate alEffectf = (alEffectfDelegate)GetDelegateForExtensionMethod("alEffectf", typeof(alEffectfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alEffectfvDelegate(int effect, int param, float* value);
internal static alEffectfvDelegate alEffectfv = (alEffectfvDelegate)GetDelegateForExtensionMethod("alEffectfv", typeof(alEffectfvDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetEffectiDelegate(int effect, int param, [Out] int* value);
internal static alGetEffectiDelegate alGetEffecti = (alGetEffectiDelegate)GetDelegateForExtensionMethod("alGetEffecti", typeof(alGetEffectiDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetEffectivDelegate(int effect, int param, [Out] int* value);
internal static alGetEffectivDelegate alGetEffectiv = (alGetEffectivDelegate)GetDelegateForExtensionMethod("alGetEffectiv", typeof(alGetEffectivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetEffectfDelegate(int effect, int param, [Out] float* value);
internal static alGetEffectfDelegate alGetEffectf = (alGetEffectfDelegate)GetDelegateForExtensionMethod("alGetEffectf", typeof(alGetEffectfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetEffectfvDelegate(int effect, int param, [Out] float* value);
internal static alGetEffectfvDelegate alGetEffectfv = (alGetEffectfvDelegate)GetDelegateForExtensionMethod("alGetEffectfv", typeof(alGetEffectfvDelegate));
#endregion
#region alFilter
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGenFiltersDelegate(int size, [Out] int* Filters);
internal static alGenFiltersDelegate alGenFilters = (alGenFiltersDelegate)GetDelegateForExtensionMethod("alGenFilters", typeof(alGenFiltersDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alDeleteFiltersDelegate(int size, int* Filters);
internal static alDeleteFiltersDelegate alDeleteFilters = (alDeleteFiltersDelegate)GetDelegateForExtensionMethod("alDeleteFilters", typeof(alDeleteFiltersDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate bool alIsFilterDelegate(int Filter);
internal static alIsFilterDelegate alIsFilter = (alIsFilterDelegate)GetDelegateForExtensionMethod("alIsFilter", typeof(alIsFilterDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alFilteriDelegate(int Filter, int param, int value);
internal static alFilteriDelegate alFilteri = (alFilteriDelegate)GetDelegateForExtensionMethod("alFilteri", typeof(alFilteriDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alFilterivDelegate(int Filter, int param, int* value);
internal static alFilterivDelegate alFilteriv = (alFilterivDelegate)GetDelegateForExtensionMethod("alFilteriv", typeof(alFilterivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alFilterfDelegate(int Filter, int param, float value);
internal static alFilterfDelegate alFilterf = (alFilterfDelegate)GetDelegateForExtensionMethod("alFilterf", typeof(alFilterfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alFilterfvDelegate(int Filter, int param, float* value);
internal static alFilterfvDelegate alFilterfv = (alFilterfvDelegate)GetDelegateForExtensionMethod("alFilterfv", typeof(alFilterfvDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetFilteriDelegate(int Filter, int param, [Out] int* value);
internal static alGetFilteriDelegate alGetFilteri = (alGetFilteriDelegate)GetDelegateForExtensionMethod("alGetFilteri", typeof(alGetFilteriDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetFilterivDelegate(int Filter, int param, [Out] int* value);
internal static alGetFilterivDelegate alGetFilteriv = (alGetFilterivDelegate)GetDelegateForExtensionMethod("alGetFilteriv", typeof(alGetFilterivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetFilterfDelegate(int Filter, int param, [Out] float* value);
internal static alGetFilterfDelegate alGetFilterf = (alGetFilterfDelegate)GetDelegateForExtensionMethod("alGetFilterf", typeof(alGetFilterfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetFilterfvDelegate(int Filter, int param, [Out] float* value);
internal static alGetFilterfvDelegate alGetFilterfv = (alGetFilterfvDelegate)GetDelegateForExtensionMethod("alGetFilterfv", typeof(alGetFilterfvDelegate));
#endregion
#region alFilter
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGenAuxiliaryEffectSlotsDelegate(int size, [Out] int* AuxiliaryEffectSlots);
internal static alGenAuxiliaryEffectSlotsDelegate alGenAuxiliaryEffectSlots = (alGenAuxiliaryEffectSlotsDelegate)GetDelegateForExtensionMethod("alGenAuxiliaryEffectSlots", typeof(alGenAuxiliaryEffectSlotsDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alDeleteAuxiliaryEffectSlotsDelegate(int size, int* AuxiliaryEffectSlots);
internal static alDeleteAuxiliaryEffectSlotsDelegate alDeleteAuxiliaryEffectSlots = (alDeleteAuxiliaryEffectSlotsDelegate)GetDelegateForExtensionMethod("alDeleteAuxiliaryEffectSlots", typeof(alDeleteAuxiliaryEffectSlotsDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate bool alIsAuxiliaryEffectSlotDelegate(int AuxiliaryEffectSlot);
internal static alIsAuxiliaryEffectSlotDelegate alIsAuxiliaryEffectSlot = (alIsAuxiliaryEffectSlotDelegate)GetDelegateForExtensionMethod("alIsAuxiliaryEffectSlot", typeof(alIsAuxiliaryEffectSlotDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alAuxiliaryEffectSlotiDelegate(int AuxiliaryEffectSlot, int param, int value);
internal static alAuxiliaryEffectSlotiDelegate alAuxiliaryEffectSloti = (alAuxiliaryEffectSlotiDelegate)GetDelegateForExtensionMethod("alAuxiliaryEffectSloti", typeof(alAuxiliaryEffectSlotiDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alAuxiliaryEffectSlotivDelegate(int AuxiliaryEffectSlot, int param, int* value);
internal static alAuxiliaryEffectSlotivDelegate alAuxiliaryEffectSlotiv = (alAuxiliaryEffectSlotivDelegate)GetDelegateForExtensionMethod("alAuxiliaryEffectSlotiv", typeof(alAuxiliaryEffectSlotivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alAuxiliaryEffectSlotfDelegate(int AuxiliaryEffectSlot, int param, float value);
internal static alAuxiliaryEffectSlotfDelegate alAuxiliaryEffectSlotf = (alAuxiliaryEffectSlotfDelegate)GetDelegateForExtensionMethod("alAuxiliaryEffectSlotf", typeof(alAuxiliaryEffectSlotfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alAuxiliaryEffectSlotfvDelegate(int AuxiliaryEffectSlot, int param, float* value);
internal static alAuxiliaryEffectSlotfvDelegate alAuxiliaryEffectSlotfv = (alAuxiliaryEffectSlotfvDelegate)GetDelegateForExtensionMethod("alAuxiliaryEffectSlotfv", typeof(alAuxiliaryEffectSlotfvDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetAuxiliaryEffectSlotiDelegate(int AuxiliaryEffectSlot, int param, [Out] int* value);
internal static alGetAuxiliaryEffectSlotiDelegate alGetAuxiliaryEffectSloti = (alGetAuxiliaryEffectSlotiDelegate)GetDelegateForExtensionMethod("alGetAuxiliaryEffectSloti", typeof(alGetAuxiliaryEffectSlotiDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetAuxiliaryEffectSlotivDelegate(int AuxiliaryEffectSlot, int param, [Out] int* value);
internal static alGetAuxiliaryEffectSlotivDelegate alGetAuxiliaryEffectSlotiv = (alGetAuxiliaryEffectSlotivDelegate)GetDelegateForExtensionMethod("alGetAuxiliaryEffectSlotiv", typeof(alGetAuxiliaryEffectSlotivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetAuxiliaryEffectSlotfDelegate(int AuxiliaryEffectSlot, int param, [Out] float* value);
internal static alGetAuxiliaryEffectSlotfDelegate alGetAuxiliaryEffectSlotf = (alGetAuxiliaryEffectSlotfDelegate)GetDelegateForExtensionMethod("alGetAuxiliaryEffectSlotf", typeof(alGetAuxiliaryEffectSlotfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetAuxiliaryEffectSlotfvDelegate(int AuxiliaryEffectSlot, int param, [Out] float* value);
internal static alGetAuxiliaryEffectSlotfvDelegate alGetAuxiliaryEffectSlotfv = (alGetAuxiliaryEffectSlotfvDelegate)GetDelegateForExtensionMethod("alGetAuxiliaryEffectSlotfv", typeof(alGetAuxiliaryEffectSlotfvDelegate));
#endregion
#endregion
}
}
#region License
/*
MIT License
Copyright ©2003-2006 Tao Framework Team
http://www.taoframework.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion License
namespace Tao.OpenAl
{
using System;
using System.Runtime.InteropServices;
[Obsolete]
internal static class Delegates
{
static Delegates()
{
}
/// <summary>
/// Creates a System.Delegate that can be used to call a dynamically exported OpenAL function.
/// </summary>
/// <param name="name">The function string for the OpenAL function</param>
/// <param name="signature">The signature of the OpenAL function.</param>
/// <returns>
/// A System.Delegate that can be used to call this OpenAL function or null
/// if the function is not available in the current OpenAL context.
/// </returns>
public static Delegate GetDelegateForExtensionMethod(string name, Type signature)
{
IntPtr address = Al.alGetProcAddress(name);
if (address == IntPtr.Zero)
{
return null;
}
else
{
return Marshal.GetDelegateForFunctionPointer(address, signature);
}
}
#region X-RAM
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void EAXSetBufferModeDelegate(int n, [Out] int* buffers, int value);
internal static EAXSetBufferModeDelegate EAXSetBufferMode = (EAXSetBufferModeDelegate)GetDelegateForExtensionMethod("EAXSetBufferMode", typeof(EAXSetBufferModeDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EAXGetBufferModeDelegate(int buffer, [Out] int* reserved);
internal static EAXGetBufferModeDelegate EAXGetBufferMode = (EAXGetBufferModeDelegate)GetDelegateForExtensionMethod("EAXGetBufferMode", typeof(EAXGetBufferModeDelegate));
#endregion
#region EFX_EXT
#region alEffect
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGenEffectsDelegate(int size, [Out] int* effects);
internal static alGenEffectsDelegate alGenEffects = (alGenEffectsDelegate)GetDelegateForExtensionMethod("alGenEffects", typeof(alGenEffectsDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alDeleteEffectsDelegate(int size, int* effects);
internal static alDeleteEffectsDelegate alDeleteEffects = (alDeleteEffectsDelegate)GetDelegateForExtensionMethod("alDeleteEffects", typeof(alDeleteEffectsDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate bool alIsEffectDelegate(int effect);
internal static alIsEffectDelegate alIsEffect = (alIsEffectDelegate)GetDelegateForExtensionMethod("alIsEffect", typeof(alIsEffectDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alEffectiDelegate(int effect, int param, int value);
internal static alEffectiDelegate alEffecti = (alEffectiDelegate)GetDelegateForExtensionMethod("alEffecti", typeof(alEffectiDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alEffectivDelegate(int effect, int param, int* value);
internal static alEffectivDelegate alEffectiv = (alEffectivDelegate)GetDelegateForExtensionMethod("alEffectiv", typeof(alEffectivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alEffectfDelegate(int effect, int param, float value);
internal static alEffectfDelegate alEffectf = (alEffectfDelegate)GetDelegateForExtensionMethod("alEffectf", typeof(alEffectfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alEffectfvDelegate(int effect, int param, float* value);
internal static alEffectfvDelegate alEffectfv = (alEffectfvDelegate)GetDelegateForExtensionMethod("alEffectfv", typeof(alEffectfvDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetEffectiDelegate(int effect, int param, [Out] int* value);
internal static alGetEffectiDelegate alGetEffecti = (alGetEffectiDelegate)GetDelegateForExtensionMethod("alGetEffecti", typeof(alGetEffectiDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetEffectivDelegate(int effect, int param, [Out] int* value);
internal static alGetEffectivDelegate alGetEffectiv = (alGetEffectivDelegate)GetDelegateForExtensionMethod("alGetEffectiv", typeof(alGetEffectivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetEffectfDelegate(int effect, int param, [Out] float* value);
internal static alGetEffectfDelegate alGetEffectf = (alGetEffectfDelegate)GetDelegateForExtensionMethod("alGetEffectf", typeof(alGetEffectfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetEffectfvDelegate(int effect, int param, [Out] float* value);
internal static alGetEffectfvDelegate alGetEffectfv = (alGetEffectfvDelegate)GetDelegateForExtensionMethod("alGetEffectfv", typeof(alGetEffectfvDelegate));
#endregion
#region alFilter
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGenFiltersDelegate(int size, [Out] int* Filters);
internal static alGenFiltersDelegate alGenFilters = (alGenFiltersDelegate)GetDelegateForExtensionMethod("alGenFilters", typeof(alGenFiltersDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alDeleteFiltersDelegate(int size, int* Filters);
internal static alDeleteFiltersDelegate alDeleteFilters = (alDeleteFiltersDelegate)GetDelegateForExtensionMethod("alDeleteFilters", typeof(alDeleteFiltersDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate bool alIsFilterDelegate(int Filter);
internal static alIsFilterDelegate alIsFilter = (alIsFilterDelegate)GetDelegateForExtensionMethod("alIsFilter", typeof(alIsFilterDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alFilteriDelegate(int Filter, int param, int value);
internal static alFilteriDelegate alFilteri = (alFilteriDelegate)GetDelegateForExtensionMethod("alFilteri", typeof(alFilteriDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alFilterivDelegate(int Filter, int param, int* value);
internal static alFilterivDelegate alFilteriv = (alFilterivDelegate)GetDelegateForExtensionMethod("alFilteriv", typeof(alFilterivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alFilterfDelegate(int Filter, int param, float value);
internal static alFilterfDelegate alFilterf = (alFilterfDelegate)GetDelegateForExtensionMethod("alFilterf", typeof(alFilterfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alFilterfvDelegate(int Filter, int param, float* value);
internal static alFilterfvDelegate alFilterfv = (alFilterfvDelegate)GetDelegateForExtensionMethod("alFilterfv", typeof(alFilterfvDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetFilteriDelegate(int Filter, int param, [Out] int* value);
internal static alGetFilteriDelegate alGetFilteri = (alGetFilteriDelegate)GetDelegateForExtensionMethod("alGetFilteri", typeof(alGetFilteriDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetFilterivDelegate(int Filter, int param, [Out] int* value);
internal static alGetFilterivDelegate alGetFilteriv = (alGetFilterivDelegate)GetDelegateForExtensionMethod("alGetFilteriv", typeof(alGetFilterivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetFilterfDelegate(int Filter, int param, [Out] float* value);
internal static alGetFilterfDelegate alGetFilterf = (alGetFilterfDelegate)GetDelegateForExtensionMethod("alGetFilterf", typeof(alGetFilterfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetFilterfvDelegate(int Filter, int param, [Out] float* value);
internal static alGetFilterfvDelegate alGetFilterfv = (alGetFilterfvDelegate)GetDelegateForExtensionMethod("alGetFilterfv", typeof(alGetFilterfvDelegate));
#endregion
#region alFilter
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGenAuxiliaryEffectSlotsDelegate(int size, [Out] int* AuxiliaryEffectSlots);
internal static alGenAuxiliaryEffectSlotsDelegate alGenAuxiliaryEffectSlots = (alGenAuxiliaryEffectSlotsDelegate)GetDelegateForExtensionMethod("alGenAuxiliaryEffectSlots", typeof(alGenAuxiliaryEffectSlotsDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alDeleteAuxiliaryEffectSlotsDelegate(int size, int* AuxiliaryEffectSlots);
internal static alDeleteAuxiliaryEffectSlotsDelegate alDeleteAuxiliaryEffectSlots = (alDeleteAuxiliaryEffectSlotsDelegate)GetDelegateForExtensionMethod("alDeleteAuxiliaryEffectSlots", typeof(alDeleteAuxiliaryEffectSlotsDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate bool alIsAuxiliaryEffectSlotDelegate(int AuxiliaryEffectSlot);
internal static alIsAuxiliaryEffectSlotDelegate alIsAuxiliaryEffectSlot = (alIsAuxiliaryEffectSlotDelegate)GetDelegateForExtensionMethod("alIsAuxiliaryEffectSlot", typeof(alIsAuxiliaryEffectSlotDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alAuxiliaryEffectSlotiDelegate(int AuxiliaryEffectSlot, int param, int value);
internal static alAuxiliaryEffectSlotiDelegate alAuxiliaryEffectSloti = (alAuxiliaryEffectSlotiDelegate)GetDelegateForExtensionMethod("alAuxiliaryEffectSloti", typeof(alAuxiliaryEffectSlotiDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alAuxiliaryEffectSlotivDelegate(int AuxiliaryEffectSlot, int param, int* value);
internal static alAuxiliaryEffectSlotivDelegate alAuxiliaryEffectSlotiv = (alAuxiliaryEffectSlotivDelegate)GetDelegateForExtensionMethod("alAuxiliaryEffectSlotiv", typeof(alAuxiliaryEffectSlotivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void alAuxiliaryEffectSlotfDelegate(int AuxiliaryEffectSlot, int param, float value);
internal static alAuxiliaryEffectSlotfDelegate alAuxiliaryEffectSlotf = (alAuxiliaryEffectSlotfDelegate)GetDelegateForExtensionMethod("alAuxiliaryEffectSlotf", typeof(alAuxiliaryEffectSlotfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alAuxiliaryEffectSlotfvDelegate(int AuxiliaryEffectSlot, int param, float* value);
internal static alAuxiliaryEffectSlotfvDelegate alAuxiliaryEffectSlotfv = (alAuxiliaryEffectSlotfvDelegate)GetDelegateForExtensionMethod("alAuxiliaryEffectSlotfv", typeof(alAuxiliaryEffectSlotfvDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetAuxiliaryEffectSlotiDelegate(int AuxiliaryEffectSlot, int param, [Out] int* value);
internal static alGetAuxiliaryEffectSlotiDelegate alGetAuxiliaryEffectSloti = (alGetAuxiliaryEffectSlotiDelegate)GetDelegateForExtensionMethod("alGetAuxiliaryEffectSloti", typeof(alGetAuxiliaryEffectSlotiDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetAuxiliaryEffectSlotivDelegate(int AuxiliaryEffectSlot, int param, [Out] int* value);
internal static alGetAuxiliaryEffectSlotivDelegate alGetAuxiliaryEffectSlotiv = (alGetAuxiliaryEffectSlotivDelegate)GetDelegateForExtensionMethod("alGetAuxiliaryEffectSlotiv", typeof(alGetAuxiliaryEffectSlotivDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetAuxiliaryEffectSlotfDelegate(int AuxiliaryEffectSlot, int param, [Out] float* value);
internal static alGetAuxiliaryEffectSlotfDelegate alGetAuxiliaryEffectSlotf = (alGetAuxiliaryEffectSlotfDelegate)GetDelegateForExtensionMethod("alGetAuxiliaryEffectSlotf", typeof(alGetAuxiliaryEffectSlotfDelegate));
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void alGetAuxiliaryEffectSlotfvDelegate(int AuxiliaryEffectSlot, int param, [Out] float* value);
internal static alGetAuxiliaryEffectSlotfvDelegate alGetAuxiliaryEffectSlotfv = (alGetAuxiliaryEffectSlotfvDelegate)GetDelegateForExtensionMethod("alGetAuxiliaryEffectSlotfv", typeof(alGetAuxiliaryEffectSlotfvDelegate));
#endregion
#endregion
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,45 +1,45 @@
namespace Tao.Platform.Windows
{
partial class SimpleOpenGlControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// NewGLControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.Name = "NewGLControl";
this.ResumeLayout(false);
}
#endregion
}
}
namespace Tao.Platform.Windows
{
partial class SimpleOpenGlControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// NewGLControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.Name = "NewGLControl";
this.ResumeLayout(false);
}
#endregion
}
}

View file

@ -1,444 +1,444 @@
#region License
/*
MIT License
Copyright ©2003-2006 Tao Framework Team
http://www.taoframework.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion License
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using OpenTK.Graphics.OpenGL;
namespace Tao.Platform.Windows
{
/// <summary>
/// Provides a simple OpenGL control allowing quick development of Windows.Forms-based
/// OpenGL applications. Relies on OpenTK.GLControl for cross-platform compatibility.
/// </summary>
[Obsolete("Use OpenTK.GLControl instead.")]
public partial class SimpleOpenGlControl : OpenTK.GLControl
{
#region Fields
private bool autoCheckErrors = false; // Should we provide glGetError()?
private bool autoFinish = false; // Should we provide a glFinish()?
private bool autoMakeCurrent = true; // Should we automatically make the rendering context current?
private bool autoSwapBuffers = true; // Should we automatically swap buffers?
private byte accumBits = 0; // Accumulation buffer bits
private byte colorBits = 32; // Color buffer bits
private byte depthBits = 16; // Depth buffer bits
private byte stencilBits = 0; // Stencil buffer bits
private ErrorCode errorCode = ErrorCode.NoError; // The GL error code
private int logScaleX = 96; // DPI Resolution in X dir
private int logScaleY = 96; // DPI Resolution in Y dir
#endregion
#region Constructors
#region SimpleOpenGlControl()
/// <summary>
/// Constructor. Creates contexts and sets properties.
/// </summary>
public SimpleOpenGlControl()
{
InitializeStyles();
InitializeComponent();
InitializeBackground();
}
#endregion SimpleOpenGlControl()
#endregion
#region Public Members
#region DestroyContexts()
/// <summary>
///
/// </summary>
public void DestroyContexts()
{
Context.Dispose();
}
#endregion DestroyContexts()
#region Draw()
/// <summary>
/// Sends an see cref="UserControl.Invalidate" command to this control, thus
/// forcing a redraw to occur.
/// </summary>
public void Draw()
{
this.Invalidate();
}
#endregion Draw()
#region InitializeContexts()
/// <summary>
/// Creates the OpenGL contexts.
/// </summary>
public void InitializeContexts()
{
// No need to do anything, handled by the GLControl.
}
#endregion InitializeContexts()
#region LogScaleX
/// <summary>
/// Gets the number of logical pixels or dots per inch (dpi) in X-direction
/// </summary>
[Category("OpenGL Properties"), Description("Logical pixels per inch in X-direction.")]
public int LogScaleX
{
get
{
return logScaleX;
}
}
#endregion
#region LogScaleY
/// <summary>
/// Gets the number of logical pixels or dots per inch (dpi) in Y-direction
/// </summary>
[Category("OpenGL Properties"), Description("Logical pixels per inch in Y-direction.")]
public int LogScaleY
{
get
{
return logScaleY;
}
}
#endregion
#region AccumBits
/// <summary>
/// Gets and sets the OpenGL control's accumulation buffer depth.
/// </summary>
[Category("OpenGL Properties"), Description("Accumulation buffer depth in bits.")]
public byte AccumBits
{
get
{
return accumBits;
}
set
{
accumBits = value;
}
}
#endregion
#region ColorBits
/// <summary>
/// Gets and sets the OpenGL control's color buffer depth.
/// </summary>
[Category("OpenGL Properties"), Description("Color buffer depth in bits.")]
public byte ColorBits
{
get
{
return colorBits;
}
set
{
colorBits = value;
}
}
#endregion
#region DepthBits
/// <summary>
/// Gets and sets the OpenGL control's depth buffer (Z-buffer) depth.
/// </summary>
[Category("OpenGL Properties"), Description("Depth buffer (Z-buffer) depth in bits.")]
public byte DepthBits
{
get
{
return depthBits;
}
set
{
depthBits = value;
}
}
#endregion
#region StencilBits
/// <summary>
/// Gets and sets the OpenGL control's stencil buffer depth.
/// </summary>
[Category("OpenGL Properties"), Description("Stencil buffer depth in bits.")]
public byte StencilBits
{
get
{
return stencilBits;
}
set
{
stencilBits = value;
}
}
#endregion
#region AutoCheckErrors
/// <summary>
/// Gets and sets the OpenGL control's automatic sending of a glGetError command
/// after drawing.
/// </summary>
[Category("OpenGL Properties"), Description("Automatically send a glGetError command after drawing?")]
public bool AutoCheckErrors
{
get
{
return autoCheckErrors;
}
set
{
autoCheckErrors = value;
}
}
#endregion
#region AutoFinish
/// <summary>
/// Gets and sets the OpenGL control's automatic sending of a glFinish command
/// after drawing.
/// </summary>
[Category("OpenGL Properties"), Description("Automatically send a glFinish command after drawing?")]
public bool AutoFinish
{
get
{
return autoFinish;
}
set
{
autoFinish = value;
}
}
#endregion
#region AutoMakeCurrent
/// <summary>
/// Gets and sets the OpenGL control's automatic forcing of the rendering context to
/// be current before drawing.
/// </summary>
[Category("OpenGL Properties"), Description("Automatically make the rendering context current before drawing?")]
public bool AutoMakeCurrent
{
get
{
return autoMakeCurrent;
}
set
{
autoMakeCurrent = value;
}
}
#endregion
#region AutoSwapBuffers
/// <summary>
/// Gets and sets the OpenGL control's automatic sending of a SwapBuffers command
/// after drawing.
/// </summary>
[Category("OpenGL Properties"), Description("Automatically send a SwapBuffers command after drawing?")]
public bool AutoSwapBuffers
{
get
{
return autoSwapBuffers;
}
set
{
autoSwapBuffers = value;
}
}
#endregion
#endregion
#region Protected Members
#region OnPaint
/// <summary>
/// Paints the control.
/// </summary>
/// <param name="e">The paint event arguments.</param>
protected override void OnPaint(PaintEventArgs e)
{
if (this.DesignMode)
{
e.Graphics.Clear(this.BackColor);
if (this.BackgroundImage != null)
e.Graphics.DrawImage(this.BackgroundImage, this.ClientRectangle, 0, 0, this.BackgroundImage.Width, this.BackgroundImage.Height, GraphicsUnit.Pixel);
e.Graphics.Flush();
return;
}
if (autoMakeCurrent)
{
MakeCurrent();
}
base.OnPaint(e);
if (autoFinish)
{
GL.Finish();
}
if (autoCheckErrors)
{
errorCode = GL.GetError();
if (errorCode != ErrorCode.NoError)
{
switch (errorCode)
{
case ErrorCode.InvalidEnum:
MessageBox.Show("GL_INVALID_ENUM - An unacceptable value has been specified for an enumerated argument. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.InvalidValue:
MessageBox.Show("GL_INVALID_VALUE - A numeric argument is out of range. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.InvalidOperation:
MessageBox.Show("GL_INVALID_OPERATION - The specified operation is not allowed in the current state. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.StackOverflow:
MessageBox.Show("GL_STACK_OVERFLOW - This function would cause a stack overflow. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.StackUnderflow:
MessageBox.Show("GL_STACK_UNDERFLOW - This function would cause a stack underflow. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.OutOfMemory:
MessageBox.Show("GL_OUT_OF_MEMORY - There is not enough memory left to execute the function. The state of OpenGL has been left undefined.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
default:
MessageBox.Show("Unknown GL error. This should never happen.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
}
}
}
if (autoSwapBuffers)
{
SwapBuffers();
}
}
#endregion
#region CreateParams
/// <summary>
/// Overrides the control's class style parameters.
/// </summary>
protected override CreateParams CreateParams
{
get
{
Int32 CS_VREDRAW = 0x1;
Int32 CS_HREDRAW = 0x2;
Int32 CS_OWNDC = 0x20;
CreateParams cp = base.CreateParams;
cp.ClassStyle = cp.ClassStyle | CS_VREDRAW | CS_HREDRAW | CS_OWNDC;
return cp;
}
}
#endregion
#endregion
#region Private Members
#region InitializeBackground
/// <summary>
/// Loads the bitmap from the assembly's manifest resource.
/// </summary>
private void InitializeBackground()
{
try
{
this.BackgroundImage = OpenTK.Compatibility.Properties.Resources.TaoButton;
}
catch (Exception)
{
this.BackgroundImage = null;
}
}
#endregion
#region InitializeStyles
/// <summary>
/// Initializes the control's styles.
/// </summary>
private void InitializeStyles()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, false);
this.SetStyle(ControlStyles.Opaque, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.UserPaint, true);
}
#endregion
#endregion
}
#region License
/*
MIT License
Copyright ©2003-2006 Tao Framework Team
http://www.taoframework.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion License
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using OpenTK.Graphics.OpenGL;
namespace Tao.Platform.Windows
{
/// <summary>
/// Provides a simple OpenGL control allowing quick development of Windows.Forms-based
/// OpenGL applications. Relies on OpenTK.GLControl for cross-platform compatibility.
/// </summary>
[Obsolete("Use OpenTK.GLControl instead.")]
public partial class SimpleOpenGlControl : OpenTK.GLControl
{
#region Fields
private bool autoCheckErrors = false; // Should we provide glGetError()?
private bool autoFinish = false; // Should we provide a glFinish()?
private bool autoMakeCurrent = true; // Should we automatically make the rendering context current?
private bool autoSwapBuffers = true; // Should we automatically swap buffers?
private byte accumBits = 0; // Accumulation buffer bits
private byte colorBits = 32; // Color buffer bits
private byte depthBits = 16; // Depth buffer bits
private byte stencilBits = 0; // Stencil buffer bits
private ErrorCode errorCode = ErrorCode.NoError; // The GL error code
private int logScaleX = 96; // DPI Resolution in X dir
private int logScaleY = 96; // DPI Resolution in Y dir
#endregion
#region Constructors
#region SimpleOpenGlControl()
/// <summary>
/// Constructor. Creates contexts and sets properties.
/// </summary>
public SimpleOpenGlControl()
{
InitializeStyles();
InitializeComponent();
InitializeBackground();
}
#endregion SimpleOpenGlControl()
#endregion
#region Public Members
#region DestroyContexts()
/// <summary>
///
/// </summary>
public void DestroyContexts()
{
Context.Dispose();
}
#endregion DestroyContexts()
#region Draw()
/// <summary>
/// Sends an see cref="UserControl.Invalidate" command to this control, thus
/// forcing a redraw to occur.
/// </summary>
public void Draw()
{
this.Invalidate();
}
#endregion Draw()
#region InitializeContexts()
/// <summary>
/// Creates the OpenGL contexts.
/// </summary>
public void InitializeContexts()
{
// No need to do anything, handled by the GLControl.
}
#endregion InitializeContexts()
#region LogScaleX
/// <summary>
/// Gets the number of logical pixels or dots per inch (dpi) in X-direction
/// </summary>
[Category("OpenGL Properties"), Description("Logical pixels per inch in X-direction.")]
public int LogScaleX
{
get
{
return logScaleX;
}
}
#endregion
#region LogScaleY
/// <summary>
/// Gets the number of logical pixels or dots per inch (dpi) in Y-direction
/// </summary>
[Category("OpenGL Properties"), Description("Logical pixels per inch in Y-direction.")]
public int LogScaleY
{
get
{
return logScaleY;
}
}
#endregion
#region AccumBits
/// <summary>
/// Gets and sets the OpenGL control's accumulation buffer depth.
/// </summary>
[Category("OpenGL Properties"), Description("Accumulation buffer depth in bits.")]
public byte AccumBits
{
get
{
return accumBits;
}
set
{
accumBits = value;
}
}
#endregion
#region ColorBits
/// <summary>
/// Gets and sets the OpenGL control's color buffer depth.
/// </summary>
[Category("OpenGL Properties"), Description("Color buffer depth in bits.")]
public byte ColorBits
{
get
{
return colorBits;
}
set
{
colorBits = value;
}
}
#endregion
#region DepthBits
/// <summary>
/// Gets and sets the OpenGL control's depth buffer (Z-buffer) depth.
/// </summary>
[Category("OpenGL Properties"), Description("Depth buffer (Z-buffer) depth in bits.")]
public byte DepthBits
{
get
{
return depthBits;
}
set
{
depthBits = value;
}
}
#endregion
#region StencilBits
/// <summary>
/// Gets and sets the OpenGL control's stencil buffer depth.
/// </summary>
[Category("OpenGL Properties"), Description("Stencil buffer depth in bits.")]
public byte StencilBits
{
get
{
return stencilBits;
}
set
{
stencilBits = value;
}
}
#endregion
#region AutoCheckErrors
/// <summary>
/// Gets and sets the OpenGL control's automatic sending of a glGetError command
/// after drawing.
/// </summary>
[Category("OpenGL Properties"), Description("Automatically send a glGetError command after drawing?")]
public bool AutoCheckErrors
{
get
{
return autoCheckErrors;
}
set
{
autoCheckErrors = value;
}
}
#endregion
#region AutoFinish
/// <summary>
/// Gets and sets the OpenGL control's automatic sending of a glFinish command
/// after drawing.
/// </summary>
[Category("OpenGL Properties"), Description("Automatically send a glFinish command after drawing?")]
public bool AutoFinish
{
get
{
return autoFinish;
}
set
{
autoFinish = value;
}
}
#endregion
#region AutoMakeCurrent
/// <summary>
/// Gets and sets the OpenGL control's automatic forcing of the rendering context to
/// be current before drawing.
/// </summary>
[Category("OpenGL Properties"), Description("Automatically make the rendering context current before drawing?")]
public bool AutoMakeCurrent
{
get
{
return autoMakeCurrent;
}
set
{
autoMakeCurrent = value;
}
}
#endregion
#region AutoSwapBuffers
/// <summary>
/// Gets and sets the OpenGL control's automatic sending of a SwapBuffers command
/// after drawing.
/// </summary>
[Category("OpenGL Properties"), Description("Automatically send a SwapBuffers command after drawing?")]
public bool AutoSwapBuffers
{
get
{
return autoSwapBuffers;
}
set
{
autoSwapBuffers = value;
}
}
#endregion
#endregion
#region Protected Members
#region OnPaint
/// <summary>
/// Paints the control.
/// </summary>
/// <param name="e">The paint event arguments.</param>
protected override void OnPaint(PaintEventArgs e)
{
if (this.DesignMode)
{
e.Graphics.Clear(this.BackColor);
if (this.BackgroundImage != null)
e.Graphics.DrawImage(this.BackgroundImage, this.ClientRectangle, 0, 0, this.BackgroundImage.Width, this.BackgroundImage.Height, GraphicsUnit.Pixel);
e.Graphics.Flush();
return;
}
if (autoMakeCurrent)
{
MakeCurrent();
}
base.OnPaint(e);
if (autoFinish)
{
GL.Finish();
}
if (autoCheckErrors)
{
errorCode = GL.GetError();
if (errorCode != ErrorCode.NoError)
{
switch (errorCode)
{
case ErrorCode.InvalidEnum:
MessageBox.Show("GL_INVALID_ENUM - An unacceptable value has been specified for an enumerated argument. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.InvalidValue:
MessageBox.Show("GL_INVALID_VALUE - A numeric argument is out of range. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.InvalidOperation:
MessageBox.Show("GL_INVALID_OPERATION - The specified operation is not allowed in the current state. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.StackOverflow:
MessageBox.Show("GL_STACK_OVERFLOW - This function would cause a stack overflow. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.StackUnderflow:
MessageBox.Show("GL_STACK_UNDERFLOW - This function would cause a stack underflow. The offending function has been ignored.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
case ErrorCode.OutOfMemory:
MessageBox.Show("GL_OUT_OF_MEMORY - There is not enough memory left to execute the function. The state of OpenGL has been left undefined.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
default:
MessageBox.Show("Unknown GL error. This should never happen.", "OpenGL Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
}
}
}
if (autoSwapBuffers)
{
SwapBuffers();
}
}
#endregion
#region CreateParams
/// <summary>
/// Overrides the control's class style parameters.
/// </summary>
protected override CreateParams CreateParams
{
get
{
Int32 CS_VREDRAW = 0x1;
Int32 CS_HREDRAW = 0x2;
Int32 CS_OWNDC = 0x20;
CreateParams cp = base.CreateParams;
cp.ClassStyle = cp.ClassStyle | CS_VREDRAW | CS_HREDRAW | CS_OWNDC;
return cp;
}
}
#endregion
#endregion
#region Private Members
#region InitializeBackground
/// <summary>
/// Loads the bitmap from the assembly's manifest resource.
/// </summary>
private void InitializeBackground()
{
try
{
this.BackgroundImage = OpenTK.Compatibility.Properties.Resources.TaoButton;
}
catch (Exception)
{
this.BackgroundImage = null;
}
}
#endregion
#region InitializeStyles
/// <summary>
/// Initializes the control's styles.
/// </summary>
private void InitializeStyles()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, false);
this.SetStyle(ControlStyles.Opaque, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.UserPaint, true);
}
#endregion
#endregion
}
}

View file

@ -1,346 +1,346 @@
//
// Copyright (C) 2009 the Open Toolkit (http://www.opentk.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using System.Diagnostics;
namespace CHeaderToXML
{
// Todo: Array parameters are copied as-is, e.g.: int foo[4] -> <param type="int" name="foo[4]" />.
// This should become <param type="int*" name="foo" count="4" />.
// Todo: Fails to parse ES extension headers, which mix enum and function definitions.
// Parses ES and CL header files.
sealed class ESCLParser
{
Regex extensions = new Regex("(ARB|EXT|AMD|NV|OES|QCOM)", RegexOptions.RightToLeft | RegexOptions.Compiled);
Regex array_size = new Regex(@"\[.+\]", RegexOptions.RightToLeft | RegexOptions.Compiled);
Regex EnumToken = new Regex(@"^#define \w+\s+\(?-?\w+\s?<?<?\s?-?\w*\)?$", RegexOptions.Compiled);
public ESCLParser()
{
}
public string Prefix {get; set;}
public string Version {get; set;}
public IEnumerable<XElement> Parse(string filename)
{
return Parse(File.ReadAllLines(filename));
}
public IEnumerable<XElement> Parse(string[] lines)
{
char[] splitters = new char[] { ' ', '\t', ',', '(', ')', ';', '\n', '\r' };
// Line splitter
Func<string, string[]> split = line =>
line.Split(splitters, StringSplitOptions.RemoveEmptyEntries);
// Adds new enum to the accumulator (acc)
Func<string, List<XElement>, List<XElement>> enum_name = (line, acc) =>
{
Func<string, string[]> get_tokens = (_) =>
line.Trim("/*. ".ToCharArray()).Split(" _-+".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(t =>
{
switch (t.ToLower())
{
case ("bitfield"): return "Flags";
default:
if (t.ToLower() == Prefix)
return "";
else
return t;
}
/* gmcs bug 336258 */ return "";
}).ToArray();
Func<string[], string> get_name = tokens =>
{
// Some comments do not indicate enums. Cull them!
if (tokens[0].StartsWith("$"))
return null;
// Some names consist of more than one tokens. Concatenate them.
return tokens.Aggregate(
"",
(string n, string token) =>
{
n += String.IsNullOrEmpty(token) ? "" : Char.ToUpper(token[0]).ToString() + token.Substring(1);
return n;
},
n => n);
};
Func<string, string> translate_name = name =>
{
if (String.IsNullOrEmpty(name))
return name;
// Patch some names that are known to be problematic
if (name.EndsWith("FlagsFlags"))
name = name.Replace("FlagsFlags", "Flags");
switch (name)
{
case "OpenGLEScoreversions":
case "EGLVersioning":
case "OpenCLVersion": return "Version";
case "ShaderPrecision-SpecifiedTypes": return "ShaderPrecision";
case "Texturecombine+dot3": return "TextureCombine";
case "MacroNamesAndCorrespondingValuesDefinedByOpenCL": return null;
default: return name;
}
};
Func<string, List<XElement>> add_enum = @enum =>
{
switch (@enum)
{
case null:
case "":
return acc;
default:
acc.Add(new XElement("enum", new XAttribute("name", @enum)));
return acc;
}
};
return add_enum(translate_name(get_name(get_tokens(line))));
};
// Adds new token to last enum in accumulator
Func<string, List<XElement>, List<XElement>> enum_token = (line, acc) =>
{
if (EnumToken.IsMatch(line))
{
if (acc.Count == 0 || acc.Last().Name.LocalName != "enum")
acc.Add(new XElement("enum", new XAttribute("name", "Unknown")));
var tokens = split(line);
// Some constants are defined bitshifts, e.g. (1 << 2). If a constant contains parentheses
// we assume it is a bitshift. Otherwise, we assume it is single value, separated by space
// (e.g. 0xdeadbeef).
if (line.Contains("("))
tokens[2] = "(" + line.Split('(')[1];
// Check whether this is an include guard (e.g. #define __OPENCL_CL_H)
if (tokens[1].StartsWith("__"))
return acc;
// Check whether this is a known header define like WIN32_LEAN_AND_MEAN
switch (tokens[1])
{
case "WIN32_LEAN_AND_MEAN":
case "APIENTRY":
case "GLAPI":
return acc;
}
acc[acc.Count - 1].Add(new XElement("token",
new XAttribute("name", tokens[1].Substring(Prefix.Length + 1)), // remove prefix
new XAttribute("value", tokens[2])));
}
return acc;
};
// Parses a function declaration
var function_string = ""; // Used to concatenate functions that are split in different lines. (e.g. "void\nclFoo(int /* a */,\nint b);")
Func<string, List<XElement>, List<XElement>> function = (line, acc) =>
{
if (!line.EndsWith(";"))
{
function_string += line + " ";
return acc;
}
line = function_string + line;
function_string = "";
Func<string, string> GetExtension = name =>
{
var match = extensions.Match(name);
return match != null && String.IsNullOrEmpty(match.Value) ? "Core" : match.Value;
};
var words = line.Split(splitters, StringSplitOptions.RemoveEmptyEntries);
//var words = line.Replace("/*", "").Replace("*/", "").Split(" ()".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
// ES does not start methods with 'extern', while CL does.
// Remove the 'extern' keyword to create a single code-path.
if (words[0] == "extern")
words = words.Skip(1).ToArray();
string rettype = null;
string funcname = null;
GetFunctionNameAndType(words, out funcname, out rettype);
var paramaters_string = Regex.Match(line, @"\(.*\)").Captures[0].Value.TrimStart('(').TrimEnd(')');
// This regex matches function parameters.
// The first part matches functions pointers in the following format:
// '[return type] (*[function pointer name])([parameter list]) [parameter name]
// where [parameter name] may or may not be in comments.
// The second part (before the '|') matches parameters of the following formats:
// '[return type] [parameter name]', '[return type] * [parameter name]', 'const [return type]* [parameter name]'
// where [parameter name] can either be inside comments (/* ... */) or not.
var get_param = new Regex(@"(\w+\s\(\*\w+\)\s*\(.*\)\s*(/\*.*?\*/|\w+)? | (const\s)?\w+\s*\**\s*(/\*.*?\*/|\w+(\[.*?\])?)),?", RegexOptions.IgnorePatternWhitespace);
var fun =
new
{
Name = funcname,
Return = rettype,
Version = Version,
Extension = GetExtension(funcname),
Profile = String.Empty,
Parameters =
from item in get_param.Matches(paramaters_string).OfType<Match>().Select(m => m.Captures[0].Value.TrimEnd(','))
//paramaters_string.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
let tokens = item.Trim().Split(' ')
let is_function_pointer = item.Contains("(*") // This only occurs in function pointers, e.g. void (*pfn_notify)() or void (*user_func)()
let param_name =
is_function_pointer ? tokens[1].TrimStart('(', '*').Split(')')[0] :
(tokens.Last().Trim() != "*/" ? tokens.Last() : tokens[tokens.Length - 2]).Trim()
let param_type =
is_function_pointer ? "IntPtr" :
(from t in tokens where t.Trim() != "const" && t.Trim() != "unsigned" select t).First().Trim()
let has_array_size = array_size.IsMatch(param_name)
let indirection_level =
is_function_pointer ? 0 :
(from c in param_name where c == '*' select c).Count() +
(from c in param_type where c == '*' select c).Count() +
(from t in tokens where t == "***" select t).Count() * 3 +
(from t in tokens where t == "**" select t).Count() * 2 +
(from t in tokens where t == "*" select t).Count() +
(has_array_size ? 1 : 0)
let pointers = new string[] { "*", "*", "*", "*" } // for adding indirection levels (pointers) to param_type
where tokens.Length > 1
select new
{
Name = (has_array_size ? array_size.Replace(param_name, "") : param_name).Replace("*", ""), // Pointers are placed into the parameter Type, not Name
Type =
is_function_pointer ? param_type :
(tokens.Contains("unsigned") && !param_type.StartsWith("byte") ? "u" : "") + // Make sure we don't ignore the unsigned part of unsigned parameters (e.g. unsigned int -> uint)
param_type.Replace("*", "") + String.Join("", pointers, 0, indirection_level), // Normalize pointer indirection level (place as many asterisks as in indirection_level variable)
Count = has_array_size ? Int32.Parse(array_size.Match(param_name).Value.Trim('[', ']')) : 0,
Flow = param_name.EndsWith("ret") ? "out" : "in"
}
};
XElement func = new XElement("function", new XAttribute("name", fun.Name));
func.Add(new XAttribute("extension", fun.Extension));
func.Add(new XAttribute("profile", fun.Profile));
func.Add(new XAttribute("category", fun.Version));
func.Add(new XAttribute("version", fun.Version));
func.Add(new XElement("returns", new XAttribute("type", fun.Return)));
foreach (var p in fun.Parameters)
{
var param = new XElement("param", new XAttribute("type", p.Type), new XAttribute("name", p.Name));
if (p.Count > 0)
param.Add(new XAttribute("count", p.Count));
param.Add(new XAttribute("flow", p.Flow));
func.Add(param);
}
acc.Add(func);
return acc;
};
Func<string, bool> is_comment = line => line.StartsWith("/*") || line.StartsWith("//");
Func<string, bool> is_enum = line => {
if (!is_comment(line))
return false;
// Some enum tokens are commented out and should not be confused with new enum declarations.
// Since tokens are always in ALL_CAPS, while enum names always contain at least one lower case
// character, we'll try to use this information to distinguish between the two.
// Warning: rather fragile.
if (Regex.IsMatch(line, @"/\*\s+([A-Z]+_?[0-9]*_?)+\s+\*/"))
return false;
var toks = split(line);
return toks.Length > 1;// && toks[1].StartsWith("GL");
};
Func<string, bool> is_function = line =>
(line.StartsWith("GL_APICALL") || line.StartsWith("GL_API") ||
line.StartsWith("GLAPI") || line.StartsWith("EGLAPI") ||
line.StartsWith("extern CL_API_ENTRY"));
var signatures = lines.Aggregate(
new List<XElement>(),
(List<XElement> acc, string line) =>
{
return
is_function(line) || !String.IsNullOrEmpty(function_string) ? function(line, acc) :
is_enum(line) ? enum_name(line, acc) :
enum_token(line, acc);
},
acc =>
from elem in acc
where !elem.IsEmpty
select elem);
return signatures;
}
void GetFunctionNameAndType(string[] words, out string funcname, out string rettype)
{
funcname = null;
rettype = null;
bool inRettype = false;
bool quit = false;
for (int i = 0; !quit && i < words.Length; ++i) {
switch (words [i]) {
case "const":
// ignore
break;
case "GLAPI": // ES 1.0
case "GL_API": // ES 1.1
case "GL_APICALL": // ES 2.0
case "CL_API_ENTRY": // CL 1.0
inRettype = true;
break;
case "APIENTRY": // ES 1.0
case "GL_APIENTRY": // ES 1.1 & 2.0
case "CL_API_CALL": // CL 1.0
inRettype = false;
funcname = words [i+1].Substring(Prefix.Length);
quit = true;
break;
default:
if (inRettype)
rettype += words [i];
break;
}
}
}
}
//
// Copyright (C) 2009 the Open Toolkit (http://www.opentk.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using System.Diagnostics;
namespace CHeaderToXML
{
// Todo: Array parameters are copied as-is, e.g.: int foo[4] -> <param type="int" name="foo[4]" />.
// This should become <param type="int*" name="foo" count="4" />.
// Todo: Fails to parse ES extension headers, which mix enum and function definitions.
// Parses ES and CL header files.
sealed class ESCLParser
{
Regex extensions = new Regex("(ARB|EXT|AMD|NV|OES|QCOM)", RegexOptions.RightToLeft | RegexOptions.Compiled);
Regex array_size = new Regex(@"\[.+\]", RegexOptions.RightToLeft | RegexOptions.Compiled);
Regex EnumToken = new Regex(@"^#define \w+\s+\(?-?\w+\s?<?<?\s?-?\w*\)?$", RegexOptions.Compiled);
public ESCLParser()
{
}
public string Prefix {get; set;}
public string Version {get; set;}
public IEnumerable<XElement> Parse(string filename)
{
return Parse(File.ReadAllLines(filename));
}
public IEnumerable<XElement> Parse(string[] lines)
{
char[] splitters = new char[] { ' ', '\t', ',', '(', ')', ';', '\n', '\r' };
// Line splitter
Func<string, string[]> split = line =>
line.Split(splitters, StringSplitOptions.RemoveEmptyEntries);
// Adds new enum to the accumulator (acc)
Func<string, List<XElement>, List<XElement>> enum_name = (line, acc) =>
{
Func<string, string[]> get_tokens = (_) =>
line.Trim("/*. ".ToCharArray()).Split(" _-+".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(t =>
{
switch (t.ToLower())
{
case ("bitfield"): return "Flags";
default:
if (t.ToLower() == Prefix)
return "";
else
return t;
}
/* gmcs bug 336258 */ return "";
}).ToArray();
Func<string[], string> get_name = tokens =>
{
// Some comments do not indicate enums. Cull them!
if (tokens[0].StartsWith("$"))
return null;
// Some names consist of more than one tokens. Concatenate them.
return tokens.Aggregate(
"",
(string n, string token) =>
{
n += String.IsNullOrEmpty(token) ? "" : Char.ToUpper(token[0]).ToString() + token.Substring(1);
return n;
},
n => n);
};
Func<string, string> translate_name = name =>
{
if (String.IsNullOrEmpty(name))
return name;
// Patch some names that are known to be problematic
if (name.EndsWith("FlagsFlags"))
name = name.Replace("FlagsFlags", "Flags");
switch (name)
{
case "OpenGLEScoreversions":
case "EGLVersioning":
case "OpenCLVersion": return "Version";
case "ShaderPrecision-SpecifiedTypes": return "ShaderPrecision";
case "Texturecombine+dot3": return "TextureCombine";
case "MacroNamesAndCorrespondingValuesDefinedByOpenCL": return null;
default: return name;
}
};
Func<string, List<XElement>> add_enum = @enum =>
{
switch (@enum)
{
case null:
case "":
return acc;
default:
acc.Add(new XElement("enum", new XAttribute("name", @enum)));
return acc;
}
};
return add_enum(translate_name(get_name(get_tokens(line))));
};
// Adds new token to last enum in accumulator
Func<string, List<XElement>, List<XElement>> enum_token = (line, acc) =>
{
if (EnumToken.IsMatch(line))
{
if (acc.Count == 0 || acc.Last().Name.LocalName != "enum")
acc.Add(new XElement("enum", new XAttribute("name", "Unknown")));
var tokens = split(line);
// Some constants are defined bitshifts, e.g. (1 << 2). If a constant contains parentheses
// we assume it is a bitshift. Otherwise, we assume it is single value, separated by space
// (e.g. 0xdeadbeef).
if (line.Contains("("))
tokens[2] = "(" + line.Split('(')[1];
// Check whether this is an include guard (e.g. #define __OPENCL_CL_H)
if (tokens[1].StartsWith("__"))
return acc;
// Check whether this is a known header define like WIN32_LEAN_AND_MEAN
switch (tokens[1])
{
case "WIN32_LEAN_AND_MEAN":
case "APIENTRY":
case "GLAPI":
return acc;
}
acc[acc.Count - 1].Add(new XElement("token",
new XAttribute("name", tokens[1].Substring(Prefix.Length + 1)), // remove prefix
new XAttribute("value", tokens[2])));
}
return acc;
};
// Parses a function declaration
var function_string = ""; // Used to concatenate functions that are split in different lines. (e.g. "void\nclFoo(int /* a */,\nint b);")
Func<string, List<XElement>, List<XElement>> function = (line, acc) =>
{
if (!line.EndsWith(";"))
{
function_string += line + " ";
return acc;
}
line = function_string + line;
function_string = "";
Func<string, string> GetExtension = name =>
{
var match = extensions.Match(name);
return match != null && String.IsNullOrEmpty(match.Value) ? "Core" : match.Value;
};
var words = line.Split(splitters, StringSplitOptions.RemoveEmptyEntries);
//var words = line.Replace("/*", "").Replace("*/", "").Split(" ()".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
// ES does not start methods with 'extern', while CL does.
// Remove the 'extern' keyword to create a single code-path.
if (words[0] == "extern")
words = words.Skip(1).ToArray();
string rettype = null;
string funcname = null;
GetFunctionNameAndType(words, out funcname, out rettype);
var paramaters_string = Regex.Match(line, @"\(.*\)").Captures[0].Value.TrimStart('(').TrimEnd(')');
// This regex matches function parameters.
// The first part matches functions pointers in the following format:
// '[return type] (*[function pointer name])([parameter list]) [parameter name]
// where [parameter name] may or may not be in comments.
// The second part (before the '|') matches parameters of the following formats:
// '[return type] [parameter name]', '[return type] * [parameter name]', 'const [return type]* [parameter name]'
// where [parameter name] can either be inside comments (/* ... */) or not.
var get_param = new Regex(@"(\w+\s\(\*\w+\)\s*\(.*\)\s*(/\*.*?\*/|\w+)? | (const\s)?\w+\s*\**\s*(/\*.*?\*/|\w+(\[.*?\])?)),?", RegexOptions.IgnorePatternWhitespace);
var fun =
new
{
Name = funcname,
Return = rettype,
Version = Version,
Extension = GetExtension(funcname),
Profile = String.Empty,
Parameters =
from item in get_param.Matches(paramaters_string).OfType<Match>().Select(m => m.Captures[0].Value.TrimEnd(','))
//paramaters_string.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
let tokens = item.Trim().Split(' ')
let is_function_pointer = item.Contains("(*") // This only occurs in function pointers, e.g. void (*pfn_notify)() or void (*user_func)()
let param_name =
is_function_pointer ? tokens[1].TrimStart('(', '*').Split(')')[0] :
(tokens.Last().Trim() != "*/" ? tokens.Last() : tokens[tokens.Length - 2]).Trim()
let param_type =
is_function_pointer ? "IntPtr" :
(from t in tokens where t.Trim() != "const" && t.Trim() != "unsigned" select t).First().Trim()
let has_array_size = array_size.IsMatch(param_name)
let indirection_level =
is_function_pointer ? 0 :
(from c in param_name where c == '*' select c).Count() +
(from c in param_type where c == '*' select c).Count() +
(from t in tokens where t == "***" select t).Count() * 3 +
(from t in tokens where t == "**" select t).Count() * 2 +
(from t in tokens where t == "*" select t).Count() +
(has_array_size ? 1 : 0)
let pointers = new string[] { "*", "*", "*", "*" } // for adding indirection levels (pointers) to param_type
where tokens.Length > 1
select new
{
Name = (has_array_size ? array_size.Replace(param_name, "") : param_name).Replace("*", ""), // Pointers are placed into the parameter Type, not Name
Type =
is_function_pointer ? param_type :
(tokens.Contains("unsigned") && !param_type.StartsWith("byte") ? "u" : "") + // Make sure we don't ignore the unsigned part of unsigned parameters (e.g. unsigned int -> uint)
param_type.Replace("*", "") + String.Join("", pointers, 0, indirection_level), // Normalize pointer indirection level (place as many asterisks as in indirection_level variable)
Count = has_array_size ? Int32.Parse(array_size.Match(param_name).Value.Trim('[', ']')) : 0,
Flow = param_name.EndsWith("ret") ? "out" : "in"
}
};
XElement func = new XElement("function", new XAttribute("name", fun.Name));
func.Add(new XAttribute("extension", fun.Extension));
func.Add(new XAttribute("profile", fun.Profile));
func.Add(new XAttribute("category", fun.Version));
func.Add(new XAttribute("version", fun.Version));
func.Add(new XElement("returns", new XAttribute("type", fun.Return)));
foreach (var p in fun.Parameters)
{
var param = new XElement("param", new XAttribute("type", p.Type), new XAttribute("name", p.Name));
if (p.Count > 0)
param.Add(new XAttribute("count", p.Count));
param.Add(new XAttribute("flow", p.Flow));
func.Add(param);
}
acc.Add(func);
return acc;
};
Func<string, bool> is_comment = line => line.StartsWith("/*") || line.StartsWith("//");
Func<string, bool> is_enum = line => {
if (!is_comment(line))
return false;
// Some enum tokens are commented out and should not be confused with new enum declarations.
// Since tokens are always in ALL_CAPS, while enum names always contain at least one lower case
// character, we'll try to use this information to distinguish between the two.
// Warning: rather fragile.
if (Regex.IsMatch(line, @"/\*\s+([A-Z]+_?[0-9]*_?)+\s+\*/"))
return false;
var toks = split(line);
return toks.Length > 1;// && toks[1].StartsWith("GL");
};
Func<string, bool> is_function = line =>
(line.StartsWith("GL_APICALL") || line.StartsWith("GL_API") ||
line.StartsWith("GLAPI") || line.StartsWith("EGLAPI") ||
line.StartsWith("extern CL_API_ENTRY"));
var signatures = lines.Aggregate(
new List<XElement>(),
(List<XElement> acc, string line) =>
{
return
is_function(line) || !String.IsNullOrEmpty(function_string) ? function(line, acc) :
is_enum(line) ? enum_name(line, acc) :
enum_token(line, acc);
},
acc =>
from elem in acc
where !elem.IsEmpty
select elem);
return signatures;
}
void GetFunctionNameAndType(string[] words, out string funcname, out string rettype)
{
funcname = null;
rettype = null;
bool inRettype = false;
bool quit = false;
for (int i = 0; !quit && i < words.Length; ++i) {
switch (words [i]) {
case "const":
// ignore
break;
case "GLAPI": // ES 1.0
case "GL_API": // ES 1.1
case "GL_APICALL": // ES 2.0
case "CL_API_ENTRY": // CL 1.0
inRettype = true;
break;
case "APIENTRY": // ES 1.0
case "GL_APIENTRY": // ES 1.1 & 2.0
case "CL_API_CALL": // CL 1.0
inRettype = false;
funcname = words [i+1].Substring(Prefix.Length);
quit = true;
break;
default:
if (inRettype)
rettype += words [i];
break;
}
}
}
}
}

View file

@ -1,145 +1,145 @@
//
// Copyright (C) 2009 the Open Toolkit (http://www.opentk.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using Mono.Options;
namespace CHeaderToXML
{
class EnumTokenComparer : IEqualityComparer<XNode>
{
public bool Equals (XNode a, XNode b)
{
return ((XElement) a).Attribute("name").Equals(((XElement) b).Attribute("name"));
}
public int GetHashCode (XNode a)
{
return ((XElement) a).Attribute("name").GetHashCode();
}
}
class EntryPoint
{
static void Main(string[] args)
{
try
{
bool showHelp = false;
string prefix = "gl";
string version = null;
OptionSet opts = new OptionSet {
{ "p=", "The {PREFIX} to remove from parsed functions and constants. " +
"Defaults to \"" + prefix + "\".",
v => prefix = v },
{ "v=", "The {VERSION} of the headers being parsed.",
v => version = v },
{ "?|h|help", "Show this message and exit.",
v => showHelp = v != null },
};
var headers = opts.Parse(args);
var app = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
if (showHelp)
{
Console.WriteLine("usage: {0} -p:PREFIX -v:VERSION HEADERS", app);
Console.WriteLine();
Console.WriteLine("Options:");
opts.WriteOptionDescriptions(Console.Out);
Console.WriteLine();
Console.WriteLine("HEADERS are the header files to parse into XML.");
return;
}
if (version == null)
{
Console.WriteLine("{0}: missing required parameter -p.", app);
Console.WriteLine("Use '{0} --help' for usage.", app);
return;
}
var sigs = headers.Select(h => new ESCLParser
{
Prefix = prefix,
Version = version
}.Parse(h));
// Merge any duplicate enum entries (in case an enum is declared
// in multiple files with different entries in each file).
var entries = new Dictionary<string, XElement>();
foreach (var e in sigs.SelectMany(s => s).Where(s => s.Name.LocalName == "enum"))
{
var name = (string)e.Attribute("name");
if (entries.ContainsKey(name) && e.Name.LocalName == "enum")
{
var p = entries[name];
var curTokens = p.Nodes().ToList();
p.RemoveNodes();
p.Add(curTokens.Concat(e.Nodes()).Distinct(new EnumTokenComparer()));
}
else
entries.Add(name, e);
}
// sort enum tokens
foreach (var e in entries)
{
if (e.Value.Name.LocalName != "enum")
continue;
var tokens = e.Value.Elements()
.OrderBy(t => (string)t.Attribute("name"))
.ToList();
e.Value.RemoveNodes();
e.Value.Add(tokens);
}
var settings = new XmlWriterSettings();
settings.Indent = true;
using (var writer = XmlWriter.Create(Console.Out, settings))
{
new XElement("signatures",
entries.Values.OrderBy(s => s.Attribute("name").Value), // only enums
sigs.SelectMany(s => s).Where(s => s.Name.LocalName == "function") // only functions
.OrderBy(s => s.Attribute("extension").Value)
.ThenBy(s => s.Attribute("name").Value)
).WriteTo(writer);
writer.Flush();
writer.Close();
}
}
finally
{
Console.WriteLine();
if (Debugger.IsAttached)
{
Console.WriteLine("Press any key to continue...");
Console.ReadKey(true);
}
}
}
}
}
//
// Copyright (C) 2009 the Open Toolkit (http://www.opentk.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using Mono.Options;
namespace CHeaderToXML
{
class EnumTokenComparer : IEqualityComparer<XNode>
{
public bool Equals (XNode a, XNode b)
{
return ((XElement) a).Attribute("name").Equals(((XElement) b).Attribute("name"));
}
public int GetHashCode (XNode a)
{
return ((XElement) a).Attribute("name").GetHashCode();
}
}
class EntryPoint
{
static void Main(string[] args)
{
try
{
bool showHelp = false;
string prefix = "gl";
string version = null;
OptionSet opts = new OptionSet {
{ "p=", "The {PREFIX} to remove from parsed functions and constants. " +
"Defaults to \"" + prefix + "\".",
v => prefix = v },
{ "v=", "The {VERSION} of the headers being parsed.",
v => version = v },
{ "?|h|help", "Show this message and exit.",
v => showHelp = v != null },
};
var headers = opts.Parse(args);
var app = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
if (showHelp)
{
Console.WriteLine("usage: {0} -p:PREFIX -v:VERSION HEADERS", app);
Console.WriteLine();
Console.WriteLine("Options:");
opts.WriteOptionDescriptions(Console.Out);
Console.WriteLine();
Console.WriteLine("HEADERS are the header files to parse into XML.");
return;
}
if (version == null)
{
Console.WriteLine("{0}: missing required parameter -p.", app);
Console.WriteLine("Use '{0} --help' for usage.", app);
return;
}
var sigs = headers.Select(h => new ESCLParser
{
Prefix = prefix,
Version = version
}.Parse(h));
// Merge any duplicate enum entries (in case an enum is declared
// in multiple files with different entries in each file).
var entries = new Dictionary<string, XElement>();
foreach (var e in sigs.SelectMany(s => s).Where(s => s.Name.LocalName == "enum"))
{
var name = (string)e.Attribute("name");
if (entries.ContainsKey(name) && e.Name.LocalName == "enum")
{
var p = entries[name];
var curTokens = p.Nodes().ToList();
p.RemoveNodes();
p.Add(curTokens.Concat(e.Nodes()).Distinct(new EnumTokenComparer()));
}
else
entries.Add(name, e);
}
// sort enum tokens
foreach (var e in entries)
{
if (e.Value.Name.LocalName != "enum")
continue;
var tokens = e.Value.Elements()
.OrderBy(t => (string)t.Attribute("name"))
.ToList();
e.Value.RemoveNodes();
e.Value.Add(tokens);
}
var settings = new XmlWriterSettings();
settings.Indent = true;
using (var writer = XmlWriter.Create(Console.Out, settings))
{
new XElement("signatures",
entries.Values.OrderBy(s => s.Attribute("name").Value), // only enums
sigs.SelectMany(s => s).Where(s => s.Name.LocalName == "function") // only functions
.OrderBy(s => s.Attribute("extension").Value)
.ThenBy(s => s.Attribute("name").Value)
).WriteTo(writer);
writer.Flush();
writer.Close();
}
}
finally
{
Console.WriteLine();
if (Debugger.IsAttached)
{
Console.WriteLine("Press any key to continue...");
Console.ReadKey(true);
}
}
}
}
}

View file

@ -1,37 +1,37 @@
//
// Copyright (C) 2009 the Open Toolkit (http://www.opentk.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Xml.Linq;
namespace CHeaderToXML
{
// The base class for a parser.
abstract class Parser : XDocument
{
// Defines a prefix that should be removed from methods and tokens in the XML files, e.g. "gl", "cl", etc.
protected string Prefix { get; set; }
// Implements the parsing logic for a specific input file.
protected abstract XDocument Parse(string[] lines);
}
}
//
// Copyright (C) 2009 the Open Toolkit (http://www.opentk.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Xml.Linq;
namespace CHeaderToXML
{
// The base class for a parser.
abstract class Parser : XDocument
{
// Defines a prefix that should be removed from methods and tokens in the XML files, e.g. "gl", "cl", etc.
protected string Prefix { get; set; }
// Implements the parsing logic for a specific input file.
protected abstract XDocument Parse(string[] lines);
}
}

View file

@ -1,36 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CHeaderToXML")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CHeaderToXML")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c85a6de2-82bd-43d1-8e28-8855d2bd61d5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CHeaderToXML")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CHeaderToXML")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c85a6de2-82bd-43d1-8e28-8855d2bd61d5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -1,341 +1,341 @@
namespace Examples
{
partial class ExampleBrowser
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExampleBrowser));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.treeViewSamples = new System.Windows.Forms.TreeView();
this.contextMenuStripSamples = new System.Windows.Forms.ContextMenuStrip(this.components);
this.runSampleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.viewDescriptionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewSourceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.imageListSampleCategories = new System.Windows.Forms.ImageList(this.components);
this.tabControlSample = new System.Windows.Forms.TabControl();
this.tabDescription = new System.Windows.Forms.TabPage();
this.richTextBoxDescription = new System.Windows.Forms.RichTextBox();
this.contextMenuStripDescription = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabSource = new System.Windows.Forms.TabPage();
this.richTextBoxSource = new System.Windows.Forms.RichTextBox();
this.contextMenuStripSource = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.tabPageOutput = new System.Windows.Forms.TabPage();
this.textBoxOutput = new System.Windows.Forms.TextBox();
this.contextMenuStripOutput = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolTipSamples = new System.Windows.Forms.ToolTip(this.components);
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.contextMenuStripSamples.SuspendLayout();
this.tabControlSample.SuspendLayout();
this.tabDescription.SuspendLayout();
this.contextMenuStripDescription.SuspendLayout();
this.tabSource.SuspendLayout();
this.contextMenuStripSource.SuspendLayout();
this.tabPageOutput.SuspendLayout();
this.contextMenuStripOutput.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.treeViewSamples);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.tabControlSample);
this.splitContainer1.Size = new System.Drawing.Size(784, 564);
this.splitContainer1.SplitterDistance = 261;
this.splitContainer1.TabIndex = 0;
//
// treeViewSamples
//
this.treeViewSamples.ContextMenuStrip = this.contextMenuStripSamples;
this.treeViewSamples.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeViewSamples.FullRowSelect = true;
this.treeViewSamples.HideSelection = false;
this.treeViewSamples.HotTracking = true;
this.treeViewSamples.ImageIndex = 0;
this.treeViewSamples.ImageList = this.imageListSampleCategories;
this.treeViewSamples.Indent = 71;
this.treeViewSamples.Location = new System.Drawing.Point(0, 0);
this.treeViewSamples.Name = "treeViewSamples";
this.treeViewSamples.SelectedImageIndex = 0;
this.treeViewSamples.Size = new System.Drawing.Size(261, 564);
this.treeViewSamples.TabIndex = 0;
this.toolTipSamples.SetToolTip(this.treeViewSamples, "Right-click a sample for more options.");
this.treeViewSamples.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeViewSamples_NodeMouseDoubleClick);
this.treeViewSamples.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewSamples_AfterSelect);
this.treeViewSamples.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeViewSamples_MouseDown);
this.treeViewSamples.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeViewSamples_KeyDown);
this.treeViewSamples.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.treeViewSamples_AfterExpand);
//
// contextMenuStripSamples
//
this.contextMenuStripSamples.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.runSampleToolStripMenuItem,
this.toolStripMenuItem1,
this.viewDescriptionToolStripMenuItem,
this.viewSourceToolStripMenuItem});
this.contextMenuStripSamples.Name = "contextMenuStripSamples";
this.contextMenuStripSamples.Size = new System.Drawing.Size(170, 76);
this.contextMenuStripSamples.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuStripSamples_ItemClicked);
//
// runSampleToolStripMenuItem
//
this.runSampleToolStripMenuItem.Name = "runSampleToolStripMenuItem";
this.runSampleToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.runSampleToolStripMenuItem.Text = "&Run Sample";
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(166, 6);
//
// viewDescriptionToolStripMenuItem
//
this.viewDescriptionToolStripMenuItem.Name = "viewDescriptionToolStripMenuItem";
this.viewDescriptionToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.viewDescriptionToolStripMenuItem.Text = "View Description";
//
// viewSourceToolStripMenuItem
//
this.viewSourceToolStripMenuItem.Name = "viewSourceToolStripMenuItem";
this.viewSourceToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.viewSourceToolStripMenuItem.Text = "View Source Code";
//
// imageListSampleCategories
//
this.imageListSampleCategories.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListSampleCategories.ImageStream")));
this.imageListSampleCategories.TransparentColor = System.Drawing.Color.Transparent;
this.imageListSampleCategories.Images.SetKeyName(0, "OpenAL.jpg");
this.imageListSampleCategories.Images.SetKeyName(1, "OpenGL.jpg");
this.imageListSampleCategories.Images.SetKeyName(2, "1.1.jpg");
this.imageListSampleCategories.Images.SetKeyName(3, "1.2.jpg");
this.imageListSampleCategories.Images.SetKeyName(4, "1.3.jpg");
this.imageListSampleCategories.Images.SetKeyName(5, "1.4.jpg");
this.imageListSampleCategories.Images.SetKeyName(6, "1.5.jpg");
this.imageListSampleCategories.Images.SetKeyName(7, "2.0.jpg");
this.imageListSampleCategories.Images.SetKeyName(8, "2.1.jpg");
this.imageListSampleCategories.Images.SetKeyName(9, "3.0.jpg");
this.imageListSampleCategories.Images.SetKeyName(10, "3.1.jpg");
this.imageListSampleCategories.Images.SetKeyName(11, "GLSL.jpg");
this.imageListSampleCategories.Images.SetKeyName(12, "FBO.jpg");
this.imageListSampleCategories.Images.SetKeyName(13, "EFX.jpg");
this.imageListSampleCategories.Images.SetKeyName(14, "GameWindow.jpg");
this.imageListSampleCategories.Images.SetKeyName(15, "GLControl.jpg");
this.imageListSampleCategories.Images.SetKeyName(16, "Test.jpg");
this.imageListSampleCategories.Images.SetKeyName(17, "Fonts.jpg");
this.imageListSampleCategories.Images.SetKeyName(18, "OpenTK.jpg");
this.imageListSampleCategories.Images.SetKeyName(19, "OpenCL.png");
//
// tabControlSample
//
this.tabControlSample.Controls.Add(this.tabDescription);
this.tabControlSample.Controls.Add(this.tabSource);
this.tabControlSample.Controls.Add(this.tabPageOutput);
this.tabControlSample.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControlSample.Location = new System.Drawing.Point(0, 0);
this.tabControlSample.Name = "tabControlSample";
this.tabControlSample.SelectedIndex = 0;
this.tabControlSample.Size = new System.Drawing.Size(519, 564);
this.tabControlSample.TabIndex = 0;
//
// tabDescription
//
this.tabDescription.Controls.Add(this.richTextBoxDescription);
this.tabDescription.Location = new System.Drawing.Point(4, 22);
this.tabDescription.Name = "tabDescription";
this.tabDescription.Padding = new System.Windows.Forms.Padding(3);
this.tabDescription.Size = new System.Drawing.Size(511, 538);
this.tabDescription.TabIndex = 0;
this.tabDescription.Text = "Description";
this.tabDescription.UseVisualStyleBackColor = true;
//
// richTextBoxDescription
//
this.richTextBoxDescription.ContextMenuStrip = this.contextMenuStripDescription;
this.richTextBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBoxDescription.Location = new System.Drawing.Point(3, 3);
this.richTextBoxDescription.Name = "richTextBoxDescription";
this.richTextBoxDescription.ReadOnly = true;
this.richTextBoxDescription.Size = new System.Drawing.Size(505, 532);
this.richTextBoxDescription.TabIndex = 0;
this.richTextBoxDescription.Text = "";
this.richTextBoxDescription.MouseDown += new System.Windows.Forms.MouseEventHandler(this.richTextBoxDescription_MouseDown);
//
// contextMenuStripDescription
//
this.contextMenuStripDescription.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem});
this.contextMenuStripDescription.Name = "contextMenuStripDescription";
this.contextMenuStripDescription.Size = new System.Drawing.Size(103, 26);
this.contextMenuStripDescription.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuStripDescription_ItemClicked);
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(102, 22);
this.copyToolStripMenuItem.Text = "&Copy";
//
// tabSource
//
this.tabSource.Controls.Add(this.richTextBoxSource);
this.tabSource.Location = new System.Drawing.Point(4, 22);
this.tabSource.Name = "tabSource";
this.tabSource.Padding = new System.Windows.Forms.Padding(3);
this.tabSource.Size = new System.Drawing.Size(511, 538);
this.tabSource.TabIndex = 1;
this.tabSource.Text = "Source Code";
this.tabSource.UseVisualStyleBackColor = true;
//
// richTextBoxSource
//
this.richTextBoxSource.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(216)))), ((int)(((byte)(242)))), ((int)(((byte)(240)))));
this.richTextBoxSource.ContextMenuStrip = this.contextMenuStripSource;
this.richTextBoxSource.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBoxSource.Location = new System.Drawing.Point(3, 3);
this.richTextBoxSource.Name = "richTextBoxSource";
this.richTextBoxSource.ReadOnly = true;
this.richTextBoxSource.Size = new System.Drawing.Size(505, 532);
this.richTextBoxSource.TabIndex = 0;
this.richTextBoxSource.Text = "";
this.richTextBoxSource.MouseDown += new System.Windows.Forms.MouseEventHandler(this.richTextBoxSource_MouseDown);
//
// contextMenuStripSource
//
this.contextMenuStripSource.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem1});
this.contextMenuStripSource.Name = "contextMenuStripSource";
this.contextMenuStripSource.Size = new System.Drawing.Size(103, 26);
this.contextMenuStripSource.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuStripSource_ItemClicked);
//
// copyToolStripMenuItem1
//
this.copyToolStripMenuItem1.Name = "copyToolStripMenuItem1";
this.copyToolStripMenuItem1.Size = new System.Drawing.Size(102, 22);
this.copyToolStripMenuItem1.Text = "&Copy";
//
// tabPageOutput
//
this.tabPageOutput.Controls.Add(this.textBoxOutput);
this.tabPageOutput.Location = new System.Drawing.Point(4, 22);
this.tabPageOutput.Name = "tabPageOutput";
this.tabPageOutput.Padding = new System.Windows.Forms.Padding(3);
this.tabPageOutput.Size = new System.Drawing.Size(511, 538);
this.tabPageOutput.TabIndex = 2;
this.tabPageOutput.Text = "Output";
this.tabPageOutput.UseVisualStyleBackColor = true;
//
// textBoxOutput
//
this.textBoxOutput.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(216)))), ((int)(((byte)(242)))), ((int)(((byte)(240)))));
this.textBoxOutput.ContextMenuStrip = this.contextMenuStripOutput;
this.textBoxOutput.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBoxOutput.Location = new System.Drawing.Point(3, 3);
this.textBoxOutput.MaxLength = 1048576;
this.textBoxOutput.Multiline = true;
this.textBoxOutput.Name = "textBoxOutput";
this.textBoxOutput.ReadOnly = true;
this.textBoxOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBoxOutput.Size = new System.Drawing.Size(505, 532);
this.textBoxOutput.TabIndex = 0;
//
// contextMenuStripOutput
//
this.contextMenuStripOutput.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem2});
this.contextMenuStripOutput.Name = "contextMenuStripOutput";
this.contextMenuStripOutput.Size = new System.Drawing.Size(103, 26);
//
// copyToolStripMenuItem2
//
this.copyToolStripMenuItem2.Name = "copyToolStripMenuItem2";
this.copyToolStripMenuItem2.Size = new System.Drawing.Size(102, 22);
this.copyToolStripMenuItem2.Text = "&Copy";
//
// ExampleBrowser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 564);
this.Controls.Add(this.splitContainer1);
this.Name = "ExampleBrowser";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "The Open Toolkit Sample Browser";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.contextMenuStripSamples.ResumeLayout(false);
this.tabControlSample.ResumeLayout(false);
this.tabDescription.ResumeLayout(false);
this.contextMenuStripDescription.ResumeLayout(false);
this.tabSource.ResumeLayout(false);
this.contextMenuStripSource.ResumeLayout(false);
this.tabPageOutput.ResumeLayout(false);
this.tabPageOutput.PerformLayout();
this.contextMenuStripOutput.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TabControl tabControlSample;
private System.Windows.Forms.TabPage tabDescription;
private System.Windows.Forms.TabPage tabSource;
private System.Windows.Forms.RichTextBox richTextBoxDescription;
private System.Windows.Forms.RichTextBox richTextBoxSource;
private System.Windows.Forms.TreeView treeViewSamples;
private System.Windows.Forms.ImageList imageListSampleCategories;
private System.Windows.Forms.ContextMenuStrip contextMenuStripDescription;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStripSource;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem1;
private System.Windows.Forms.ContextMenuStrip contextMenuStripSamples;
private System.Windows.Forms.ToolStripMenuItem runSampleToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem viewDescriptionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem viewSourceToolStripMenuItem;
private System.Windows.Forms.ToolTip toolTipSamples;
private System.Windows.Forms.TabPage tabPageOutput;
private System.Windows.Forms.TextBox textBoxOutput;
private System.Windows.Forms.ContextMenuStrip contextMenuStripOutput;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem2;
}
namespace Examples
{
partial class ExampleBrowser
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExampleBrowser));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.treeViewSamples = new System.Windows.Forms.TreeView();
this.contextMenuStripSamples = new System.Windows.Forms.ContextMenuStrip(this.components);
this.runSampleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.viewDescriptionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewSourceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.imageListSampleCategories = new System.Windows.Forms.ImageList(this.components);
this.tabControlSample = new System.Windows.Forms.TabControl();
this.tabDescription = new System.Windows.Forms.TabPage();
this.richTextBoxDescription = new System.Windows.Forms.RichTextBox();
this.contextMenuStripDescription = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabSource = new System.Windows.Forms.TabPage();
this.richTextBoxSource = new System.Windows.Forms.RichTextBox();
this.contextMenuStripSource = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.tabPageOutput = new System.Windows.Forms.TabPage();
this.textBoxOutput = new System.Windows.Forms.TextBox();
this.contextMenuStripOutput = new System.Windows.Forms.ContextMenuStrip(this.components);
this.copyToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolTipSamples = new System.Windows.Forms.ToolTip(this.components);
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.contextMenuStripSamples.SuspendLayout();
this.tabControlSample.SuspendLayout();
this.tabDescription.SuspendLayout();
this.contextMenuStripDescription.SuspendLayout();
this.tabSource.SuspendLayout();
this.contextMenuStripSource.SuspendLayout();
this.tabPageOutput.SuspendLayout();
this.contextMenuStripOutput.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.treeViewSamples);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.tabControlSample);
this.splitContainer1.Size = new System.Drawing.Size(784, 564);
this.splitContainer1.SplitterDistance = 261;
this.splitContainer1.TabIndex = 0;
//
// treeViewSamples
//
this.treeViewSamples.ContextMenuStrip = this.contextMenuStripSamples;
this.treeViewSamples.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeViewSamples.FullRowSelect = true;
this.treeViewSamples.HideSelection = false;
this.treeViewSamples.HotTracking = true;
this.treeViewSamples.ImageIndex = 0;
this.treeViewSamples.ImageList = this.imageListSampleCategories;
this.treeViewSamples.Indent = 71;
this.treeViewSamples.Location = new System.Drawing.Point(0, 0);
this.treeViewSamples.Name = "treeViewSamples";
this.treeViewSamples.SelectedImageIndex = 0;
this.treeViewSamples.Size = new System.Drawing.Size(261, 564);
this.treeViewSamples.TabIndex = 0;
this.toolTipSamples.SetToolTip(this.treeViewSamples, "Right-click a sample for more options.");
this.treeViewSamples.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeViewSamples_NodeMouseDoubleClick);
this.treeViewSamples.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewSamples_AfterSelect);
this.treeViewSamples.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeViewSamples_MouseDown);
this.treeViewSamples.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeViewSamples_KeyDown);
this.treeViewSamples.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.treeViewSamples_AfterExpand);
//
// contextMenuStripSamples
//
this.contextMenuStripSamples.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.runSampleToolStripMenuItem,
this.toolStripMenuItem1,
this.viewDescriptionToolStripMenuItem,
this.viewSourceToolStripMenuItem});
this.contextMenuStripSamples.Name = "contextMenuStripSamples";
this.contextMenuStripSamples.Size = new System.Drawing.Size(170, 76);
this.contextMenuStripSamples.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuStripSamples_ItemClicked);
//
// runSampleToolStripMenuItem
//
this.runSampleToolStripMenuItem.Name = "runSampleToolStripMenuItem";
this.runSampleToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.runSampleToolStripMenuItem.Text = "&Run Sample";
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(166, 6);
//
// viewDescriptionToolStripMenuItem
//
this.viewDescriptionToolStripMenuItem.Name = "viewDescriptionToolStripMenuItem";
this.viewDescriptionToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.viewDescriptionToolStripMenuItem.Text = "View Description";
//
// viewSourceToolStripMenuItem
//
this.viewSourceToolStripMenuItem.Name = "viewSourceToolStripMenuItem";
this.viewSourceToolStripMenuItem.Size = new System.Drawing.Size(169, 22);
this.viewSourceToolStripMenuItem.Text = "View Source Code";
//
// imageListSampleCategories
//
this.imageListSampleCategories.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListSampleCategories.ImageStream")));
this.imageListSampleCategories.TransparentColor = System.Drawing.Color.Transparent;
this.imageListSampleCategories.Images.SetKeyName(0, "OpenAL.jpg");
this.imageListSampleCategories.Images.SetKeyName(1, "OpenGL.jpg");
this.imageListSampleCategories.Images.SetKeyName(2, "1.1.jpg");
this.imageListSampleCategories.Images.SetKeyName(3, "1.2.jpg");
this.imageListSampleCategories.Images.SetKeyName(4, "1.3.jpg");
this.imageListSampleCategories.Images.SetKeyName(5, "1.4.jpg");
this.imageListSampleCategories.Images.SetKeyName(6, "1.5.jpg");
this.imageListSampleCategories.Images.SetKeyName(7, "2.0.jpg");
this.imageListSampleCategories.Images.SetKeyName(8, "2.1.jpg");
this.imageListSampleCategories.Images.SetKeyName(9, "3.0.jpg");
this.imageListSampleCategories.Images.SetKeyName(10, "3.1.jpg");
this.imageListSampleCategories.Images.SetKeyName(11, "GLSL.jpg");
this.imageListSampleCategories.Images.SetKeyName(12, "FBO.jpg");
this.imageListSampleCategories.Images.SetKeyName(13, "EFX.jpg");
this.imageListSampleCategories.Images.SetKeyName(14, "GameWindow.jpg");
this.imageListSampleCategories.Images.SetKeyName(15, "GLControl.jpg");
this.imageListSampleCategories.Images.SetKeyName(16, "Test.jpg");
this.imageListSampleCategories.Images.SetKeyName(17, "Fonts.jpg");
this.imageListSampleCategories.Images.SetKeyName(18, "OpenTK.jpg");
this.imageListSampleCategories.Images.SetKeyName(19, "OpenCL.png");
//
// tabControlSample
//
this.tabControlSample.Controls.Add(this.tabDescription);
this.tabControlSample.Controls.Add(this.tabSource);
this.tabControlSample.Controls.Add(this.tabPageOutput);
this.tabControlSample.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControlSample.Location = new System.Drawing.Point(0, 0);
this.tabControlSample.Name = "tabControlSample";
this.tabControlSample.SelectedIndex = 0;
this.tabControlSample.Size = new System.Drawing.Size(519, 564);
this.tabControlSample.TabIndex = 0;
//
// tabDescription
//
this.tabDescription.Controls.Add(this.richTextBoxDescription);
this.tabDescription.Location = new System.Drawing.Point(4, 22);
this.tabDescription.Name = "tabDescription";
this.tabDescription.Padding = new System.Windows.Forms.Padding(3);
this.tabDescription.Size = new System.Drawing.Size(511, 538);
this.tabDescription.TabIndex = 0;
this.tabDescription.Text = "Description";
this.tabDescription.UseVisualStyleBackColor = true;
//
// richTextBoxDescription
//
this.richTextBoxDescription.ContextMenuStrip = this.contextMenuStripDescription;
this.richTextBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBoxDescription.Location = new System.Drawing.Point(3, 3);
this.richTextBoxDescription.Name = "richTextBoxDescription";
this.richTextBoxDescription.ReadOnly = true;
this.richTextBoxDescription.Size = new System.Drawing.Size(505, 532);
this.richTextBoxDescription.TabIndex = 0;
this.richTextBoxDescription.Text = "";
this.richTextBoxDescription.MouseDown += new System.Windows.Forms.MouseEventHandler(this.richTextBoxDescription_MouseDown);
//
// contextMenuStripDescription
//
this.contextMenuStripDescription.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem});
this.contextMenuStripDescription.Name = "contextMenuStripDescription";
this.contextMenuStripDescription.Size = new System.Drawing.Size(103, 26);
this.contextMenuStripDescription.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuStripDescription_ItemClicked);
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.Size = new System.Drawing.Size(102, 22);
this.copyToolStripMenuItem.Text = "&Copy";
//
// tabSource
//
this.tabSource.Controls.Add(this.richTextBoxSource);
this.tabSource.Location = new System.Drawing.Point(4, 22);
this.tabSource.Name = "tabSource";
this.tabSource.Padding = new System.Windows.Forms.Padding(3);
this.tabSource.Size = new System.Drawing.Size(511, 538);
this.tabSource.TabIndex = 1;
this.tabSource.Text = "Source Code";
this.tabSource.UseVisualStyleBackColor = true;
//
// richTextBoxSource
//
this.richTextBoxSource.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(216)))), ((int)(((byte)(242)))), ((int)(((byte)(240)))));
this.richTextBoxSource.ContextMenuStrip = this.contextMenuStripSource;
this.richTextBoxSource.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBoxSource.Location = new System.Drawing.Point(3, 3);
this.richTextBoxSource.Name = "richTextBoxSource";
this.richTextBoxSource.ReadOnly = true;
this.richTextBoxSource.Size = new System.Drawing.Size(505, 532);
this.richTextBoxSource.TabIndex = 0;
this.richTextBoxSource.Text = "";
this.richTextBoxSource.MouseDown += new System.Windows.Forms.MouseEventHandler(this.richTextBoxSource_MouseDown);
//
// contextMenuStripSource
//
this.contextMenuStripSource.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem1});
this.contextMenuStripSource.Name = "contextMenuStripSource";
this.contextMenuStripSource.Size = new System.Drawing.Size(103, 26);
this.contextMenuStripSource.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuStripSource_ItemClicked);
//
// copyToolStripMenuItem1
//
this.copyToolStripMenuItem1.Name = "copyToolStripMenuItem1";
this.copyToolStripMenuItem1.Size = new System.Drawing.Size(102, 22);
this.copyToolStripMenuItem1.Text = "&Copy";
//
// tabPageOutput
//
this.tabPageOutput.Controls.Add(this.textBoxOutput);
this.tabPageOutput.Location = new System.Drawing.Point(4, 22);
this.tabPageOutput.Name = "tabPageOutput";
this.tabPageOutput.Padding = new System.Windows.Forms.Padding(3);
this.tabPageOutput.Size = new System.Drawing.Size(511, 538);
this.tabPageOutput.TabIndex = 2;
this.tabPageOutput.Text = "Output";
this.tabPageOutput.UseVisualStyleBackColor = true;
//
// textBoxOutput
//
this.textBoxOutput.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(216)))), ((int)(((byte)(242)))), ((int)(((byte)(240)))));
this.textBoxOutput.ContextMenuStrip = this.contextMenuStripOutput;
this.textBoxOutput.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBoxOutput.Location = new System.Drawing.Point(3, 3);
this.textBoxOutput.MaxLength = 1048576;
this.textBoxOutput.Multiline = true;
this.textBoxOutput.Name = "textBoxOutput";
this.textBoxOutput.ReadOnly = true;
this.textBoxOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBoxOutput.Size = new System.Drawing.Size(505, 532);
this.textBoxOutput.TabIndex = 0;
//
// contextMenuStripOutput
//
this.contextMenuStripOutput.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.copyToolStripMenuItem2});
this.contextMenuStripOutput.Name = "contextMenuStripOutput";
this.contextMenuStripOutput.Size = new System.Drawing.Size(103, 26);
//
// copyToolStripMenuItem2
//
this.copyToolStripMenuItem2.Name = "copyToolStripMenuItem2";
this.copyToolStripMenuItem2.Size = new System.Drawing.Size(102, 22);
this.copyToolStripMenuItem2.Text = "&Copy";
//
// ExampleBrowser
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 564);
this.Controls.Add(this.splitContainer1);
this.Name = "ExampleBrowser";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "The Open Toolkit Sample Browser";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.contextMenuStripSamples.ResumeLayout(false);
this.tabControlSample.ResumeLayout(false);
this.tabDescription.ResumeLayout(false);
this.contextMenuStripDescription.ResumeLayout(false);
this.tabSource.ResumeLayout(false);
this.contextMenuStripSource.ResumeLayout(false);
this.tabPageOutput.ResumeLayout(false);
this.tabPageOutput.PerformLayout();
this.contextMenuStripOutput.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TabControl tabControlSample;
private System.Windows.Forms.TabPage tabDescription;
private System.Windows.Forms.TabPage tabSource;
private System.Windows.Forms.RichTextBox richTextBoxDescription;
private System.Windows.Forms.RichTextBox richTextBoxSource;
private System.Windows.Forms.TreeView treeViewSamples;
private System.Windows.Forms.ImageList imageListSampleCategories;
private System.Windows.Forms.ContextMenuStrip contextMenuStripDescription;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStripSource;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem1;
private System.Windows.Forms.ContextMenuStrip contextMenuStripSamples;
private System.Windows.Forms.ToolStripMenuItem runSampleToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem viewDescriptionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem viewSourceToolStripMenuItem;
private System.Windows.Forms.ToolTip toolTipSamples;
private System.Windows.Forms.TabPage tabPageOutput;
private System.Windows.Forms.TextBox textBoxOutput;
private System.Windows.Forms.ContextMenuStrip contextMenuStripOutput;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem2;
}
}

View file

@ -1,371 +1,371 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Text;
using System.Reflection;
using System.Windows.Forms;
using OpenTK.Examples.Properties;
namespace Examples
{
public partial class ExampleBrowser : Form
{
#region Fields
//PrivateFontCollection font_collection = new PrivateFontCollection();
bool show_warning = true;
#endregion
#region Constructors
public ExampleBrowser()
{
Font = SystemFonts.DialogFont;
InitializeComponent();
// Windows 6 (Vista) and higher come with Consolas, a high-quality monospace font. Use that or fallback to
// the generic monospace font on other systems.
if (System.Environment.OSVersion.Platform == PlatformID.Win32NT &&
System.Environment.OSVersion.Version.Major >= 6)
{
textBoxOutput.Font = richTextBoxSource.Font = new Font("Consolas", 10.0f, FontStyle.Regular);
}
else
{
textBoxOutput.Font = richTextBoxSource.Font =
new Font(FontFamily.GenericMonospace, 10.0f, FontStyle.Regular);
}
}
#endregion
#region Protected Members
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Debug.Listeners.Add(new TextBoxTraceListener(textBoxOutput));
treeViewSamples.TreeViewNodeSorter = new SamplesTreeViewSorter();
LoadSamplesFromAssembly(Assembly.GetExecutingAssembly());
}
protected override void OnShown(EventArgs e)
{
if (show_warning)
{
//MessageBox.Show("The new Sample Browser is not complete. Please report any issues at http://www.opentk.com/project/issues.",
// "Work in Progress", MessageBoxButtons.OK, MessageBoxIcon.Information);
show_warning = false;
}
}
#endregion
#region Private Members
#region Events
#region TreeView
private void treeViewSamples_AfterSelect(object sender, TreeViewEventArgs e)
{
const string no_docs = "Documentation has not been entered.";
const string no_source = "Source code has not been entered.";
if (e.Node.Tag != null && !String.IsNullOrEmpty(((ExampleInfo)e.Node.Tag).Attribute.Documentation))
{
string docs = (string)Resources.ResourceManager.GetObject(((ExampleInfo)e.Node.Tag).Attribute.Documentation + "Doc");
string source = (string)Resources.ResourceManager.GetObject(((ExampleInfo)e.Node.Tag).Attribute.Documentation);
if (String.IsNullOrEmpty(docs))
richTextBoxDescription.Text = no_docs;
else
richTextBoxDescription.Rtf = docs;
if (String.IsNullOrEmpty(source))
richTextBoxSource.Text = no_source;
else
richTextBoxSource.Text = source;
}
else
{
richTextBoxDescription.Text = no_docs;
richTextBoxSource.Text = no_source;
}
}
private void treeViewSamples_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Node.Tag != null)
{
ActivateNode(e.Node);
}
}
private void treeViewSamples_KeyDown(object sender, KeyEventArgs e)
{
// The enter key activates a node (either expands/collapses or executes its sample).
switch (e.KeyCode)
{
case Keys.Enter:
ActivateNode(treeViewSamples.SelectedNode);
e.Handled = true;
e.SuppressKeyPress = true;
break;
}
}
private void treeViewSamples_MouseDown(object sender, MouseEventArgs e)
{
// Make sure that right-clicking a new node will select that node before displaying
// the context menu. Without this, right-clicking a node does not select it, which
// is completely disorienting.
// As a bonus, make any mouse button select the underlying node,
TreeNode node = treeViewSamples.HitTest(e.Location).Node;
if (node != null)
treeViewSamples.SelectedNode = node;
// Middle click selects and activates a node (either expands/collapses or executes its sample).
// Right button displays the context menu.
// All other mouse buttons simply select the underlying node.
switch (e.Button)
{
case MouseButtons.Middle:
ActivateNode(node);
break;
case MouseButtons.Right:
treeViewSamples.ContextMenuStrip.Show(sender as Control, e.Location);
break;
}
}
private void treeViewSamples_AfterExpand(object sender, TreeViewEventArgs e)
{
foreach (TreeNode child in e.Node.Nodes)
child.EnsureVisible();
}
private void contextMenuStripSamples_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
switch (e.ClickedItem.Text)
{
case "&Run Sample": RunSample(this, (ExampleInfo)treeViewSamples.SelectedNode.Tag); break;
case "View Description": tabControlSample.SelectedTab = tabDescription; break;
case "View Source Code": tabControlSample.SelectedTab = tabSource; break;
}
}
#endregion
#region Description
private void richTextBoxDescription_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
richTextBoxDescription.ContextMenuStrip.Show(sender as Control, e.X, e.Y);
}
}
private void contextMenuStripDescription_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (e.ClickedItem.Text == "&Copy")
{
Clipboard.SetText(richTextBoxDescription.SelectedRtf, TextDataFormat.Rtf);
}
}
#endregion
#region Source Code
private void richTextBoxSource_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
richTextBoxSource.ContextMenuStrip.Show(sender as Control, e.X, e.Y);
}
}
private void contextMenuStripSource_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (e.ClickedItem.Text == "&Copy")
{
Clipboard.SetText(richTextBoxSource.SelectedText, TextDataFormat.Text);
}
}
#endregion
#endregion
#region Actions
void LoadSamplesFromAssembly(Assembly assembly)
{
if (assembly == null)
throw new ArgumentNullException("assembly");
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
object[] attributes = type.GetCustomAttributes(false);
ExampleAttribute example = null;
foreach (object attr in attributes)
{
if (attr is ExampleAttribute)
{
example = (ExampleAttribute)attr;
if (example.Visible)
{
// Add this example to the sample TreeView.
// First check whether the ExampleCategory exists in the tree (and add it if it doesn't).
// Then add the example as a child node on this category.
if (!treeViewSamples.Nodes.ContainsKey(example.Category.ToString()))
{
int category_index = GetImageIndexForSample(imageListSampleCategories, example.Category.ToString(), String.Empty);
treeViewSamples.Nodes.Add(example.Category.ToString(), String.Format("{0} samples", example.Category),
category_index, category_index);
}
int image_index = GetImageIndexForSample(imageListSampleCategories, example.Category.ToString(), example.Subcategory);
TreeNode node = new TreeNode(example.Title, image_index, image_index);
node.Name = example.Title;
node.Tag = new ExampleInfo(type, example);
treeViewSamples.Nodes[example.Category.ToString()].Nodes.Add(node);
}
}
}
}
treeViewSamples.Sort();
}
void ActivateNode(TreeNode node)
{
if (node == null)
return;
if (node.Tag == null)
{
if (node.IsExpanded)
node.Collapse();
else
node.Expand();
}
else
{
tabControlSample.SelectedTab = tabPageOutput;
textBoxOutput.Clear();
RunSample(node.TreeView.TopLevelControl, (ExampleInfo)node.Tag);
}
}
static int GetImageIndexForSample(ImageList list, string category, string subcategory)
{
if (list == null)
throw new ArgumentNullException("list");
if (list.Images.ContainsKey(subcategory.ToString() + ".jpg"))
return list.Images.IndexOfKey(subcategory.ToString() + ".jpg");
if (list.Images.ContainsKey(category.ToString() + ".jpg"))
return list.Images.IndexOfKey(category.ToString() + ".jpg");
if (list.Images.ContainsKey(subcategory.ToString() + ".png"))
return list.Images.IndexOfKey(subcategory.ToString() + ".png");
if (list.Images.ContainsKey(category.ToString() + ".png"))
return list.Images.IndexOfKey(category.ToString() + ".png");
return 0;
}
static void RunSample(Control parent, ExampleInfo e)
{
if (e == null)
return;
MethodInfo main =
e.Example.GetMethod("Main", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ??
e.Example.GetMethod("Main", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof(object), typeof(object) }, null);
if (main != null)
{
try
{
if (parent != null)
{
parent.Visible = false;
Application.DoEvents();
}
Trace.WriteLine(String.Format("Launching sample: \"{0}\"", e.Attribute.Title));
Trace.WriteLine(String.Empty);
main.Invoke(null, null);
}
catch (TargetInvocationException expt)
{
string ex_info;
if (expt.InnerException != null)
ex_info = expt.InnerException.ToString();
else
ex_info = expt.ToString();
MessageBox.Show(ex_info, "An OpenTK example encountered an error.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Debug.Print(expt.ToString());
}
catch (NullReferenceException expt)
{
MessageBox.Show(expt.ToString(), "The Example launcher failed to load the example.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
finally
{
if (parent != null)
{
parent.Visible = true;
Application.DoEvents();
}
}
}
else
{
MessageBox.Show("The selected example does not define a Main method", "Entry point not found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
#endregion
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Text;
using System.Reflection;
using System.Windows.Forms;
using OpenTK.Examples.Properties;
namespace Examples
{
public partial class ExampleBrowser : Form
{
#region Fields
//PrivateFontCollection font_collection = new PrivateFontCollection();
bool show_warning = true;
#endregion
#region Constructors
public ExampleBrowser()
{
Font = SystemFonts.DialogFont;
InitializeComponent();
// Windows 6 (Vista) and higher come with Consolas, a high-quality monospace font. Use that or fallback to
// the generic monospace font on other systems.
if (System.Environment.OSVersion.Platform == PlatformID.Win32NT &&
System.Environment.OSVersion.Version.Major >= 6)
{
textBoxOutput.Font = richTextBoxSource.Font = new Font("Consolas", 10.0f, FontStyle.Regular);
}
else
{
textBoxOutput.Font = richTextBoxSource.Font =
new Font(FontFamily.GenericMonospace, 10.0f, FontStyle.Regular);
}
}
#endregion
#region Protected Members
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Debug.Listeners.Add(new TextBoxTraceListener(textBoxOutput));
treeViewSamples.TreeViewNodeSorter = new SamplesTreeViewSorter();
LoadSamplesFromAssembly(Assembly.GetExecutingAssembly());
}
protected override void OnShown(EventArgs e)
{
if (show_warning)
{
//MessageBox.Show("The new Sample Browser is not complete. Please report any issues at http://www.opentk.com/project/issues.",
// "Work in Progress", MessageBoxButtons.OK, MessageBoxIcon.Information);
show_warning = false;
}
}
#endregion
#region Private Members
#region Events
#region TreeView
private void treeViewSamples_AfterSelect(object sender, TreeViewEventArgs e)
{
const string no_docs = "Documentation has not been entered.";
const string no_source = "Source code has not been entered.";
if (e.Node.Tag != null && !String.IsNullOrEmpty(((ExampleInfo)e.Node.Tag).Attribute.Documentation))
{
string docs = (string)Resources.ResourceManager.GetObject(((ExampleInfo)e.Node.Tag).Attribute.Documentation + "Doc");
string source = (string)Resources.ResourceManager.GetObject(((ExampleInfo)e.Node.Tag).Attribute.Documentation);
if (String.IsNullOrEmpty(docs))
richTextBoxDescription.Text = no_docs;
else
richTextBoxDescription.Rtf = docs;
if (String.IsNullOrEmpty(source))
richTextBoxSource.Text = no_source;
else
richTextBoxSource.Text = source;
}
else
{
richTextBoxDescription.Text = no_docs;
richTextBoxSource.Text = no_source;
}
}
private void treeViewSamples_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{
if (e.Node.Tag != null)
{
ActivateNode(e.Node);
}
}
private void treeViewSamples_KeyDown(object sender, KeyEventArgs e)
{
// The enter key activates a node (either expands/collapses or executes its sample).
switch (e.KeyCode)
{
case Keys.Enter:
ActivateNode(treeViewSamples.SelectedNode);
e.Handled = true;
e.SuppressKeyPress = true;
break;
}
}
private void treeViewSamples_MouseDown(object sender, MouseEventArgs e)
{
// Make sure that right-clicking a new node will select that node before displaying
// the context menu. Without this, right-clicking a node does not select it, which
// is completely disorienting.
// As a bonus, make any mouse button select the underlying node,
TreeNode node = treeViewSamples.HitTest(e.Location).Node;
if (node != null)
treeViewSamples.SelectedNode = node;
// Middle click selects and activates a node (either expands/collapses or executes its sample).
// Right button displays the context menu.
// All other mouse buttons simply select the underlying node.
switch (e.Button)
{
case MouseButtons.Middle:
ActivateNode(node);
break;
case MouseButtons.Right:
treeViewSamples.ContextMenuStrip.Show(sender as Control, e.Location);
break;
}
}
private void treeViewSamples_AfterExpand(object sender, TreeViewEventArgs e)
{
foreach (TreeNode child in e.Node.Nodes)
child.EnsureVisible();
}
private void contextMenuStripSamples_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
switch (e.ClickedItem.Text)
{
case "&Run Sample": RunSample(this, (ExampleInfo)treeViewSamples.SelectedNode.Tag); break;
case "View Description": tabControlSample.SelectedTab = tabDescription; break;
case "View Source Code": tabControlSample.SelectedTab = tabSource; break;
}
}
#endregion
#region Description
private void richTextBoxDescription_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
richTextBoxDescription.ContextMenuStrip.Show(sender as Control, e.X, e.Y);
}
}
private void contextMenuStripDescription_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (e.ClickedItem.Text == "&Copy")
{
Clipboard.SetText(richTextBoxDescription.SelectedRtf, TextDataFormat.Rtf);
}
}
#endregion
#region Source Code
private void richTextBoxSource_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
richTextBoxSource.ContextMenuStrip.Show(sender as Control, e.X, e.Y);
}
}
private void contextMenuStripSource_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
if (e.ClickedItem.Text == "&Copy")
{
Clipboard.SetText(richTextBoxSource.SelectedText, TextDataFormat.Text);
}
}
#endregion
#endregion
#region Actions
void LoadSamplesFromAssembly(Assembly assembly)
{
if (assembly == null)
throw new ArgumentNullException("assembly");
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
object[] attributes = type.GetCustomAttributes(false);
ExampleAttribute example = null;
foreach (object attr in attributes)
{
if (attr is ExampleAttribute)
{
example = (ExampleAttribute)attr;
if (example.Visible)
{
// Add this example to the sample TreeView.
// First check whether the ExampleCategory exists in the tree (and add it if it doesn't).
// Then add the example as a child node on this category.
if (!treeViewSamples.Nodes.ContainsKey(example.Category.ToString()))
{
int category_index = GetImageIndexForSample(imageListSampleCategories, example.Category.ToString(), String.Empty);
treeViewSamples.Nodes.Add(example.Category.ToString(), String.Format("{0} samples", example.Category),
category_index, category_index);
}
int image_index = GetImageIndexForSample(imageListSampleCategories, example.Category.ToString(), example.Subcategory);
TreeNode node = new TreeNode(example.Title, image_index, image_index);
node.Name = example.Title;
node.Tag = new ExampleInfo(type, example);
treeViewSamples.Nodes[example.Category.ToString()].Nodes.Add(node);
}
}
}
}
treeViewSamples.Sort();
}
void ActivateNode(TreeNode node)
{
if (node == null)
return;
if (node.Tag == null)
{
if (node.IsExpanded)
node.Collapse();
else
node.Expand();
}
else
{
tabControlSample.SelectedTab = tabPageOutput;
textBoxOutput.Clear();
RunSample(node.TreeView.TopLevelControl, (ExampleInfo)node.Tag);
}
}
static int GetImageIndexForSample(ImageList list, string category, string subcategory)
{
if (list == null)
throw new ArgumentNullException("list");
if (list.Images.ContainsKey(subcategory.ToString() + ".jpg"))
return list.Images.IndexOfKey(subcategory.ToString() + ".jpg");
if (list.Images.ContainsKey(category.ToString() + ".jpg"))
return list.Images.IndexOfKey(category.ToString() + ".jpg");
if (list.Images.ContainsKey(subcategory.ToString() + ".png"))
return list.Images.IndexOfKey(subcategory.ToString() + ".png");
if (list.Images.ContainsKey(category.ToString() + ".png"))
return list.Images.IndexOfKey(category.ToString() + ".png");
return 0;
}
static void RunSample(Control parent, ExampleInfo e)
{
if (e == null)
return;
MethodInfo main =
e.Example.GetMethod("Main", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ??
e.Example.GetMethod("Main", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof(object), typeof(object) }, null);
if (main != null)
{
try
{
if (parent != null)
{
parent.Visible = false;
Application.DoEvents();
}
Trace.WriteLine(String.Format("Launching sample: \"{0}\"", e.Attribute.Title));
Trace.WriteLine(String.Empty);
main.Invoke(null, null);
}
catch (TargetInvocationException expt)
{
string ex_info;
if (expt.InnerException != null)
ex_info = expt.InnerException.ToString();
else
ex_info = expt.ToString();
MessageBox.Show(ex_info, "An OpenTK example encountered an error.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Debug.Print(expt.ToString());
}
catch (NullReferenceException expt)
{
MessageBox.Show(expt.ToString(), "The Example launcher failed to load the example.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
finally
{
if (parent != null)
{
parent.Visible = true;
Application.DoEvents();
}
}
}
else
{
MessageBox.Show("The selected example does not define a Main method", "Entry point not found", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
#endregion
#endregion
}
}

View file

@ -1,26 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Examples
{
/// <summary>
/// Contains the information necessary to display and launch an example thorugh the ExampleLauncer.
/// </summary>
class ExampleInfo
{
public readonly Type Example;
public readonly ExampleAttribute Attribute;
public ExampleInfo(Type example, ExampleAttribute attr)
{
Example = example;
Attribute = attr;
}
public override string ToString()
{
return Attribute.ToString();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Examples
{
/// <summary>
/// Contains the information necessary to display and launch an example thorugh the ExampleLauncer.
/// </summary>
class ExampleInfo
{
public readonly Type Example;
public readonly ExampleAttribute Attribute;
public ExampleInfo(Type example, ExampleAttribute attr)
{
Example = example;
Attribute = attr;
}
public override string ToString()
{
return Attribute.ToString();
}
}
}

View file

@ -1,54 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Drawing;
namespace Examples
{
static class Program
{
[STAThread]
public static void Main()
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
using (Form browser = new ExampleBrowser())
{
try
{
if (File.Exists("debug.log"))
File.Delete("debug.log");
if (File.Exists("trace.log"))
File.Delete("trace.log");
}
catch (Exception expt)
{
MessageBox.Show("Could not access debug.log", expt.ToString());
}
Debug.Listeners.Clear();
Debug.Listeners.Add(new TextWriterTraceListener("debug.log"));
Debug.Listeners.Add(new ConsoleTraceListener());
Trace.Listeners.Clear();
Trace.Listeners.Add(new TextWriterTraceListener("debug.log"));
Trace.Listeners.Add(new ConsoleTraceListener());
Application.Run(browser);
}
}
catch (System.Security.SecurityException e)
{
MessageBox.Show("The Example Launcher failed to start, due to insufficient permissions. This may happen if you execute the application from a network share.", "OpenTK Example Launcher failed to start.",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Trace.WriteLine(e.ToString());
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Drawing;
namespace Examples
{
static class Program
{
[STAThread]
public static void Main()
{
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
using (Form browser = new ExampleBrowser())
{
try
{
if (File.Exists("debug.log"))
File.Delete("debug.log");
if (File.Exists("trace.log"))
File.Delete("trace.log");
}
catch (Exception expt)
{
MessageBox.Show("Could not access debug.log", expt.ToString());
}
Debug.Listeners.Clear();
Debug.Listeners.Add(new TextWriterTraceListener("debug.log"));
Debug.Listeners.Add(new ConsoleTraceListener());
Trace.Listeners.Clear();
Trace.Listeners.Add(new TextWriterTraceListener("debug.log"));
Trace.Listeners.Add(new ConsoleTraceListener());
Application.Run(browser);
}
}
catch (System.Security.SecurityException e)
{
MessageBox.Show("The Example Launcher failed to start, due to insufficient permissions. This may happen if you execute the application from a network share.", "OpenTK Example Launcher failed to start.",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Trace.WriteLine(e.ToString());
}
}
}
}

View file

@ -1,283 +1,283 @@
namespace Examples
{
partial class Parrot
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.comboBox_RecorderSelection = new System.Windows.Forms.ComboBox();
this.groupBox_RecorderParameters = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.numericUpDown_PlaybackGain = new System.Windows.Forms.NumericUpDown();
this.label_MONO16BIT = new System.Windows.Forms.Label();
this.label_RINGBUFFER = new System.Windows.Forms.Label();
this.label_FREQUENCY = new System.Windows.Forms.Label();
this.numericUpDown_BufferLength = new System.Windows.Forms.NumericUpDown();
this.numericUpDown_Frequency = new System.Windows.Forms.NumericUpDown();
this.groupBox_RecordingControls = new System.Windows.Forms.GroupBox();
this.label_SamplesConsumed = new System.Windows.Forms.Label();
this.button_Start = new System.Windows.Forms.Button();
this.timer_GetSamples = new System.Windows.Forms.Timer(this.components);
this.groupBox_RecorderParameters.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_PlaybackGain)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_BufferLength)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_Frequency)).BeginInit();
this.groupBox_RecordingControls.SuspendLayout();
this.SuspendLayout();
//
// comboBox_RecorderSelection
//
this.comboBox_RecorderSelection.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.comboBox_RecorderSelection.FormattingEnabled = true;
this.comboBox_RecorderSelection.Location = new System.Drawing.Point(6, 19);
this.comboBox_RecorderSelection.Name = "comboBox_RecorderSelection";
this.comboBox_RecorderSelection.Size = new System.Drawing.Size(216, 21);
this.comboBox_RecorderSelection.TabIndex = 0;
//
// groupBox_RecorderParameters
//
this.groupBox_RecorderParameters.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.groupBox_RecorderParameters.Controls.Add(this.label2);
this.groupBox_RecorderParameters.Controls.Add(this.label1);
this.groupBox_RecorderParameters.Controls.Add(this.numericUpDown_PlaybackGain);
this.groupBox_RecorderParameters.Controls.Add(this.label_MONO16BIT);
this.groupBox_RecorderParameters.Controls.Add(this.label_RINGBUFFER);
this.groupBox_RecorderParameters.Controls.Add(this.label_FREQUENCY);
this.groupBox_RecorderParameters.Controls.Add(this.numericUpDown_BufferLength);
this.groupBox_RecorderParameters.Controls.Add(this.numericUpDown_Frequency);
this.groupBox_RecorderParameters.Controls.Add(this.comboBox_RecorderSelection);
this.groupBox_RecorderParameters.Location = new System.Drawing.Point(12, 12);
this.groupBox_RecorderParameters.Name = "groupBox_RecorderParameters";
this.groupBox_RecorderParameters.Size = new System.Drawing.Size(228, 168);
this.groupBox_RecorderParameters.TabIndex = 2;
this.groupBox_RecorderParameters.TabStop = false;
this.groupBox_RecorderParameters.Text = "Recording Device Setup";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 132);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(74, 13);
this.label2.TabIndex = 105;
this.label2.Text = "Sample format";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 102);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(96, 13);
this.label1.TabIndex = 104;
this.label1.Text = "Playback gain (dB)";
//
// numericUpDown_PlaybackGain
//
this.numericUpDown_PlaybackGain.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDown_PlaybackGain.Location = new System.Drawing.Point(145, 100);
this.numericUpDown_PlaybackGain.Maximum = new decimal(new int[] {
64,
0,
0,
0});
this.numericUpDown_PlaybackGain.Minimum = new decimal(new int[] {
1,
0,
0,
65536});
this.numericUpDown_PlaybackGain.Name = "numericUpDown_PlaybackGain";
this.numericUpDown_PlaybackGain.Size = new System.Drawing.Size(76, 20);
this.numericUpDown_PlaybackGain.TabIndex = 103;
this.numericUpDown_PlaybackGain.ThousandsSeparator = true;
this.numericUpDown_PlaybackGain.Value = new decimal(new int[] {
4,
0,
0,
0});
//
// label_MONO16BIT
//
this.label_MONO16BIT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label_MONO16BIT.AutoSize = true;
this.label_MONO16BIT.Location = new System.Drawing.Point(142, 132);
this.label_MONO16BIT.Name = "label_MONO16BIT";
this.label_MONO16BIT.Size = new System.Drawing.Size(64, 13);
this.label_MONO16BIT.TabIndex = 102;
this.label_MONO16BIT.Text = "Mono 16 Bit";
//
// label_RINGBUFFER
//
this.label_RINGBUFFER.AutoSize = true;
this.label_RINGBUFFER.Location = new System.Drawing.Point(6, 76);
this.label_RINGBUFFER.Name = "label_RINGBUFFER";
this.label_RINGBUFFER.Size = new System.Drawing.Size(89, 13);
this.label_RINGBUFFER.TabIndex = 101;
this.label_RINGBUFFER.Text = "Buffer length (ms)";
//
// label_FREQUENCY
//
this.label_FREQUENCY.AutoSize = true;
this.label_FREQUENCY.Location = new System.Drawing.Point(6, 50);
this.label_FREQUENCY.Name = "label_FREQUENCY";
this.label_FREQUENCY.Size = new System.Drawing.Size(85, 13);
this.label_FREQUENCY.TabIndex = 100;
this.label_FREQUENCY.Text = "Sample rate (Hz)";
//
// numericUpDown_BufferLength
//
this.numericUpDown_BufferLength.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDown_BufferLength.Location = new System.Drawing.Point(145, 74);
this.numericUpDown_BufferLength.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.numericUpDown_BufferLength.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown_BufferLength.Name = "numericUpDown_BufferLength";
this.numericUpDown_BufferLength.Size = new System.Drawing.Size(76, 20);
this.numericUpDown_BufferLength.TabIndex = 2;
this.numericUpDown_BufferLength.ThousandsSeparator = true;
this.numericUpDown_BufferLength.Value = new decimal(new int[] {
50,
0,
0,
0});
//
// numericUpDown_Frequency
//
this.numericUpDown_Frequency.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDown_Frequency.Location = new System.Drawing.Point(145, 48);
this.numericUpDown_Frequency.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.numericUpDown_Frequency.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown_Frequency.Name = "numericUpDown_Frequency";
this.numericUpDown_Frequency.Size = new System.Drawing.Size(76, 20);
this.numericUpDown_Frequency.TabIndex = 1;
this.numericUpDown_Frequency.ThousandsSeparator = true;
this.numericUpDown_Frequency.Value = new decimal(new int[] {
16000,
0,
0,
0});
//
// groupBox_RecordingControls
//
this.groupBox_RecordingControls.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.groupBox_RecordingControls.Controls.Add(this.label_SamplesConsumed);
this.groupBox_RecordingControls.Controls.Add(this.button_Start);
this.groupBox_RecordingControls.Location = new System.Drawing.Point(12, 186);
this.groupBox_RecordingControls.Name = "groupBox_RecordingControls";
this.groupBox_RecordingControls.Size = new System.Drawing.Size(228, 78);
this.groupBox_RecordingControls.TabIndex = 3;
this.groupBox_RecordingControls.TabStop = false;
this.groupBox_RecordingControls.Text = "Talk to the parrot";
//
// label_SamplesConsumed
//
this.label_SamplesConsumed.AutoSize = true;
this.label_SamplesConsumed.Location = new System.Drawing.Point(6, 52);
this.label_SamplesConsumed.Name = "label_SamplesConsumed";
this.label_SamplesConsumed.Size = new System.Drawing.Size(108, 13);
this.label_SamplesConsumed.TabIndex = 103;
this.label_SamplesConsumed.Text = "Samples consumed: -";
//
// button_Start
//
this.button_Start.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.button_Start.Location = new System.Drawing.Point(35, 19);
this.button_Start.Name = "button_Start";
this.button_Start.Size = new System.Drawing.Size(159, 24);
this.button_Start.TabIndex = 3;
this.button_Start.Text = "Start recording";
this.button_Start.UseVisualStyleBackColor = true;
this.button_Start.Click += new System.EventHandler(this.button_Start_Click);
//
// timer_GetSamples
//
this.timer_GetSamples.Tick += new System.EventHandler(this.timer_UpdateSamples_Tick);
//
// Parrot
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(252, 276);
this.Controls.Add(this.groupBox_RecordingControls);
this.Controls.Add(this.groupBox_RecorderParameters);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "Parrot";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "OpenAL Parrot";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Parrot_FormClosing);
this.groupBox_RecorderParameters.ResumeLayout(false);
this.groupBox_RecorderParameters.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_PlaybackGain)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_BufferLength)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_Frequency)).EndInit();
this.groupBox_RecordingControls.ResumeLayout(false);
this.groupBox_RecordingControls.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox comboBox_RecorderSelection;
private System.Windows.Forms.GroupBox groupBox_RecorderParameters;
private System.Windows.Forms.Label label_RINGBUFFER;
private System.Windows.Forms.Label label_FREQUENCY;
private System.Windows.Forms.NumericUpDown numericUpDown_BufferLength;
private System.Windows.Forms.NumericUpDown numericUpDown_Frequency;
private System.Windows.Forms.GroupBox groupBox_RecordingControls;
private System.Windows.Forms.Label label_SamplesConsumed;
private System.Windows.Forms.Button button_Start;
private System.Windows.Forms.Label label_MONO16BIT;
private System.Windows.Forms.Timer timer_GetSamples;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.NumericUpDown numericUpDown_PlaybackGain;
private System.Windows.Forms.Label label2;
}
}
namespace Examples
{
partial class Parrot
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.comboBox_RecorderSelection = new System.Windows.Forms.ComboBox();
this.groupBox_RecorderParameters = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.numericUpDown_PlaybackGain = new System.Windows.Forms.NumericUpDown();
this.label_MONO16BIT = new System.Windows.Forms.Label();
this.label_RINGBUFFER = new System.Windows.Forms.Label();
this.label_FREQUENCY = new System.Windows.Forms.Label();
this.numericUpDown_BufferLength = new System.Windows.Forms.NumericUpDown();
this.numericUpDown_Frequency = new System.Windows.Forms.NumericUpDown();
this.groupBox_RecordingControls = new System.Windows.Forms.GroupBox();
this.label_SamplesConsumed = new System.Windows.Forms.Label();
this.button_Start = new System.Windows.Forms.Button();
this.timer_GetSamples = new System.Windows.Forms.Timer(this.components);
this.groupBox_RecorderParameters.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_PlaybackGain)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_BufferLength)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_Frequency)).BeginInit();
this.groupBox_RecordingControls.SuspendLayout();
this.SuspendLayout();
//
// comboBox_RecorderSelection
//
this.comboBox_RecorderSelection.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.comboBox_RecorderSelection.FormattingEnabled = true;
this.comboBox_RecorderSelection.Location = new System.Drawing.Point(6, 19);
this.comboBox_RecorderSelection.Name = "comboBox_RecorderSelection";
this.comboBox_RecorderSelection.Size = new System.Drawing.Size(216, 21);
this.comboBox_RecorderSelection.TabIndex = 0;
//
// groupBox_RecorderParameters
//
this.groupBox_RecorderParameters.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.groupBox_RecorderParameters.Controls.Add(this.label2);
this.groupBox_RecorderParameters.Controls.Add(this.label1);
this.groupBox_RecorderParameters.Controls.Add(this.numericUpDown_PlaybackGain);
this.groupBox_RecorderParameters.Controls.Add(this.label_MONO16BIT);
this.groupBox_RecorderParameters.Controls.Add(this.label_RINGBUFFER);
this.groupBox_RecorderParameters.Controls.Add(this.label_FREQUENCY);
this.groupBox_RecorderParameters.Controls.Add(this.numericUpDown_BufferLength);
this.groupBox_RecorderParameters.Controls.Add(this.numericUpDown_Frequency);
this.groupBox_RecorderParameters.Controls.Add(this.comboBox_RecorderSelection);
this.groupBox_RecorderParameters.Location = new System.Drawing.Point(12, 12);
this.groupBox_RecorderParameters.Name = "groupBox_RecorderParameters";
this.groupBox_RecorderParameters.Size = new System.Drawing.Size(228, 168);
this.groupBox_RecorderParameters.TabIndex = 2;
this.groupBox_RecorderParameters.TabStop = false;
this.groupBox_RecorderParameters.Text = "Recording Device Setup";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 132);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(74, 13);
this.label2.TabIndex = 105;
this.label2.Text = "Sample format";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 102);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(96, 13);
this.label1.TabIndex = 104;
this.label1.Text = "Playback gain (dB)";
//
// numericUpDown_PlaybackGain
//
this.numericUpDown_PlaybackGain.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDown_PlaybackGain.Location = new System.Drawing.Point(145, 100);
this.numericUpDown_PlaybackGain.Maximum = new decimal(new int[] {
64,
0,
0,
0});
this.numericUpDown_PlaybackGain.Minimum = new decimal(new int[] {
1,
0,
0,
65536});
this.numericUpDown_PlaybackGain.Name = "numericUpDown_PlaybackGain";
this.numericUpDown_PlaybackGain.Size = new System.Drawing.Size(76, 20);
this.numericUpDown_PlaybackGain.TabIndex = 103;
this.numericUpDown_PlaybackGain.ThousandsSeparator = true;
this.numericUpDown_PlaybackGain.Value = new decimal(new int[] {
4,
0,
0,
0});
//
// label_MONO16BIT
//
this.label_MONO16BIT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label_MONO16BIT.AutoSize = true;
this.label_MONO16BIT.Location = new System.Drawing.Point(142, 132);
this.label_MONO16BIT.Name = "label_MONO16BIT";
this.label_MONO16BIT.Size = new System.Drawing.Size(64, 13);
this.label_MONO16BIT.TabIndex = 102;
this.label_MONO16BIT.Text = "Mono 16 Bit";
//
// label_RINGBUFFER
//
this.label_RINGBUFFER.AutoSize = true;
this.label_RINGBUFFER.Location = new System.Drawing.Point(6, 76);
this.label_RINGBUFFER.Name = "label_RINGBUFFER";
this.label_RINGBUFFER.Size = new System.Drawing.Size(89, 13);
this.label_RINGBUFFER.TabIndex = 101;
this.label_RINGBUFFER.Text = "Buffer length (ms)";
//
// label_FREQUENCY
//
this.label_FREQUENCY.AutoSize = true;
this.label_FREQUENCY.Location = new System.Drawing.Point(6, 50);
this.label_FREQUENCY.Name = "label_FREQUENCY";
this.label_FREQUENCY.Size = new System.Drawing.Size(85, 13);
this.label_FREQUENCY.TabIndex = 100;
this.label_FREQUENCY.Text = "Sample rate (Hz)";
//
// numericUpDown_BufferLength
//
this.numericUpDown_BufferLength.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDown_BufferLength.Location = new System.Drawing.Point(145, 74);
this.numericUpDown_BufferLength.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.numericUpDown_BufferLength.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown_BufferLength.Name = "numericUpDown_BufferLength";
this.numericUpDown_BufferLength.Size = new System.Drawing.Size(76, 20);
this.numericUpDown_BufferLength.TabIndex = 2;
this.numericUpDown_BufferLength.ThousandsSeparator = true;
this.numericUpDown_BufferLength.Value = new decimal(new int[] {
50,
0,
0,
0});
//
// numericUpDown_Frequency
//
this.numericUpDown_Frequency.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDown_Frequency.Location = new System.Drawing.Point(145, 48);
this.numericUpDown_Frequency.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.numericUpDown_Frequency.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown_Frequency.Name = "numericUpDown_Frequency";
this.numericUpDown_Frequency.Size = new System.Drawing.Size(76, 20);
this.numericUpDown_Frequency.TabIndex = 1;
this.numericUpDown_Frequency.ThousandsSeparator = true;
this.numericUpDown_Frequency.Value = new decimal(new int[] {
16000,
0,
0,
0});
//
// groupBox_RecordingControls
//
this.groupBox_RecordingControls.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.groupBox_RecordingControls.Controls.Add(this.label_SamplesConsumed);
this.groupBox_RecordingControls.Controls.Add(this.button_Start);
this.groupBox_RecordingControls.Location = new System.Drawing.Point(12, 186);
this.groupBox_RecordingControls.Name = "groupBox_RecordingControls";
this.groupBox_RecordingControls.Size = new System.Drawing.Size(228, 78);
this.groupBox_RecordingControls.TabIndex = 3;
this.groupBox_RecordingControls.TabStop = false;
this.groupBox_RecordingControls.Text = "Talk to the parrot";
//
// label_SamplesConsumed
//
this.label_SamplesConsumed.AutoSize = true;
this.label_SamplesConsumed.Location = new System.Drawing.Point(6, 52);
this.label_SamplesConsumed.Name = "label_SamplesConsumed";
this.label_SamplesConsumed.Size = new System.Drawing.Size(108, 13);
this.label_SamplesConsumed.TabIndex = 103;
this.label_SamplesConsumed.Text = "Samples consumed: -";
//
// button_Start
//
this.button_Start.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.button_Start.Location = new System.Drawing.Point(35, 19);
this.button_Start.Name = "button_Start";
this.button_Start.Size = new System.Drawing.Size(159, 24);
this.button_Start.TabIndex = 3;
this.button_Start.Text = "Start recording";
this.button_Start.UseVisualStyleBackColor = true;
this.button_Start.Click += new System.EventHandler(this.button_Start_Click);
//
// timer_GetSamples
//
this.timer_GetSamples.Tick += new System.EventHandler(this.timer_UpdateSamples_Tick);
//
// Parrot
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(252, 276);
this.Controls.Add(this.groupBox_RecordingControls);
this.Controls.Add(this.groupBox_RecorderParameters);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "Parrot";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "OpenAL Parrot";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Parrot_FormClosing);
this.groupBox_RecorderParameters.ResumeLayout(false);
this.groupBox_RecorderParameters.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_PlaybackGain)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_BufferLength)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown_Frequency)).EndInit();
this.groupBox_RecordingControls.ResumeLayout(false);
this.groupBox_RecordingControls.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox comboBox_RecorderSelection;
private System.Windows.Forms.GroupBox groupBox_RecorderParameters;
private System.Windows.Forms.Label label_RINGBUFFER;
private System.Windows.Forms.Label label_FREQUENCY;
private System.Windows.Forms.NumericUpDown numericUpDown_BufferLength;
private System.Windows.Forms.NumericUpDown numericUpDown_Frequency;
private System.Windows.Forms.GroupBox groupBox_RecordingControls;
private System.Windows.Forms.Label label_SamplesConsumed;
private System.Windows.Forms.Button button_Start;
private System.Windows.Forms.Label label_MONO16BIT;
private System.Windows.Forms.Timer timer_GetSamples;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.NumericUpDown numericUpDown_PlaybackGain;
private System.Windows.Forms.Label label2;
}
}

View file

@ -1,239 +1,239 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using OpenTK;
using OpenTK.Audio;
using OpenTK.Audio.OpenAL;
namespace Examples
{
[Example("Parrot Audio Capture", ExampleCategory.OpenAL, "1.1", Documentation = "Parrot")]
public partial class Parrot : Form
{
#region Fields
AudioContext audio_context;
AudioCapture audio_capture;
int src;
short[] buffer = new short[512];
const byte SampleToByte = 2;
#endregion
#region Constructors
public Parrot()
{
InitializeComponent();
this.Text = "OpenAL Parrot (" + (IntPtr.Size == 4 ? "x86" : "x64") + ")";
// Add available capture devices to the combo box.
IList<string> recorders = AudioCapture.AvailableDevices;
for (int i = 0; i < recorders.Count; i++)
{
if (!String.IsNullOrEmpty(recorders[i]))
comboBox_RecorderSelection.Items.Add(recorders[i]);
}
if (comboBox_RecorderSelection.Items.Count > 0)
comboBox_RecorderSelection.SelectedIndex = 0;
}
#endregion
#region Events
private void button_Start_Click(object sender, EventArgs e)
{
if (audio_capture == null || !audio_capture.IsRunning)
{
button_Start.Text = "Stop Recording";
groupBox_RecorderParameters.Enabled = false;
this.StartRecording();
}
else
{
button_Start.Text = "Start Recording";
groupBox_RecorderParameters.Enabled = true;
this.StopRecording();
}
}
private void timer_UpdateSamples_Tick(object sender, EventArgs e)
{
this.UpdateSamples();
}
private void Parrot_FormClosing(object sender, FormClosingEventArgs e)
{
this.StopRecording();
}
#endregion
#region Private Members
void StartRecording()
{
try
{
audio_context = new AudioContext();
}
catch (AudioException ae)
{
MessageBox.Show("Fatal: Cannot continue without a playback device.\nException caught when opening playback device.\n" + ae.Message);
Application.Exit();
}
AL.Listener(ALListenerf.Gain, (float)numericUpDown_PlaybackGain.Value);
src = AL.GenSource();
int sampling_rate = (int)numericUpDown_Frequency.Value;
double buffer_length_ms = (double)numericUpDown_BufferLength.Value;
int buffer_length_samples = (int)((double)numericUpDown_BufferLength.Value * sampling_rate * 0.001 / BlittableValueType.StrideOf(buffer));
try
{
audio_capture = new AudioCapture((string)comboBox_RecorderSelection.SelectedItem,
sampling_rate, ALFormat.Mono16, buffer_length_samples);
}
catch (AudioDeviceException ade)
{
MessageBox.Show("Exception caught when opening recording device.\n" + ade.Message);
audio_capture = null;
}
if (audio_capture == null)
return;
audio_capture.Start();
timer_GetSamples.Start();
timer_GetSamples.Interval = (int)(buffer_length_ms / 2 + 0.5); // Tick when half the buffer is full.
}
void StopRecording()
{
timer_GetSamples.Stop();
if (audio_capture != null)
{
audio_capture.Stop();
audio_capture.Dispose();
audio_capture = null;
}
if (audio_context != null)
{
int r;
AL.GetSource(src, ALGetSourcei.BuffersQueued, out r);
ClearBuffers(r);
AL.DeleteSource(src);
audio_context.Dispose();
audio_context = null;
}
}
void UpdateSamples()
{
if (audio_capture == null)
return;
int available_samples = audio_capture.AvailableSamples;
if (available_samples * SampleToByte > buffer.Length * BlittableValueType.StrideOf(buffer))
{
buffer = new short[MathHelper.NextPowerOfTwo(
(int)(available_samples * SampleToByte / (double)BlittableValueType.StrideOf(buffer) + 0.5))];
}
if (available_samples > 0)
{
audio_capture.ReadSamples(buffer, available_samples);
int buf = AL.GenBuffer();
AL.BufferData(buf, ALFormat.Mono16, buffer, (int)(available_samples * BlittableValueType.StrideOf(buffer)), audio_capture.SampleFrequency);
AL.SourceQueueBuffer(src, buf);
label_SamplesConsumed.Text = "Samples consumed: " + available_samples;
if (AL.GetSourceState(src) != ALSourceState.Playing)
AL.SourcePlay(src);
}
ClearBuffers(0);
}
void ClearBuffers(int input)
{
if (audio_context == null || audio_context == null)
return;
int[] freedbuffers;
if (input == 0)
{
int BuffersProcessed;
AL.GetSource(src, ALGetSourcei.BuffersProcessed, out BuffersProcessed);
if (BuffersProcessed == 0)
return;
freedbuffers = AL.SourceUnqueueBuffers(src, BuffersProcessed);
}
else
{
freedbuffers = AL.SourceUnqueueBuffers(src, input);
}
AL.DeleteBuffers(freedbuffers);
}
#endregion
#region Main
[STAThread]
static void Main()
{
using (Parrot parrot = new Parrot())
{
parrot.ShowDialog();
}
}
#endregion
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using OpenTK;
using OpenTK.Audio;
using OpenTK.Audio.OpenAL;
namespace Examples
{
[Example("Parrot Audio Capture", ExampleCategory.OpenAL, "1.1", Documentation = "Parrot")]
public partial class Parrot : Form
{
#region Fields
AudioContext audio_context;
AudioCapture audio_capture;
int src;
short[] buffer = new short[512];
const byte SampleToByte = 2;
#endregion
#region Constructors
public Parrot()
{
InitializeComponent();
this.Text = "OpenAL Parrot (" + (IntPtr.Size == 4 ? "x86" : "x64") + ")";
// Add available capture devices to the combo box.
IList<string> recorders = AudioCapture.AvailableDevices;
for (int i = 0; i < recorders.Count; i++)
{
if (!String.IsNullOrEmpty(recorders[i]))
comboBox_RecorderSelection.Items.Add(recorders[i]);
}
if (comboBox_RecorderSelection.Items.Count > 0)
comboBox_RecorderSelection.SelectedIndex = 0;
}
#endregion
#region Events
private void button_Start_Click(object sender, EventArgs e)
{
if (audio_capture == null || !audio_capture.IsRunning)
{
button_Start.Text = "Stop Recording";
groupBox_RecorderParameters.Enabled = false;
this.StartRecording();
}
else
{
button_Start.Text = "Start Recording";
groupBox_RecorderParameters.Enabled = true;
this.StopRecording();
}
}
private void timer_UpdateSamples_Tick(object sender, EventArgs e)
{
this.UpdateSamples();
}
private void Parrot_FormClosing(object sender, FormClosingEventArgs e)
{
this.StopRecording();
}
#endregion
#region Private Members
void StartRecording()
{
try
{
audio_context = new AudioContext();
}
catch (AudioException ae)
{
MessageBox.Show("Fatal: Cannot continue without a playback device.\nException caught when opening playback device.\n" + ae.Message);
Application.Exit();
}
AL.Listener(ALListenerf.Gain, (float)numericUpDown_PlaybackGain.Value);
src = AL.GenSource();
int sampling_rate = (int)numericUpDown_Frequency.Value;
double buffer_length_ms = (double)numericUpDown_BufferLength.Value;
int buffer_length_samples = (int)((double)numericUpDown_BufferLength.Value * sampling_rate * 0.001 / BlittableValueType.StrideOf(buffer));
try
{
audio_capture = new AudioCapture((string)comboBox_RecorderSelection.SelectedItem,
sampling_rate, ALFormat.Mono16, buffer_length_samples);
}
catch (AudioDeviceException ade)
{
MessageBox.Show("Exception caught when opening recording device.\n" + ade.Message);
audio_capture = null;
}
if (audio_capture == null)
return;
audio_capture.Start();
timer_GetSamples.Start();
timer_GetSamples.Interval = (int)(buffer_length_ms / 2 + 0.5); // Tick when half the buffer is full.
}
void StopRecording()
{
timer_GetSamples.Stop();
if (audio_capture != null)
{
audio_capture.Stop();
audio_capture.Dispose();
audio_capture = null;
}
if (audio_context != null)
{
int r;
AL.GetSource(src, ALGetSourcei.BuffersQueued, out r);
ClearBuffers(r);
AL.DeleteSource(src);
audio_context.Dispose();
audio_context = null;
}
}
void UpdateSamples()
{
if (audio_capture == null)
return;
int available_samples = audio_capture.AvailableSamples;
if (available_samples * SampleToByte > buffer.Length * BlittableValueType.StrideOf(buffer))
{
buffer = new short[MathHelper.NextPowerOfTwo(
(int)(available_samples * SampleToByte / (double)BlittableValueType.StrideOf(buffer) + 0.5))];
}
if (available_samples > 0)
{
audio_capture.ReadSamples(buffer, available_samples);
int buf = AL.GenBuffer();
AL.BufferData(buf, ALFormat.Mono16, buffer, (int)(available_samples * BlittableValueType.StrideOf(buffer)), audio_capture.SampleFrequency);
AL.SourceQueueBuffer(src, buf);
label_SamplesConsumed.Text = "Samples consumed: " + available_samples;
if (AL.GetSourceState(src) != ALSourceState.Playing)
AL.SourcePlay(src);
}
ClearBuffers(0);
}
void ClearBuffers(int input)
{
if (audio_context == null || audio_context == null)
return;
int[] freedbuffers;
if (input == 0)
{
int BuffersProcessed;
AL.GetSource(src, ALGetSourcei.BuffersProcessed, out BuffersProcessed);
if (BuffersProcessed == 0)
return;
freedbuffers = AL.SourceUnqueueBuffers(src, BuffersProcessed);
}
else
{
freedbuffers = AL.SourceUnqueueBuffers(src, input);
}
AL.DeleteBuffers(freedbuffers);
}
#endregion
#region Main
[STAThread]
static void Main()
{
using (Parrot parrot = new Parrot())
{
parrot.ShowDialog();
}
}
#endregion
}
}

View file

@ -1,97 +1,97 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Threading;
using System.IO;
using OpenTK.Audio;
using OpenTK.Audio.OpenAL;
namespace Examples
{
[Example("EFX: Reverb", ExampleCategory.OpenAL, "EFX", Documentation="EFXReverb")]
public class ReverbExample
{
static readonly string filename = Path.Combine(Path.Combine("Data", "Audio"), "the_ring_that_fell.wav");
public static void Main()
{
using (AudioContext context = new AudioContext())
{
Console.WriteLine("Testing WaveReader({0}).ReadToEnd()", filename);
EffectsExtension efx = new EffectsExtension();
int buffer = AL.GenBuffer();
int source = AL.GenSource();
int state;
int effect = efx.GenEffect();
int slot = efx.GenAuxiliaryEffectSlot();
efx.BindEffect(effect, EfxEffectType.Reverb);
efx.Effect(effect, EfxEffectf.ReverbDecayTime, 3.0f);
efx.Effect(effect, EfxEffectf.ReverbDecayHFRatio, 0.91f);
efx.Effect(effect, EfxEffectf.ReverbDensity, 0.7f);
efx.Effect(effect, EfxEffectf.ReverbDiffusion, 0.9f);
efx.Effect(effect, EfxEffectf.ReverbRoomRolloffFactor, 3.1f);
efx.Effect(effect, EfxEffectf.ReverbReflectionsGain, 0.723f);
efx.Effect(effect, EfxEffectf.ReverbReflectionsDelay, 0.03f);
efx.Effect(effect, EfxEffectf.ReverbGain, 0.23f);
efx.AuxiliaryEffectSlot(slot, EfxAuxiliaryi.EffectslotEffect, effect);
int channels, bits, rate;
byte[] data = Playback.LoadWave(File.Open(filename, FileMode.Open), out channels, out bits, out rate);
AL.BufferData(buffer, Playback.GetSoundFormat(channels, bits), data, data.Length, rate);
AL.Source(source, ALSourcef.ConeOuterGain, 1.0f);
AL.Source(source, ALSourcei.Buffer, buffer);
AL.SourcePlay(source);
Console.Write("Playing");
// Query the source to find out when it stops playing.
do
{
Thread.Sleep(250);
Console.Write(".");
AL.GetSource(source, ALGetSourcei.SourceState, out state);
}
while ((ALSourceState)state == ALSourceState.Playing);
Console.WriteLine();
AL.SourceStop(source);
AL.DeleteSource(source);
AL.DeleteBuffer(buffer);
efx.DeleteEffect(effect);
efx.DeleteAuxiliaryEffectSlot(slot);
}
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Threading;
using System.IO;
using OpenTK.Audio;
using OpenTK.Audio.OpenAL;
namespace Examples
{
[Example("EFX: Reverb", ExampleCategory.OpenAL, "EFX", Documentation="EFXReverb")]
public class ReverbExample
{
static readonly string filename = Path.Combine(Path.Combine("Data", "Audio"), "the_ring_that_fell.wav");
public static void Main()
{
using (AudioContext context = new AudioContext())
{
Console.WriteLine("Testing WaveReader({0}).ReadToEnd()", filename);
EffectsExtension efx = new EffectsExtension();
int buffer = AL.GenBuffer();
int source = AL.GenSource();
int state;
int effect = efx.GenEffect();
int slot = efx.GenAuxiliaryEffectSlot();
efx.BindEffect(effect, EfxEffectType.Reverb);
efx.Effect(effect, EfxEffectf.ReverbDecayTime, 3.0f);
efx.Effect(effect, EfxEffectf.ReverbDecayHFRatio, 0.91f);
efx.Effect(effect, EfxEffectf.ReverbDensity, 0.7f);
efx.Effect(effect, EfxEffectf.ReverbDiffusion, 0.9f);
efx.Effect(effect, EfxEffectf.ReverbRoomRolloffFactor, 3.1f);
efx.Effect(effect, EfxEffectf.ReverbReflectionsGain, 0.723f);
efx.Effect(effect, EfxEffectf.ReverbReflectionsDelay, 0.03f);
efx.Effect(effect, EfxEffectf.ReverbGain, 0.23f);
efx.AuxiliaryEffectSlot(slot, EfxAuxiliaryi.EffectslotEffect, effect);
int channels, bits, rate;
byte[] data = Playback.LoadWave(File.Open(filename, FileMode.Open), out channels, out bits, out rate);
AL.BufferData(buffer, Playback.GetSoundFormat(channels, bits), data, data.Length, rate);
AL.Source(source, ALSourcef.ConeOuterGain, 1.0f);
AL.Source(source, ALSourcei.Buffer, buffer);
AL.SourcePlay(source);
Console.Write("Playing");
// Query the source to find out when it stops playing.
do
{
Thread.Sleep(250);
Console.Write(".");
AL.GetSource(source, ALGetSourcei.SourceState, out state);
}
while ((ALSourceState)state == ALSourceState.Playing);
Console.WriteLine();
AL.SourceStop(source);
AL.DeleteSource(source);
AL.DeleteBuffer(buffer);
efx.DeleteEffect(effect);
efx.DeleteAuxiliaryEffectSlot(slot);
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,115 +1,115 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Compute.CL10;
namespace Examples
{
using cl_context = IntPtr;
using cl_device_id = IntPtr;
using cl_command_queue = IntPtr;
using cl_program = IntPtr;
using cl_kernel = IntPtr;
using cl_mem = IntPtr;
[Example("Vector Addition", ExampleCategory.OpenCL, "1.0")]
class FFT
{
public static void Main()
{
const int cnBlockSize = 512;
const int cnBlocks = 3;
IntPtr cnDimension = new IntPtr(cnBlocks * cnBlockSize);
string sProgramSource = @"
__kernel void
vectorAdd(__global const float * a,
__global const float * b,
__global float * c)
{
// Vector element index
int nIndex = get_global_id(0);
c[nIndex] = a[nIndex] + b[nIndex];
}
";
ErrorCode error;
// create OpenCL device & context
cl_context hContext;
unsafe { hContext = CL.CreateContextFromType((ContextProperties*)null, DeviceTypeFlags.DeviceTypeDefault, IntPtr.Zero, IntPtr.Zero, &error); }
// query all devices available to the context
IntPtr nContextDescriptorSize;
CL.GetContextInfo(hContext, ContextInfo.ContextDevices, IntPtr.Zero, IntPtr.Zero, out nContextDescriptorSize);
cl_device_id[] aDevices = new cl_device_id[nContextDescriptorSize.ToInt32()];
unsafe
{
fixed (cl_device_id* ptr = aDevices)
{
IntPtr ret;
CL.GetContextInfo(hContext, ContextInfo.ContextDevices, nContextDescriptorSize, new IntPtr(ptr), out ret);
}
}
// create a command queue for first device the context reported
cl_command_queue hCmdQueue = CL.CreateCommandQueue(hContext, aDevices[0], (CommandQueueFlags)0, out error);
// create & compile program
cl_program hProgram;
unsafe { hProgram = CL.CreateProgramWithSource(hContext, 1, new string[] { sProgramSource }, null, &error); }
CL.BuildProgram(hProgram, 0, (IntPtr[])null, null, IntPtr.Zero, IntPtr.Zero);
// create kernel
cl_kernel hKernel = CL.CreateKernel(hProgram, "vectorAdd", out error);
// allocate host vectors
float[] A = new float[cnDimension.ToInt32()];
float[] B = new float[cnDimension.ToInt32()];
float[] C = new float[cnDimension.ToInt32()];
// initialize host memory
// randomInit(pA, cnDimension);
//randomInit(pB, cnDimension);
// allocate device memory
unsafe
{
fixed (float* pA = A)
fixed (float* pB = B)
fixed (float* pC = C)
{
cl_mem hDeviceMemA, hDeviceMemB, hDeviceMemC;
hDeviceMemA = CL.CreateBuffer(hContext,
MemFlags.MemReadOnly | MemFlags.MemCopyHostPtr,
new IntPtr(cnDimension.ToInt32() * sizeof(float)),
new IntPtr(pA),
out error);
hDeviceMemB = CL.CreateBuffer(hContext,
MemFlags.MemReadOnly | MemFlags.MemCopyHostPtr,
new IntPtr(cnDimension.ToInt32() * sizeof(float)),
new IntPtr(pA),
out error);
hDeviceMemC = CL.CreateBuffer(hContext,
MemFlags.MemWriteOnly,
new IntPtr(cnDimension.ToInt32() * sizeof(float)),
IntPtr.Zero,
out error);
// setup parameter values
CL.SetKernelArg(hKernel, 0, new IntPtr(sizeof(cl_mem)), new IntPtr(&hDeviceMemA));
CL.SetKernelArg(hKernel, 1, new IntPtr(sizeof(cl_mem)), new IntPtr(&hDeviceMemB));
CL.SetKernelArg(hKernel, 2, new IntPtr(sizeof(cl_mem)), new IntPtr(&hDeviceMemC));
// execute kernel
CL.EnqueueNDRangeKernel(hCmdQueue, hKernel, 1, null, &cnDimension, null, 0, null, null);
// copy results from device back to host
CL.EnqueueReadBuffer(hContext, hDeviceMemC, true, IntPtr.Zero,
new IntPtr(cnDimension.ToInt32() * sizeof(float)),
new IntPtr(pC), 0, null, (IntPtr[])null);
CL.ReleaseMemObject(hDeviceMemA);
CL.ReleaseMemObject(hDeviceMemB);
CL.ReleaseMemObject(hDeviceMemC);
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Compute.CL10;
namespace Examples
{
using cl_context = IntPtr;
using cl_device_id = IntPtr;
using cl_command_queue = IntPtr;
using cl_program = IntPtr;
using cl_kernel = IntPtr;
using cl_mem = IntPtr;
[Example("Vector Addition", ExampleCategory.OpenCL, "1.0")]
class FFT
{
public static void Main()
{
const int cnBlockSize = 512;
const int cnBlocks = 3;
IntPtr cnDimension = new IntPtr(cnBlocks * cnBlockSize);
string sProgramSource = @"
__kernel void
vectorAdd(__global const float * a,
__global const float * b,
__global float * c)
{
// Vector element index
int nIndex = get_global_id(0);
c[nIndex] = a[nIndex] + b[nIndex];
}
";
ErrorCode error;
// create OpenCL device & context
cl_context hContext;
unsafe { hContext = CL.CreateContextFromType((ContextProperties*)null, DeviceTypeFlags.DeviceTypeDefault, IntPtr.Zero, IntPtr.Zero, &error); }
// query all devices available to the context
IntPtr nContextDescriptorSize;
CL.GetContextInfo(hContext, ContextInfo.ContextDevices, IntPtr.Zero, IntPtr.Zero, out nContextDescriptorSize);
cl_device_id[] aDevices = new cl_device_id[nContextDescriptorSize.ToInt32()];
unsafe
{
fixed (cl_device_id* ptr = aDevices)
{
IntPtr ret;
CL.GetContextInfo(hContext, ContextInfo.ContextDevices, nContextDescriptorSize, new IntPtr(ptr), out ret);
}
}
// create a command queue for first device the context reported
cl_command_queue hCmdQueue = CL.CreateCommandQueue(hContext, aDevices[0], (CommandQueueFlags)0, out error);
// create & compile program
cl_program hProgram;
unsafe { hProgram = CL.CreateProgramWithSource(hContext, 1, new string[] { sProgramSource }, null, &error); }
CL.BuildProgram(hProgram, 0, (IntPtr[])null, null, IntPtr.Zero, IntPtr.Zero);
// create kernel
cl_kernel hKernel = CL.CreateKernel(hProgram, "vectorAdd", out error);
// allocate host vectors
float[] A = new float[cnDimension.ToInt32()];
float[] B = new float[cnDimension.ToInt32()];
float[] C = new float[cnDimension.ToInt32()];
// initialize host memory
// randomInit(pA, cnDimension);
//randomInit(pB, cnDimension);
// allocate device memory
unsafe
{
fixed (float* pA = A)
fixed (float* pB = B)
fixed (float* pC = C)
{
cl_mem hDeviceMemA, hDeviceMemB, hDeviceMemC;
hDeviceMemA = CL.CreateBuffer(hContext,
MemFlags.MemReadOnly | MemFlags.MemCopyHostPtr,
new IntPtr(cnDimension.ToInt32() * sizeof(float)),
new IntPtr(pA),
out error);
hDeviceMemB = CL.CreateBuffer(hContext,
MemFlags.MemReadOnly | MemFlags.MemCopyHostPtr,
new IntPtr(cnDimension.ToInt32() * sizeof(float)),
new IntPtr(pA),
out error);
hDeviceMemC = CL.CreateBuffer(hContext,
MemFlags.MemWriteOnly,
new IntPtr(cnDimension.ToInt32() * sizeof(float)),
IntPtr.Zero,
out error);
// setup parameter values
CL.SetKernelArg(hKernel, 0, new IntPtr(sizeof(cl_mem)), new IntPtr(&hDeviceMemA));
CL.SetKernelArg(hKernel, 1, new IntPtr(sizeof(cl_mem)), new IntPtr(&hDeviceMemB));
CL.SetKernelArg(hKernel, 2, new IntPtr(sizeof(cl_mem)), new IntPtr(&hDeviceMemC));
// execute kernel
CL.EnqueueNDRangeKernel(hCmdQueue, hKernel, 1, null, &cnDimension, null, 0, null, null);
// copy results from device back to host
CL.EnqueueReadBuffer(hContext, hDeviceMemC, true, IntPtr.Zero,
new IntPtr(cnDimension.ToInt32() * sizeof(float)),
new IntPtr(pC), 0, null, (IntPtr[])null);
CL.ReleaseMemObject(hDeviceMemA);
CL.ReleaseMemObject(hDeviceMemB);
CL.ReleaseMemObject(hDeviceMemC);
}
}
}
}
}

View file

@ -29,8 +29,8 @@ using System;
using System.Diagnostics;
using System.IO;
using OpenTK;
using OpenTK.Graphics;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace Examples.Tutorial

View file

@ -1,268 +1,268 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Diagnostics;
using System.Drawing;
using OpenTK;
using OpenTK.Input;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace Examples.Tutorial
{
[Example("Basic Geometry Shader", ExampleCategory.OpenGL, "GLSL", Documentation = "Simple usage of EXT_geometry_shader4")]
public class SimpleGeometryShader : GameWindow
{
public SimpleGeometryShader()
: base(800, 600)
{
}
int shaderProgram = 0;
public override void OnLoad(EventArgs e)
{
if (!GL.GetString(StringName.Extensions).Contains("EXT_geometry_shader4"))
{
System.Windows.Forms.MessageBox.Show(
"Your video card does not support EXT_geometry_shader4. Please update your drivers.",
"EXT_geometry_shader4 not supported",
System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
Exit();
throw new NotSupportedException();
}
// create a shader object.
shaderProgram = GL.CreateProgram();
// create shader objects for all three types.
int vert = GL.CreateShader(ShaderType.VertexShader);
int frag = GL.CreateShader(ShaderType.FragmentShader);
int geom = GL.CreateShader(ShaderType.GeometryShaderExt);
// GLSL for fragment shader.
String fragSource = @"
void main( void )
{
gl_FragColor = vec4(0, 1, 0, 0);
}
";
// GLSL for vertex shader.
String vertSource = @"
void main( void )
{
gl_Position = ftransform();
}
";
// GLSL for geometry shader.
// Note this is a version 1.20 shader
// Also note GL_EXT_geometry_shader4 must be enabled explicitly, correct
// OpenGL implementations should only have the new tokens, like
// EmitVertex and EndPrimitive, when this extension is enabled.
String geomSource = @"
#version 120
#extension GL_EXT_geometry_shader4 : enable
void main(void)
{
// variable to use in for loops
int i;
// Emit the original vertices without changing, making
// this part exactly the same as if no geometry shader
// was used.
for(i=0; i< gl_VerticesIn; i++)
{
gl_Position = gl_PositionIn[i];
EmitVertex();
}
// End the one primitive with the original vertices
EndPrimitive();
// Now we generate some more! This translates 0.2 over
// the positive x axis.
for(i=0; i< gl_VerticesIn; i++)
{
gl_Position = gl_PositionIn[i];
gl_Position.x += 0.2;
EmitVertex();
}
EndPrimitive();
}
";
// compile shaders.
compileShader(frag, fragSource);
compileShader(vert, vertSource);
compileShader(geom, geomSource);
// attach shaders and link the program.
GL.AttachShader(shaderProgram, frag);
GL.AttachShader(shaderProgram, vert);
GL.AttachShader(shaderProgram, geom);
// Set the input type of the primitives we are going to feed the geometry shader, this should be the same as
// the primitive type given to GL.Begin. If the types do not match a GL error will occur (todo: verify GL_INVALID_ENUM, on glBegin)
GL.Ext.ProgramParameter(shaderProgram, ExtGeometryShader4.GeometryInputTypeExt, (int)BeginMode.Lines);
// Set the output type of the geometry shader. Becasue we input Lines we will output LineStrip(s).
GL.Ext.ProgramParameter(shaderProgram, ExtGeometryShader4.GeometryOutputTypeExt, (int)BeginMode.LineStrip);
// We must tell the shader program how much vertices the geometry shader will output (at most).
// One simple way is to query the maximum and use that.
// NOTE: Make sure that the number of vertices * sum(components of active varyings) does not
// exceed MaxGeometryTotalOutputComponents.
GL.Ext.ProgramParameter(shaderProgram, ExtGeometryShader4.GeometryVerticesOutExt, 50);
// NOTE: calls to ProgramParameter do not take effect until you call LinkProgram.
GL.LinkProgram(shaderProgram);
// output link info log.
string info;
GL.GetProgramInfoLog(shaderProgram, out info);
Debug.WriteLine(info);
// Set clearcolor and bind the shader program.
GL.ClearColor(0.1f, 0.1f, 0.1f, 0.1f);
GL.UseProgram(shaderProgram);
// Set color to red. If the shader fails the fixed pipeline will be used and
// the lines will be red, if all is ok the fragment shader is used and they will be green.
GL.Color3(1.0f, 0, 0);
// Clean up resources. Note the program object is not deleted.
if (frag != 0)
GL.DeleteShader(frag);
if (vert != 0)
GL.DeleteShader(vert);
if (geom != 0)
GL.DeleteShader(geom);
}
/// <summary>
/// Helper method to avoid code duplication.
/// Compiles a shader and prints results using Debug.WriteLine.
/// </summary>
/// <param name="shader">A shader object, gotten from GL.CreateShader.</param>
/// <param name="source">The GLSL source to compile.</param>
void compileShader(int shader, string source)
{
GL.ShaderSource(shader, source);
GL.CompileShader(shader);
string info;
GL.GetShaderInfoLog(shader, out info);
Debug.WriteLine(info);
int compileResult;
GL.GetShader(shader, ShaderParameter.CompileStatus, out compileResult);
if (compileResult != 1)
{
Debug.WriteLine("Compile Error!");
Debug.WriteLine(source);
}
}
public override void OnUnload(EventArgs e)
{
if (shaderProgram != 0)
GL.DeleteProgram(shaderProgram);
base.OnUnload(e);
}
/// <summary>
/// Sets the viewport and projection matrix for orthographic projection.
/// </summary>
/// <param name="e">resize event args</param>
protected override void OnResize(EventArgs e)
{
GL.Viewport(ClientRectangle);
// Set projection matrix
GL.MatrixMode(MatrixMode.Projection);
OpenTK.Matrix4 ortho = OpenTK.Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, 1, -1);
GL.LoadMatrix(ref ortho);
// Set selector state back to matrix mode
GL.MatrixMode(MatrixMode.Modelview);
base.OnResize(e);
}
protected override void OnUpdateFrame(FrameEventArgs e)
{
base.OnUpdateFrame(e);
if (Keyboard[Key.Space])
{
ErrorCode err = GL.GetError();
//Console.WriteLine(err + " " + Glu.ErrorString((GluErrorCode)err));
Console.WriteLine("GL error code: {0}", err);
}
if (Keyboard[Key.Escape])
this.Exit();
}
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
// draw two vertical lines
GL.Begin(BeginMode.Lines);
{
// line one
GL.Vertex2(-0.5f, -0.5f);
GL.Vertex2(-0.5f, 0.5f);
// line two
GL.Vertex2(0.5f, 0.5f);
GL.Vertex2(0.5f, -0.5f);
}
GL.End();
this.SwapBuffers();
}
#region public static void Main()
/// <summary>
/// Entry point of this example.
/// </summary>
[STAThread]
public static void Main()
{
using (SimpleGeometryShader example = new SimpleGeometryShader())
{
Utilities.SetWindowTitle(example);
example.Run(30.0, 0.0);
}
}
#endregion
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Diagnostics;
using System.Drawing;
using OpenTK;
using OpenTK.Input;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace Examples.Tutorial
{
[Example("Basic Geometry Shader", ExampleCategory.OpenGL, "GLSL", Documentation = "Simple usage of EXT_geometry_shader4")]
public class SimpleGeometryShader : GameWindow
{
public SimpleGeometryShader()
: base(800, 600)
{
}
int shaderProgram = 0;
public override void OnLoad(EventArgs e)
{
if (!GL.GetString(StringName.Extensions).Contains("EXT_geometry_shader4"))
{
System.Windows.Forms.MessageBox.Show(
"Your video card does not support EXT_geometry_shader4. Please update your drivers.",
"EXT_geometry_shader4 not supported",
System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
Exit();
throw new NotSupportedException();
}
// create a shader object.
shaderProgram = GL.CreateProgram();
// create shader objects for all three types.
int vert = GL.CreateShader(ShaderType.VertexShader);
int frag = GL.CreateShader(ShaderType.FragmentShader);
int geom = GL.CreateShader(ShaderType.GeometryShaderExt);
// GLSL for fragment shader.
String fragSource = @"
void main( void )
{
gl_FragColor = vec4(0, 1, 0, 0);
}
";
// GLSL for vertex shader.
String vertSource = @"
void main( void )
{
gl_Position = ftransform();
}
";
// GLSL for geometry shader.
// Note this is a version 1.20 shader
// Also note GL_EXT_geometry_shader4 must be enabled explicitly, correct
// OpenGL implementations should only have the new tokens, like
// EmitVertex and EndPrimitive, when this extension is enabled.
String geomSource = @"
#version 120
#extension GL_EXT_geometry_shader4 : enable
void main(void)
{
// variable to use in for loops
int i;
// Emit the original vertices without changing, making
// this part exactly the same as if no geometry shader
// was used.
for(i=0; i< gl_VerticesIn; i++)
{
gl_Position = gl_PositionIn[i];
EmitVertex();
}
// End the one primitive with the original vertices
EndPrimitive();
// Now we generate some more! This translates 0.2 over
// the positive x axis.
for(i=0; i< gl_VerticesIn; i++)
{
gl_Position = gl_PositionIn[i];
gl_Position.x += 0.2;
EmitVertex();
}
EndPrimitive();
}
";
// compile shaders.
compileShader(frag, fragSource);
compileShader(vert, vertSource);
compileShader(geom, geomSource);
// attach shaders and link the program.
GL.AttachShader(shaderProgram, frag);
GL.AttachShader(shaderProgram, vert);
GL.AttachShader(shaderProgram, geom);
// Set the input type of the primitives we are going to feed the geometry shader, this should be the same as
// the primitive type given to GL.Begin. If the types do not match a GL error will occur (todo: verify GL_INVALID_ENUM, on glBegin)
GL.Ext.ProgramParameter(shaderProgram, ExtGeometryShader4.GeometryInputTypeExt, (int)BeginMode.Lines);
// Set the output type of the geometry shader. Becasue we input Lines we will output LineStrip(s).
GL.Ext.ProgramParameter(shaderProgram, ExtGeometryShader4.GeometryOutputTypeExt, (int)BeginMode.LineStrip);
// We must tell the shader program how much vertices the geometry shader will output (at most).
// One simple way is to query the maximum and use that.
// NOTE: Make sure that the number of vertices * sum(components of active varyings) does not
// exceed MaxGeometryTotalOutputComponents.
GL.Ext.ProgramParameter(shaderProgram, ExtGeometryShader4.GeometryVerticesOutExt, 50);
// NOTE: calls to ProgramParameter do not take effect until you call LinkProgram.
GL.LinkProgram(shaderProgram);
// output link info log.
string info;
GL.GetProgramInfoLog(shaderProgram, out info);
Debug.WriteLine(info);
// Set clearcolor and bind the shader program.
GL.ClearColor(0.1f, 0.1f, 0.1f, 0.1f);
GL.UseProgram(shaderProgram);
// Set color to red. If the shader fails the fixed pipeline will be used and
// the lines will be red, if all is ok the fragment shader is used and they will be green.
GL.Color3(1.0f, 0, 0);
// Clean up resources. Note the program object is not deleted.
if (frag != 0)
GL.DeleteShader(frag);
if (vert != 0)
GL.DeleteShader(vert);
if (geom != 0)
GL.DeleteShader(geom);
}
/// <summary>
/// Helper method to avoid code duplication.
/// Compiles a shader and prints results using Debug.WriteLine.
/// </summary>
/// <param name="shader">A shader object, gotten from GL.CreateShader.</param>
/// <param name="source">The GLSL source to compile.</param>
void compileShader(int shader, string source)
{
GL.ShaderSource(shader, source);
GL.CompileShader(shader);
string info;
GL.GetShaderInfoLog(shader, out info);
Debug.WriteLine(info);
int compileResult;
GL.GetShader(shader, ShaderParameter.CompileStatus, out compileResult);
if (compileResult != 1)
{
Debug.WriteLine("Compile Error!");
Debug.WriteLine(source);
}
}
public override void OnUnload(EventArgs e)
{
if (shaderProgram != 0)
GL.DeleteProgram(shaderProgram);
base.OnUnload(e);
}
/// <summary>
/// Sets the viewport and projection matrix for orthographic projection.
/// </summary>
/// <param name="e">resize event args</param>
protected override void OnResize(EventArgs e)
{
GL.Viewport(ClientRectangle);
// Set projection matrix
GL.MatrixMode(MatrixMode.Projection);
OpenTK.Matrix4 ortho = OpenTK.Matrix4.CreateOrthographicOffCenter(-1, 1, -1, 1, 1, -1);
GL.LoadMatrix(ref ortho);
// Set selector state back to matrix mode
GL.MatrixMode(MatrixMode.Modelview);
base.OnResize(e);
}
protected override void OnUpdateFrame(FrameEventArgs e)
{
base.OnUpdateFrame(e);
if (Keyboard[Key.Space])
{
ErrorCode err = GL.GetError();
//Console.WriteLine(err + " " + Glu.ErrorString((GluErrorCode)err));
Console.WriteLine("GL error code: {0}", err);
}
if (Keyboard[Key.Escape])
this.Exit();
}
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
// draw two vertical lines
GL.Begin(BeginMode.Lines);
{
// line one
GL.Vertex2(-0.5f, -0.5f);
GL.Vertex2(-0.5f, 0.5f);
// line two
GL.Vertex2(0.5f, 0.5f);
GL.Vertex2(0.5f, -0.5f);
}
GL.End();
this.SwapBuffers();
}
#region public static void Main()
/// <summary>
/// Entry point of this example.
/// </summary>
[STAThread]
public static void Main()
{
using (SimpleGeometryShader example = new SimpleGeometryShader())
{
Utilities.SetWindowTitle(example);
example.Run(30.0, 0.0);
}
}
#endregion
}
}

View file

@ -1,207 +1,207 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
#region Using Directives
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.ES11;
#endregion
namespace Examples.Tutorial
{
[Example("Immediate mode", ExampleCategory.OpenGLES, "1.1", Documentation = "SimpleES11Window")]
public class SimpleES11Window : GameWindow
{
#region --- Fields ---
float rotation_speed = 3.0f;
float angle;
#endregion
#region --- Constructor ---
public SimpleES11Window()
: base(800, 600, new GraphicsMode(16, 16), "", GameWindowFlags.Default, DisplayDevice.Default, 2, 0, GraphicsContextFlags.Embedded)
{ }
#endregion
#region OnLoad
public override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Color color = Color.MidnightBlue;
GL.ClearColor(color.R, color.G, color.B, color.A);
GL.Enable((All)EnableCap.DepthTest);
}
#endregion
#region OnResize
/// <summary>
/// Called when the user resizes the window.
/// </summary>
/// <param name="e">Contains the new width/height of the window.</param>
/// <remarks>
/// You want the OpenGL viewport to match the window. This is the place to do it!
/// </remarks>
protected override void OnResize(EventArgs e)
{
GL.Viewport(0, 0, Width, Height);
double aspect_ratio = Width / (double)Height;
OpenTK.Matrix4 perspective = OpenTK.Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, (float)aspect_ratio, 1, 64);
GL.MatrixMode((All)MatrixMode.Projection);
GL.LoadMatrix(ref perspective.Row0.X);
}
#endregion
#region OnUpdateFrame
/// <summary>
/// Prepares the next frame for rendering.
/// </summary>
/// <remarks>
/// Place your control logic here. This is the place to respond to user input,
/// update object positions etc.
/// </remarks>
protected override void OnUpdateFrame(FrameEventArgs e)
{
if (Keyboard[OpenTK.Input.Key.Escape])
{
this.Exit();
return;
}
}
#endregion
#region OnRenderFrame
/// <summary>
/// Place your rendering code here.
/// </summary>
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Clear((uint)(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit));
Matrix4 lookat = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
GL.MatrixMode((All)MatrixMode.Modelview);
GL.LoadMatrix(ref lookat.Row0.X);
angle += rotation_speed * (float)e.Time;
GL.Rotate(angle, 0.0f, 1.0f, 0.0f);
DrawCube();
this.SwapBuffers();
}
#endregion
#region private void DrawCube()
private void DrawCube()
{
#if false
GL.Begin(BeginMode.Quads);
GL.Color3(Color.Silver);
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(Color.Honeydew);
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(Color.Moccasin);
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(Color.IndianRed);
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(Color.PaleVioletRed);
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(Color.ForestGreen);
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.End();
#endif
}
#endregion
#region public static void Main()
/// <summary>
/// Entry point of this example.
/// </summary>
[STAThread]
public static void Main()
{
using (SimpleES11Window example = new SimpleES11Window())
{
Utilities.SetWindowTitle(example);
example.Run(30.0, 0.0);
}
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
#region Using Directives
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.ES11;
#endregion
namespace Examples.Tutorial
{
[Example("Immediate mode", ExampleCategory.OpenGLES, "1.1", Documentation = "SimpleES11Window")]
public class SimpleES11Window : GameWindow
{
#region --- Fields ---
float rotation_speed = 3.0f;
float angle;
#endregion
#region --- Constructor ---
public SimpleES11Window()
: base(800, 600, new GraphicsMode(16, 16), "", GameWindowFlags.Default, DisplayDevice.Default, 2, 0, GraphicsContextFlags.Embedded)
{ }
#endregion
#region OnLoad
public override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Color color = Color.MidnightBlue;
GL.ClearColor(color.R, color.G, color.B, color.A);
GL.Enable((All)EnableCap.DepthTest);
}
#endregion
#region OnResize
/// <summary>
/// Called when the user resizes the window.
/// </summary>
/// <param name="e">Contains the new width/height of the window.</param>
/// <remarks>
/// You want the OpenGL viewport to match the window. This is the place to do it!
/// </remarks>
protected override void OnResize(EventArgs e)
{
GL.Viewport(0, 0, Width, Height);
double aspect_ratio = Width / (double)Height;
OpenTK.Matrix4 perspective = OpenTK.Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, (float)aspect_ratio, 1, 64);
GL.MatrixMode((All)MatrixMode.Projection);
GL.LoadMatrix(ref perspective.Row0.X);
}
#endregion
#region OnUpdateFrame
/// <summary>
/// Prepares the next frame for rendering.
/// </summary>
/// <remarks>
/// Place your control logic here. This is the place to respond to user input,
/// update object positions etc.
/// </remarks>
protected override void OnUpdateFrame(FrameEventArgs e)
{
if (Keyboard[OpenTK.Input.Key.Escape])
{
this.Exit();
return;
}
}
#endregion
#region OnRenderFrame
/// <summary>
/// Place your rendering code here.
/// </summary>
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Clear((uint)(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit));
Matrix4 lookat = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
GL.MatrixMode((All)MatrixMode.Modelview);
GL.LoadMatrix(ref lookat.Row0.X);
angle += rotation_speed * (float)e.Time;
GL.Rotate(angle, 0.0f, 1.0f, 0.0f);
DrawCube();
this.SwapBuffers();
}
#endregion
#region private void DrawCube()
private void DrawCube()
{
#if false
GL.Begin(BeginMode.Quads);
GL.Color3(Color.Silver);
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(Color.Honeydew);
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(Color.Moccasin);
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(Color.IndianRed);
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(Color.PaleVioletRed);
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(Color.ForestGreen);
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.End();
#endif
}
#endregion
#region public static void Main()
/// <summary>
/// Entry point of this example.
/// </summary>
[STAThread]
public static void Main()
{
using (SimpleES11Window example = new SimpleES11Window())
{
Utilities.SetWindowTitle(example);
example.Run(30.0, 0.0);
}
}
#endregion
}
}

View file

@ -1,185 +1,185 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
#region Using Directives
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.ES20;
#endregion
namespace Examples.Tutorial
{
[Example("Immediate mode", ExampleCategory.OpenGLES, "2.0", Documentation = "SimpleES20Window")]
public class SimpleES20Window : GameWindow
{
#region Constructor
public SimpleES20Window()
: base(800, 600, new GraphicsMode(16, 16), "", GameWindowFlags.Default, DisplayDevice.Default, 2, 0, GraphicsContextFlags.Embedded)
{ }
#endregion
#region OnLoad
public override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Color color = Color.MidnightBlue;
GL.ClearColor(color.R, color.G, color.B, color.A);
GL.Enable((All)EnableCap.DepthTest);
}
#endregion
#region OnResize
/// <summary>
/// Called when the user resizes the window.
/// </summary>
/// <param name="e">Contains the new width/height of the window.</param>
/// <remarks>
/// You want the OpenGL viewport to match the window. This is the place to do it!
/// </remarks>
protected override void OnResize(EventArgs e)
{
GL.Viewport(0, 0, Width, Height);
}
#endregion
#region OnUpdateFrame
/// <summary>
/// Prepares the next frame for rendering.
/// </summary>
/// <remarks>
/// Place your control logic here. This is the place to respond to user input,
/// update object positions etc.
/// </remarks>
protected override void OnUpdateFrame(FrameEventArgs e)
{
if (Keyboard[OpenTK.Input.Key.Escape])
{
this.Exit();
return;
}
}
#endregion
#region OnRenderFrame
/// <summary>
/// Place your rendering code here.
/// </summary>
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Clear((uint)(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit));
this.SwapBuffers();
}
#endregion
#region private void DrawCube()
private void DrawCube()
{
#if false
GL.Begin(BeginMode.Quads);
GL.Color3(Color.Silver);
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(Color.Honeydew);
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(Color.Moccasin);
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(Color.IndianRed);
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(Color.PaleVioletRed);
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(Color.ForestGreen);
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.End();
#endif
}
#endregion
#region public static void Main()
/// <summary>
/// Entry point of this example.
/// </summary>
[STAThread]
public static void Main()
{
using (SimpleES20Window example = new SimpleES20Window())
{
Utilities.SetWindowTitle(example);
example.Run(30.0, 0.0);
}
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
#region Using Directives
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.ES20;
#endregion
namespace Examples.Tutorial
{
[Example("Immediate mode", ExampleCategory.OpenGLES, "2.0", Documentation = "SimpleES20Window")]
public class SimpleES20Window : GameWindow
{
#region Constructor
public SimpleES20Window()
: base(800, 600, new GraphicsMode(16, 16), "", GameWindowFlags.Default, DisplayDevice.Default, 2, 0, GraphicsContextFlags.Embedded)
{ }
#endregion
#region OnLoad
public override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Color color = Color.MidnightBlue;
GL.ClearColor(color.R, color.G, color.B, color.A);
GL.Enable((All)EnableCap.DepthTest);
}
#endregion
#region OnResize
/// <summary>
/// Called when the user resizes the window.
/// </summary>
/// <param name="e">Contains the new width/height of the window.</param>
/// <remarks>
/// You want the OpenGL viewport to match the window. This is the place to do it!
/// </remarks>
protected override void OnResize(EventArgs e)
{
GL.Viewport(0, 0, Width, Height);
}
#endregion
#region OnUpdateFrame
/// <summary>
/// Prepares the next frame for rendering.
/// </summary>
/// <remarks>
/// Place your control logic here. This is the place to respond to user input,
/// update object positions etc.
/// </remarks>
protected override void OnUpdateFrame(FrameEventArgs e)
{
if (Keyboard[OpenTK.Input.Key.Escape])
{
this.Exit();
return;
}
}
#endregion
#region OnRenderFrame
/// <summary>
/// Place your rendering code here.
/// </summary>
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Clear((uint)(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit));
this.SwapBuffers();
}
#endregion
#region private void DrawCube()
private void DrawCube()
{
#if false
GL.Begin(BeginMode.Quads);
GL.Color3(Color.Silver);
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(Color.Honeydew);
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(Color.Moccasin);
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(Color.IndianRed);
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(Color.PaleVioletRed);
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(Color.ForestGreen);
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.End();
#endif
}
#endregion
#region public static void Main()
/// <summary>
/// Entry point of this example.
/// </summary>
[STAThread]
public static void Main()
{
using (SimpleES20Window example = new SimpleES20Window())
{
Utilities.SetWindowTitle(example);
example.Run(30.0, 0.0);
}
}
#endregion
}
}

View file

@ -1,172 +1,172 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Input;
using System.Drawing;
namespace Examples
{
[Example("Fullscreen Antialiasing", ExampleCategory.OpenTK, "GameWindow", Documentation = "GameWindowFsaa")]
public class FullscreenAntialias : GameWindow
{
public FullscreenAntialias()
: base(800, 600, new GraphicsMode(32, 0, 0, 4))
{
Keyboard.KeyDown += delegate(KeyboardDevice sender, Key key)
{
if (sender[Key.Escape])
this.Exit();
if ((sender[Key.AltLeft] || sender[Key.AltRight]) && (sender[Key.Enter] || sender[Key.KeypadEnter]))
if (this.WindowState == WindowState.Fullscreen)
this.WindowState = WindowState.Normal;
else
this.WindowState = WindowState.Fullscreen;
};
}
#region Keyboard_KeyDown
/// <summary>
/// Occurs when a key is pressed.
/// </summary>
/// <param name="sender">The KeyboardDevice which generated this event.</param>
/// <param name="key">The key that was pressed.</param>
void Keyboard_KeyDown(KeyboardDevice sender, Key key)
{
if (sender[Key.Escape])
this.Exit();
if ((sender[Key.AltLeft] || sender[Key.AltRight]) && (sender[Key.Enter] || sender[Key.KeypadEnter]))
if (this.WindowState == WindowState.Fullscreen)
this.WindowState = WindowState.Normal;
else
this.WindowState = WindowState.Fullscreen;
}
#endregion
#region OnLoad
/// <summary>
/// Setup OpenGL and load resources here.
/// </summary>
/// <param name="e">Not used.</param>
public override void OnLoad(EventArgs e)
{
GL.ClearColor(Color.MidnightBlue);
}
#endregion
#region OnResize
/// <summary>
/// Respond to resize events here.
/// </summary>
/// <param name="e">Contains information on the new GameWindow size.</param>
/// <remarks>There is no need to call the base implementation.</remarks>
protected override void OnResize(EventArgs e)
{
GL.Viewport(0, 0, Width, Height);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(-1.0, 1.0, -1.0, 1.0, 0.0, 4.0);
base.OnResize(e);
}
#endregion
#region OnUpdateFrame
/// <summary>
/// Add your game logic here.
/// </summary>
/// <param name="e">Contains timing information.</param>
/// <remarks>There is no need to call the base implementation.</remarks>
protected override void OnUpdateFrame(FrameEventArgs e)
{
// Nothing to do!
}
#endregion
#region OnRenderFrame
/// <summary>
/// Add your game rendering code here.
/// </summary>
/// <param name="e">Contains timing information.</param>
/// <remarks>There is no need to call the base implementation.</remarks>
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Clear(ClearBufferMask.ColorBufferBit);
GL.Begin(BeginMode.Triangles);
GL.Color3(Color.MidnightBlue);
GL.Vertex2(-1.0f, 1.0f);
GL.Color3(Color.SpringGreen);
GL.Vertex2(0.0f, -1.0f);
GL.Color3(Color.Ivory);
GL.Vertex2(1.0f, 1.0f);
GL.End();
this.SwapBuffers();
}
#endregion
#region public static void Main()
/// <summary>
/// Entry point of this example.
/// </summary>
[STAThread]
public static void Main()
{
using (FullscreenAntialias example = new FullscreenAntialias())
{
// Get the title and category of this example using reflection.
Utilities.SetWindowTitle(example);
example.Run(30.0, 0.0);
}
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Input;
using System.Drawing;
namespace Examples
{
[Example("Fullscreen Antialiasing", ExampleCategory.OpenTK, "GameWindow", Documentation = "GameWindowFsaa")]
public class FullscreenAntialias : GameWindow
{
public FullscreenAntialias()
: base(800, 600, new GraphicsMode(32, 0, 0, 4))
{
Keyboard.KeyDown += delegate(KeyboardDevice sender, Key key)
{
if (sender[Key.Escape])
this.Exit();
if ((sender[Key.AltLeft] || sender[Key.AltRight]) && (sender[Key.Enter] || sender[Key.KeypadEnter]))
if (this.WindowState == WindowState.Fullscreen)
this.WindowState = WindowState.Normal;
else
this.WindowState = WindowState.Fullscreen;
};
}
#region Keyboard_KeyDown
/// <summary>
/// Occurs when a key is pressed.
/// </summary>
/// <param name="sender">The KeyboardDevice which generated this event.</param>
/// <param name="key">The key that was pressed.</param>
void Keyboard_KeyDown(KeyboardDevice sender, Key key)
{
if (sender[Key.Escape])
this.Exit();
if ((sender[Key.AltLeft] || sender[Key.AltRight]) && (sender[Key.Enter] || sender[Key.KeypadEnter]))
if (this.WindowState == WindowState.Fullscreen)
this.WindowState = WindowState.Normal;
else
this.WindowState = WindowState.Fullscreen;
}
#endregion
#region OnLoad
/// <summary>
/// Setup OpenGL and load resources here.
/// </summary>
/// <param name="e">Not used.</param>
public override void OnLoad(EventArgs e)
{
GL.ClearColor(Color.MidnightBlue);
}
#endregion
#region OnResize
/// <summary>
/// Respond to resize events here.
/// </summary>
/// <param name="e">Contains information on the new GameWindow size.</param>
/// <remarks>There is no need to call the base implementation.</remarks>
protected override void OnResize(EventArgs e)
{
GL.Viewport(0, 0, Width, Height);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(-1.0, 1.0, -1.0, 1.0, 0.0, 4.0);
base.OnResize(e);
}
#endregion
#region OnUpdateFrame
/// <summary>
/// Add your game logic here.
/// </summary>
/// <param name="e">Contains timing information.</param>
/// <remarks>There is no need to call the base implementation.</remarks>
protected override void OnUpdateFrame(FrameEventArgs e)
{
// Nothing to do!
}
#endregion
#region OnRenderFrame
/// <summary>
/// Add your game rendering code here.
/// </summary>
/// <param name="e">Contains timing information.</param>
/// <remarks>There is no need to call the base implementation.</remarks>
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Clear(ClearBufferMask.ColorBufferBit);
GL.Begin(BeginMode.Triangles);
GL.Color3(Color.MidnightBlue);
GL.Vertex2(-1.0f, 1.0f);
GL.Color3(Color.SpringGreen);
GL.Vertex2(0.0f, -1.0f);
GL.Color3(Color.Ivory);
GL.Vertex2(1.0f, 1.0f);
GL.End();
this.SwapBuffers();
}
#endregion
#region public static void Main()
/// <summary>
/// Entry point of this example.
/// </summary>
[STAThread]
public static void Main()
{
using (FullscreenAntialias example = new FullscreenAntialias())
{
// Get the title and category of this example using reflection.
Utilities.SetWindowTitle(example);
example.Run(30.0, 0.0);
}
}
#endregion
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,76 +1,76 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace Examples
{
class SamplesTreeViewSorter : IComparer<TreeNode>, IComparer
{
#region IComparer<TreeNode> Members
public int Compare(TreeNode x, TreeNode y)
{
ExampleInfo x_info = x.Tag as ExampleInfo;
ExampleInfo y_info = y.Tag as ExampleInfo;
if (x_info == null || y_info == null)
{
return x.Text.CompareTo(y.Text);
}
else
{
int result = x_info.Attribute.Category.CompareTo(y_info.Attribute.Category);
if (result == 0)
result = x_info.Attribute.Subcategory.CompareTo(y_info.Attribute.Subcategory);
if (result == 0)
result = x_info.Attribute.Difficulty.CompareTo(y_info.Attribute.Difficulty);
if (result == 0)
result = x_info.Attribute.Title.CompareTo(y_info.Attribute.Title);
return result;
}
}
#endregion
#region IComparer Members
public int Compare(object x, object y)
{
if (x is TreeNode && y is TreeNode)
return Compare(x as TreeNode, y as TreeNode);
else
return 0;
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace Examples
{
class SamplesTreeViewSorter : IComparer<TreeNode>, IComparer
{
#region IComparer<TreeNode> Members
public int Compare(TreeNode x, TreeNode y)
{
ExampleInfo x_info = x.Tag as ExampleInfo;
ExampleInfo y_info = y.Tag as ExampleInfo;
if (x_info == null || y_info == null)
{
return x.Text.CompareTo(y.Text);
}
else
{
int result = x_info.Attribute.Category.CompareTo(y_info.Attribute.Category);
if (result == 0)
result = x_info.Attribute.Subcategory.CompareTo(y_info.Attribute.Subcategory);
if (result == 0)
result = x_info.Attribute.Difficulty.CompareTo(y_info.Attribute.Difficulty);
if (result == 0)
result = x_info.Attribute.Title.CompareTo(y_info.Attribute.Title);
return result;
}
}
#endregion
#region IComparer Members
public int Compare(object x, object y)
{
if (x is TreeNode && y is TreeNode)
return Compare(x as TreeNode, y as TreeNode);
else
return 0;
}
#endregion
}
}

View file

@ -1,71 +1,71 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
namespace Examples
{
public class TextBoxTraceListener : TraceListener
{
TextBox _target;
StringSendDelegate _invokeWrite;
public TextBoxTraceListener(TextBox target)
{
_target = target;
_invokeWrite = new StringSendDelegate(SendString);
}
public override void Write(string message)
{
if (_target.Created)
_target.BeginInvoke(_invokeWrite, new object[] { message });
}
public override void WriteLine(string message)
{
if (_target.Created)
_target.BeginInvoke(_invokeWrite, new object[] { message + Environment.NewLine });
}
private delegate void StringSendDelegate(string message);
private void SendString(string message)
{
if (_target.Created)
{
// No need to lock text box as this function will only
// ever be executed from the UI thread
_target.Text += message;
}
}
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
namespace Examples
{
public class TextBoxTraceListener : TraceListener
{
TextBox _target;
StringSendDelegate _invokeWrite;
public TextBoxTraceListener(TextBox target)
{
_target = target;
_invokeWrite = new StringSendDelegate(SendString);
}
public override void Write(string message)
{
if (_target.Created)
_target.BeginInvoke(_invokeWrite, new object[] { message });
}
public override void WriteLine(string message)
{
if (_target.Created)
_target.BeginInvoke(_invokeWrite, new object[] { message + Environment.NewLine });
}
private delegate void StringSendDelegate(string message);
private void SendString(string message)
{
if (_target.Created)
{
// No need to lock text box as this function will only
// ever be executed from the UI thread
_target.Text += message;
}
}
}
}

View file

@ -1,77 +1,77 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
class CarbonGLControl : IGLControl
{
GraphicsMode mode;
Control control;
internal CarbonGLControl(GraphicsMode mode, Control owner)
{
this.mode = mode;
this.control = owner;
}
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
return new GraphicsContext(mode, WindowInfo, major, minor, flags);
}
// TODO: Fix this
bool lastIsIdle = false;
public bool IsIdle
{
get
{
lastIsIdle = !lastIsIdle;
return lastIsIdle;
}
}
public IWindowInfo WindowInfo
{
get
{
return Utilities.CreateWindowInfo(mode, control.Handle, true);
}
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
class CarbonGLControl : IGLControl
{
GraphicsMode mode;
Control control;
internal CarbonGLControl(GraphicsMode mode, Control owner)
{
this.mode = mode;
this.control = owner;
}
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
return new GraphicsContext(mode, WindowInfo, major, minor, flags);
}
// TODO: Fix this
bool lastIsIdle = false;
public bool IsIdle
{
get
{
lastIsIdle = !lastIsIdle;
return lastIsIdle;
}
}
public IWindowInfo WindowInfo
{
get
{
return Utilities.CreateWindowInfo(mode, control.Handle, true);
}
}
#endregion
}
}

View file

@ -1,55 +1,55 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
class DummyGLControl : IGLControl
{
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
return new GraphicsContext(null, null);
}
public bool IsIdle
{
get { return false; }
}
public IWindowInfo WindowInfo
{
get { return Utilities.CreateWindowInfo(null, IntPtr.Zero, true); }
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
class DummyGLControl : IGLControl
{
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
return new GraphicsContext(null, null);
}
public bool IsIdle
{
get { return false; }
}
public IWindowInfo WindowInfo
{
get { return Utilities.CreateWindowInfo(null, IntPtr.Zero, true); }
}
#endregion
}
}

View file

@ -1,45 +1,45 @@
namespace OpenTK
{
partial class GLControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// NewGLControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.Name = "NewGLControl";
this.ResumeLayout(false);
}
#endregion
}
}
namespace OpenTK
{
partial class GLControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// NewGLControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.Name = "NewGLControl";
this.ResumeLayout(false);
}
#endregion
}
}

View file

@ -1,355 +1,355 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using OpenTK.Platform;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace OpenTK
{
/// <summary>
/// Defines a UserControl with OpenGL rendering capabilities.
/// </summary>
public partial class GLControl : UserControl
{
IGraphicsContext context;
IGLControl implementation;
GraphicsMode format;
int major, minor;
GraphicsContextFlags flags;
#region --- Constructors ---
/// <summary>
/// Constructs a new GLControl.
/// </summary>
public GLControl()
: this(GraphicsMode.Default)
{ }
/// <summary>
/// Constructs a new GLControl with the specified GraphicsMode.
/// </summary>
/// <param name="mode">The OpenTK.Graphics.GraphicsMode of the control.</param>
public GLControl(GraphicsMode mode)
: this(mode, 1, 0, GraphicsContextFlags.Default)
{ }
/// <summary>
/// Constructs a new GLControl with the specified GraphicsMode.
/// </summary>
/// <param name="mode">The OpenTK.Graphics.GraphicsMode of the control.</param>
/// <param name="major">The major version for the OpenGL GraphicsContext.</param>
/// <param name="minor">The minor version for the OpenGL GraphicsContext.</param>
/// <param name="flags">The GraphicsContextFlags for the OpenGL GraphicsContext.</param>
public GLControl(GraphicsMode mode, int major, int minor, GraphicsContextFlags flags)
{
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
DoubleBuffered = false;
InitializeComponent();
this.format = mode;
this.major = major;
this.minor = minor;
this.flags = flags;
}
#endregion
#region --- Private Methods ---
IGLControl Implementation
{
get
{
ValidateState();
return implementation;
}
}
void ValidateState()
{
if (IsDisposed)
throw new ObjectDisposedException(GetType().Name);
if (!IsHandleCreated)
CreateControl();
if (implementation == null || context == null || context.IsDisposed)
RecreateHandle();
}
#endregion
#region --- Protected Methods ---
/// <summary>Raises the HandleCreated event.</summary>
/// <param name="e">Not used.</param>
protected override void OnHandleCreated(EventArgs e)
{
if (context != null)
context.Dispose();
if (implementation != null)
implementation.WindowInfo.Dispose();
if (DesignMode)
implementation = new DummyGLControl();
else
implementation = new GLControlFactory().CreateGLControl(format, this);
context = implementation.CreateContext(major, minor, flags);
MakeCurrent();
if (!DesignMode)
((IGraphicsContextInternal)Context).LoadAll();
base.OnHandleCreated(e);
}
/// <summary>Raises the HandleDestroyed event.</summary>
/// <param name="e">Not used.</param>
protected override void OnHandleDestroyed(EventArgs e)
{
if (context != null)
{
context.Dispose();
context = null;
}
if (implementation != null)
{
implementation.WindowInfo.Dispose();
implementation = null;
}
base.OnHandleDestroyed(e);
}
/// <summary>
/// Raises the System.Windows.Forms.Control.Paint event.
/// </summary>
/// <param name="e">A System.Windows.Forms.PaintEventArgs that contains the event data.</param>
protected override void OnPaint(PaintEventArgs e)
{
ValidateState();
if (DesignMode)
e.Graphics.Clear(BackColor);
base.OnPaint(e);
}
/// <summary>
/// Raises the Resize event.
/// </summary>
/// <param name="e">A System.EventArgs that contains the event data.</param>
protected override void OnResize(EventArgs e)
{
if (context != null)
context.Update(Implementation.WindowInfo);
base.OnResize(e);
}
/// <summary>
/// Raises the ParentChanged event.
/// </summary>
/// <param name="e">A System.EventArgs that contains the event data.</param>
protected override void OnParentChanged(EventArgs e)
{
if (context != null)
context.Update(Implementation.WindowInfo);
base.OnParentChanged(e);
}
#endregion
#region --- Public Methods ---
#region public void SwapBuffers()
/// <summary>
/// Swaps the front and back buffers, presenting the rendered scene to the screen.
/// </summary>
public void SwapBuffers()
{
ValidateState();
Context.SwapBuffers();
}
#endregion
#region public void MakeCurrent()
/// <summary>
/// Makes the underlying this GLControl current in the calling thread.
/// All OpenGL commands issued are hereafter interpreted by this GLControl.
/// </summary>
public void MakeCurrent()
{
ValidateState();
Context.MakeCurrent(Implementation.WindowInfo);
}
#endregion
#region public bool IsIdle
/// <summary>
/// Gets a value indicating whether the current thread contains pending system messages.
/// </summary>
[Browsable(false)]
public bool IsIdle
{
get
{
ValidateState();
return Implementation.IsIdle;
}
}
#endregion
#region public IGraphicsContext Context
/// <summary>
/// Gets an interface to the underlying GraphicsContext used by this GLControl.
/// </summary>
[Browsable(false)]
public IGraphicsContext Context
{
get
{
ValidateState();
return context;
}
private set { context = value; }
}
#endregion
#region public float AspectRatio
/// <summary>
/// Gets the aspect ratio of this GLControl.
/// </summary>
[Description("The aspect ratio of the client area of this GLControl.")]
public float AspectRatio
{
get
{
ValidateState();
return ClientSize.Width / (float)ClientSize.Height;
}
}
#endregion
#region public bool VSync
/// <summary>
/// Gets or sets a value indicating whether vsync is active for this GLControl.
/// </summary>
[Description("Indicates whether GLControl updates are synced to the monitor's refresh.")]
public bool VSync
{
get
{
ValidateState();
return Context.VSync;
}
set
{
ValidateState();
Context.VSync = value;
}
}
#endregion
#region public GraphicsMode GraphicsMode
/// <summary>
/// Gets the GraphicsMode of the GraphicsContext attached to this GLControl.
/// </summary>
/// <remarks>
/// To change the GraphicsMode, you must destroy and recreate the GLControl.
/// </remarks>
public GraphicsMode GraphicsMode
{
get
{
ValidateState();
return Context.GraphicsMode;
}
}
#endregion
#region public Bitmap GrabScreenshot()
/// <summary>Grabs a screenshot of the frontbuffer contents.</summary>
/// <returns>A System.Drawing.Bitmap, containing the contents of the frontbuffer.</returns>
/// <exception cref="OpenTK.Graphics.GraphicsContextException">
/// Occurs when no OpenTK.Graphics.GraphicsContext is current in the calling thread.
/// </exception>
[Obsolete("This method will be removed. Please provide your own code to capture framebuffer contents.")]
public Bitmap GrabScreenshot()
{
ValidateState();
Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
System.Drawing.Imaging.BitmapData data =
bmp.LockBits(this.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
GL.ReadPixels(0, 0, this.ClientSize.Width, this.ClientSize.Height, PixelFormat.Bgr, PixelType.UnsignedByte,
data.Scan0);
bmp.UnlockBits(data);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
return bmp;
}
#endregion
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using OpenTK.Platform;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace OpenTK
{
/// <summary>
/// Defines a UserControl with OpenGL rendering capabilities.
/// </summary>
public partial class GLControl : UserControl
{
IGraphicsContext context;
IGLControl implementation;
GraphicsMode format;
int major, minor;
GraphicsContextFlags flags;
#region --- Constructors ---
/// <summary>
/// Constructs a new GLControl.
/// </summary>
public GLControl()
: this(GraphicsMode.Default)
{ }
/// <summary>
/// Constructs a new GLControl with the specified GraphicsMode.
/// </summary>
/// <param name="mode">The OpenTK.Graphics.GraphicsMode of the control.</param>
public GLControl(GraphicsMode mode)
: this(mode, 1, 0, GraphicsContextFlags.Default)
{ }
/// <summary>
/// Constructs a new GLControl with the specified GraphicsMode.
/// </summary>
/// <param name="mode">The OpenTK.Graphics.GraphicsMode of the control.</param>
/// <param name="major">The major version for the OpenGL GraphicsContext.</param>
/// <param name="minor">The minor version for the OpenGL GraphicsContext.</param>
/// <param name="flags">The GraphicsContextFlags for the OpenGL GraphicsContext.</param>
public GLControl(GraphicsMode mode, int major, int minor, GraphicsContextFlags flags)
{
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
DoubleBuffered = false;
InitializeComponent();
this.format = mode;
this.major = major;
this.minor = minor;
this.flags = flags;
}
#endregion
#region --- Private Methods ---
IGLControl Implementation
{
get
{
ValidateState();
return implementation;
}
}
void ValidateState()
{
if (IsDisposed)
throw new ObjectDisposedException(GetType().Name);
if (!IsHandleCreated)
CreateControl();
if (implementation == null || context == null || context.IsDisposed)
RecreateHandle();
}
#endregion
#region --- Protected Methods ---
/// <summary>Raises the HandleCreated event.</summary>
/// <param name="e">Not used.</param>
protected override void OnHandleCreated(EventArgs e)
{
if (context != null)
context.Dispose();
if (implementation != null)
implementation.WindowInfo.Dispose();
if (DesignMode)
implementation = new DummyGLControl();
else
implementation = new GLControlFactory().CreateGLControl(format, this);
context = implementation.CreateContext(major, minor, flags);
MakeCurrent();
if (!DesignMode)
((IGraphicsContextInternal)Context).LoadAll();
base.OnHandleCreated(e);
}
/// <summary>Raises the HandleDestroyed event.</summary>
/// <param name="e">Not used.</param>
protected override void OnHandleDestroyed(EventArgs e)
{
if (context != null)
{
context.Dispose();
context = null;
}
if (implementation != null)
{
implementation.WindowInfo.Dispose();
implementation = null;
}
base.OnHandleDestroyed(e);
}
/// <summary>
/// Raises the System.Windows.Forms.Control.Paint event.
/// </summary>
/// <param name="e">A System.Windows.Forms.PaintEventArgs that contains the event data.</param>
protected override void OnPaint(PaintEventArgs e)
{
ValidateState();
if (DesignMode)
e.Graphics.Clear(BackColor);
base.OnPaint(e);
}
/// <summary>
/// Raises the Resize event.
/// </summary>
/// <param name="e">A System.EventArgs that contains the event data.</param>
protected override void OnResize(EventArgs e)
{
if (context != null)
context.Update(Implementation.WindowInfo);
base.OnResize(e);
}
/// <summary>
/// Raises the ParentChanged event.
/// </summary>
/// <param name="e">A System.EventArgs that contains the event data.</param>
protected override void OnParentChanged(EventArgs e)
{
if (context != null)
context.Update(Implementation.WindowInfo);
base.OnParentChanged(e);
}
#endregion
#region --- Public Methods ---
#region public void SwapBuffers()
/// <summary>
/// Swaps the front and back buffers, presenting the rendered scene to the screen.
/// </summary>
public void SwapBuffers()
{
ValidateState();
Context.SwapBuffers();
}
#endregion
#region public void MakeCurrent()
/// <summary>
/// Makes the underlying this GLControl current in the calling thread.
/// All OpenGL commands issued are hereafter interpreted by this GLControl.
/// </summary>
public void MakeCurrent()
{
ValidateState();
Context.MakeCurrent(Implementation.WindowInfo);
}
#endregion
#region public bool IsIdle
/// <summary>
/// Gets a value indicating whether the current thread contains pending system messages.
/// </summary>
[Browsable(false)]
public bool IsIdle
{
get
{
ValidateState();
return Implementation.IsIdle;
}
}
#endregion
#region public IGraphicsContext Context
/// <summary>
/// Gets an interface to the underlying GraphicsContext used by this GLControl.
/// </summary>
[Browsable(false)]
public IGraphicsContext Context
{
get
{
ValidateState();
return context;
}
private set { context = value; }
}
#endregion
#region public float AspectRatio
/// <summary>
/// Gets the aspect ratio of this GLControl.
/// </summary>
[Description("The aspect ratio of the client area of this GLControl.")]
public float AspectRatio
{
get
{
ValidateState();
return ClientSize.Width / (float)ClientSize.Height;
}
}
#endregion
#region public bool VSync
/// <summary>
/// Gets or sets a value indicating whether vsync is active for this GLControl.
/// </summary>
[Description("Indicates whether GLControl updates are synced to the monitor's refresh.")]
public bool VSync
{
get
{
ValidateState();
return Context.VSync;
}
set
{
ValidateState();
Context.VSync = value;
}
}
#endregion
#region public GraphicsMode GraphicsMode
/// <summary>
/// Gets the GraphicsMode of the GraphicsContext attached to this GLControl.
/// </summary>
/// <remarks>
/// To change the GraphicsMode, you must destroy and recreate the GLControl.
/// </remarks>
public GraphicsMode GraphicsMode
{
get
{
ValidateState();
return Context.GraphicsMode;
}
}
#endregion
#region public Bitmap GrabScreenshot()
/// <summary>Grabs a screenshot of the frontbuffer contents.</summary>
/// <returns>A System.Drawing.Bitmap, containing the contents of the frontbuffer.</returns>
/// <exception cref="OpenTK.Graphics.GraphicsContextException">
/// Occurs when no OpenTK.Graphics.GraphicsContext is current in the calling thread.
/// </exception>
[Obsolete("This method will be removed. Please provide your own code to capture framebuffer contents.")]
public Bitmap GrabScreenshot()
{
ValidateState();
Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
System.Drawing.Imaging.BitmapData data =
bmp.LockBits(this.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
GL.ReadPixels(0, 0, this.ClientSize.Width, this.ClientSize.Height, PixelFormat.Bgr, PixelType.UnsignedByte,
data.Scan0);
bmp.UnlockBits(data);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
return bmp;
}
#endregion
#endregion
}
}

View file

@ -1,47 +1,47 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OpenTK.Graphics;
namespace OpenTK
{
// Constructs GLControls.
class GLControlFactory
{
public IGLControl CreateGLControl(GraphicsMode mode, Control control)
{
if (Configuration.RunningOnWindows) return new WinGLControl(mode, control);
else if (Configuration.RunningOnX11) return new X11GLControl(mode, control);
else if (Configuration.RunningOnMacOS) return new CarbonGLControl(mode, control);
else throw new PlatformNotSupportedException();
}
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OpenTK.Graphics;
namespace OpenTK
{
// Constructs GLControls.
class GLControlFactory
{
public IGLControl CreateGLControl(GraphicsMode mode, Control control)
{
if (Configuration.RunningOnWindows) return new WinGLControl(mode, control);
else if (Configuration.RunningOnX11) return new X11GLControl(mode, control);
else if (Configuration.RunningOnMacOS) return new CarbonGLControl(mode, control);
else throw new PlatformNotSupportedException();
}
}
}

View file

@ -1,43 +1,43 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
internal interface IGLControl
{
IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags);
bool IsIdle { get; }
IWindowInfo WindowInfo { get; }
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
internal interface IGLControl
{
IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags);
bool IsIdle { get; }
IWindowInfo WindowInfo { get; }
}
}

View file

@ -1,38 +1,38 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenTK.GLControl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("OpenTK.GLControl")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5414b90b-d7be-4382-b0e1-f07ce154f7f7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenTK.GLControl")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("OpenTK.GLControl")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5414b90b-d7be-4382-b0e1-f07ce154f7f7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: System.CLSCompliant(true)]

View file

@ -1,144 +1,144 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
class WinGLControl : IGLControl
{
#region P/Invoke declarations
#region Message
struct MSG
{
public IntPtr HWnd;
public uint Message;
public IntPtr WParam;
public IntPtr LParam;
public uint Time;
public POINT Point;
//internal object RefObject;
public override string ToString()
{
return String.Format("msg=0x{0:x} ({1}) hwnd=0x{2:x} wparam=0x{3:x} lparam=0x{4:x} pt=0x{5:x}", (int)Message, Message.ToString(), HWnd.ToInt32(), WParam.ToInt32(), LParam.ToInt32(), Point);
}
}
#endregion
#region Point
struct POINT
{
public int X;
public int Y;
public POINT(int x, int y)
{
this.X = x;
this.Y = y;
}
public System.Drawing.Point ToPoint()
{
return new System.Drawing.Point(X, Y);
}
public override string ToString()
{
return "Point {" + X.ToString() + ", " + Y.ToString() + ")";
}
}
#endregion
#region PeekMessage
[System.Security.SuppressUnmanagedCodeSecurity]
[System.Runtime.InteropServices.DllImport("User32.dll")]
static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags);
#endregion
#region
#endregion
#endregion
#region Fields
MSG msg = new MSG();
IWindowInfo window_info;
GraphicsMode mode;
#endregion
#region Constructors
public WinGLControl(GraphicsMode mode, Control control)
{
this.mode = mode;
window_info = Utilities.CreateWindowInfo(mode, control.Handle, true);
}
#endregion
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
return new GraphicsContext(mode, window_info, major, minor, flags);
}
public bool IsIdle
{
get { return !PeekMessage(ref msg, IntPtr.Zero, 0, 0, 0); }
}
public IWindowInfo WindowInfo
{
get
{
// This method forces the creation of the control. Beware of this side-effect!
return window_info;
}
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
class WinGLControl : IGLControl
{
#region P/Invoke declarations
#region Message
struct MSG
{
public IntPtr HWnd;
public uint Message;
public IntPtr WParam;
public IntPtr LParam;
public uint Time;
public POINT Point;
//internal object RefObject;
public override string ToString()
{
return String.Format("msg=0x{0:x} ({1}) hwnd=0x{2:x} wparam=0x{3:x} lparam=0x{4:x} pt=0x{5:x}", (int)Message, Message.ToString(), HWnd.ToInt32(), WParam.ToInt32(), LParam.ToInt32(), Point);
}
}
#endregion
#region Point
struct POINT
{
public int X;
public int Y;
public POINT(int x, int y)
{
this.X = x;
this.Y = y;
}
public System.Drawing.Point ToPoint()
{
return new System.Drawing.Point(X, Y);
}
public override string ToString()
{
return "Point {" + X.ToString() + ", " + Y.ToString() + ")";
}
}
#endregion
#region PeekMessage
[System.Security.SuppressUnmanagedCodeSecurity]
[System.Runtime.InteropServices.DllImport("User32.dll")]
static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags);
#endregion
#region
#endregion
#endregion
#region Fields
MSG msg = new MSG();
IWindowInfo window_info;
GraphicsMode mode;
#endregion
#region Constructors
public WinGLControl(GraphicsMode mode, Control control)
{
this.mode = mode;
window_info = Utilities.CreateWindowInfo(mode, control.Handle, true);
}
#endregion
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
return new GraphicsContext(mode, window_info, major, minor, flags);
}
public bool IsIdle
{
get { return !PeekMessage(ref msg, IntPtr.Zero, 0, 0, 0); }
}
public IWindowInfo WindowInfo
{
get
{
// This method forces the creation of the control. Beware of this side-effect!
return window_info;
}
}
#endregion
}
}

View file

@ -1,70 +1,70 @@
#region --- License ---
/* Licensed under the MIT/X11 license.
* Copyright (c) 2006-2008 the OpenTK Team.
* This notice may not be removed from any source distribution.
* See license.txt for licensing detailed licensing details.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
class X11GLControl : IGLControl
{
#region P/Invokes
[DllImport("libX11")]
public extern static int XPending(IntPtr diplay);
#endregion
#region Fields
GraphicsMode mode;
IWindowInfo window_info;
#endregion
internal X11GLControl(GraphicsMode mode, Control control)
{
if (mode == null)
throw new ArgumentNullException("mode");
if (control == null)
throw new ArgumentNullException("control");
this.mode = mode;
window_info = Utilities.CreateWindowInfo(mode, control.Handle, true);
}
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
return new GraphicsContext(mode, this.WindowInfo, major, minor, flags);
}
public bool IsIdle
{
get { return XPending(((Platform.X11.X11WindowInfo)window_info).Display) == 0; }
}
public IWindowInfo WindowInfo
{
get
{
return window_info;
}
}
#endregion
}
}
#region --- License ---
/* Licensed under the MIT/X11 license.
* Copyright (c) 2006-2008 the OpenTK Team.
* This notice may not be removed from any source distribution.
* See license.txt for licensing detailed licensing details.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using OpenTK.Graphics;
using OpenTK.Platform;
namespace OpenTK
{
class X11GLControl : IGLControl
{
#region P/Invokes
[DllImport("libX11")]
public extern static int XPending(IntPtr diplay);
#endregion
#region Fields
GraphicsMode mode;
IWindowInfo window_info;
#endregion
internal X11GLControl(GraphicsMode mode, Control control)
{
if (mode == null)
throw new ArgumentNullException("mode");
if (control == null)
throw new ArgumentNullException("control");
this.mode = mode;
window_info = Utilities.CreateWindowInfo(mode, control.Handle, true);
}
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
return new GraphicsContext(mode, this.WindowInfo, major, minor, flags);
}
public bool IsIdle
{
get { return XPending(((Platform.X11.X11WindowInfo)window_info).Display) == 0; }
}
public IWindowInfo WindowInfo
{
get
{
return window_info;
}
}
#endregion
}
}

View file

@ -1,412 +1,412 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using OpenTK.Audio.OpenAL;
namespace OpenTK.Audio
{
/// <summary>
/// Provides methods to instantiate, use and destroy an audio device for recording.
/// Static methods are provided to list available devices known by the driver.
/// </summary>
public sealed class AudioCapture : IDisposable
{
#region Fields
// This must stay private info so the end-user cannot call any Alc commands for the recording device.
IntPtr Handle;
// Alc.CaptureStop should be called prior to device shutdown, this keeps track of Alc.CaptureStart/Stop calls.
bool _isrecording = false;
ALFormat sample_format;
int sample_frequency;
#endregion
#region Constructors
static AudioCapture()
{
if (AudioDeviceEnumerator.IsOpenALSupported) // forces enumeration
{
}
}
/// <summary>
/// Opens the default device for audio recording.
/// Implicitly set parameters are: 22050Hz, 16Bit Mono, 4096 samples ringbuffer.
/// </summary>
public AudioCapture()
: this(AudioCapture.DefaultDevice, 22050, ALFormat.Mono16, 4096)
{
}
/// <summary>Opens a device for audio recording.</summary>
/// <param name="deviceName">The device name.</param>
/// <param name="frequency">The frequency that the data should be captured at.</param>
/// <param name="sampleFormat">The requested capture buffer format.</param>
/// <param name="bufferSize">The size of OpenAL's capture internal ring-buffer. This value expects number of samples, not bytes.</param>
public AudioCapture(string deviceName, int frequency, ALFormat sampleFormat, int bufferSize)
{
if (!AudioDeviceEnumerator.IsOpenALSupported)
throw new DllNotFoundException("openal32.dll");
if (frequency <= 0)
throw new ArgumentOutOfRangeException("frequency");
if (bufferSize <= 0)
throw new ArgumentOutOfRangeException("bufferSize");
// Try to open specified device. If it fails, try to open default device.
device_name = deviceName;
Handle = Alc.CaptureOpenDevice(deviceName, frequency, sampleFormat, bufferSize);
if (Handle == IntPtr.Zero)
{
Debug.WriteLine(ErrorMessage(deviceName, frequency, sampleFormat, bufferSize));
device_name = "IntPtr.Zero";
Handle = Alc.CaptureOpenDevice(null, frequency, sampleFormat, bufferSize);
}
if (Handle == IntPtr.Zero)
{
Debug.WriteLine(ErrorMessage("IntPtr.Zero", frequency, sampleFormat, bufferSize));
device_name = AudioDeviceEnumerator.DefaultRecordingDevice;
Handle = Alc.CaptureOpenDevice(AudioDeviceEnumerator.DefaultRecordingDevice, frequency, sampleFormat, bufferSize);
}
if (Handle == IntPtr.Zero)
{
// Everything we tried failed. Capture may not be supported, bail out.
Debug.WriteLine(ErrorMessage(AudioDeviceEnumerator.DefaultRecordingDevice, frequency, sampleFormat, bufferSize));
device_name = "None";
throw new AudioDeviceException("All attempts to open capture devices returned IntPtr.Zero. See debug log for verbose list.");
}
// handle is not null, check for some Alc Error
CheckErrors();
SampleFormat = sampleFormat;
SampleFrequency = frequency;
}
#endregion Constructor
#region Public Members
#region CurrentDevice
private string device_name;
/// <summary>
/// The name of the device associated with this instance.
/// </summary>
public string CurrentDevice
{
get
{
return device_name;
}
}
#endregion
#region AvailableDevices
/// <summary>
/// Returns a list of strings containing all known recording devices.
/// </summary>
public static IList<string> AvailableDevices
{
get
{
return AudioDeviceEnumerator.AvailableRecordingDevices;
}
}
#endregion
#region DefaultDevice
/// <summary>
/// Returns the name of the device that will be used as recording default.
/// </summary>
public static string DefaultDevice
{
get
{
return AudioDeviceEnumerator.DefaultRecordingDevice;
}
}
#endregion
#region CheckErrors
/// <summary>
/// Checks for ALC error conditions.
/// </summary>
/// <exception cref="OutOfMemoryException">Raised when an out of memory error is detected.</exception>
/// <exception cref="AudioValueException">Raised when an invalid value is detected.</exception>
/// <exception cref="AudioDeviceException">Raised when an invalid device is detected.</exception>
/// <exception cref="AudioContextException">Raised when an invalid context is detected.</exception>
public void CheckErrors()
{
new AudioDeviceErrorChecker(Handle).Dispose();
}
#endregion
#region CurrentError
/// <summary>Returns the ALC error code for this device.</summary>
public AlcError CurrentError
{
get
{
return Alc.GetError(Handle);
}
}
#endregion
#region Start & Stop
/// <summary>
/// Start recording samples.
/// The number of available samples can be obtained through the <see cref="AvailableSamples"/> property.
/// The data can be queried with any <see cref="ReadSamples"/> method.
/// </summary>
public void Start()
{
Alc.CaptureStart(Handle);
_isrecording = true;
}
/// <summary>Stop recording samples. This will not clear previously recorded samples.</summary>
public void Stop()
{
Alc.CaptureStop(Handle);
_isrecording = false;
}
#endregion Start & Stop Capture
#region AvailableSamples
/// <summary>Returns the number of available samples for capture.</summary>
public int AvailableSamples
{
get
{
// TODO: Investigate inconsistency between documentation and actual usage.
// Doc claims the 3rd param is Number-of-Bytes, but it appears to be Number-of-Int32s
int result;
Alc.GetInteger(Handle, AlcGetInteger.CaptureSamples, 1, out result);
return result;
}
}
#endregion Available samples property
#region ReadSamples
/// <summary>Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples.</summary>
/// <param name="buffer">A pointer to a previously initialized and pinned array.</param>
/// <param name="sampleCount">The number of samples to be written to the buffer.</param>
public void ReadSamples(IntPtr buffer, int sampleCount)
{
Alc.CaptureSamples(Handle, buffer, sampleCount);
}
/// <summary>Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples.</summary>
/// <param name="buffer">The buffer to fill.</param>
/// <param name="sampleCount">The number of samples to be written to the buffer.</param>
/// <exception cref="System.ArgumentNullException">Raised when buffer is null.</exception>
/// <exception cref="System.ArgumentOutOfRangeException">Raised when sampleCount is larger than the buffer.</exception>
public void ReadSamples<TBuffer>(TBuffer[] buffer, int sampleCount)
where TBuffer : struct
{
if (buffer == null)
throw new ArgumentNullException("buffer");
int buffer_size = BlittableValueType<TBuffer>.Stride * buffer.Length;
// This is more of a heuristic than a 100% valid check. However, it will work
// correctly for 99.9% of all use cases.
// This should never produce a false positive, but a false negative might
// be produced with compressed sample formats (which are very rare).
// Still, this is better than no check at all.
if (sampleCount * GetSampleSize(SampleFormat) > buffer_size)
throw new ArgumentOutOfRangeException("sampleCount");
GCHandle buffer_ptr = GCHandle.Alloc(buffer, GCHandleType.Pinned);
try { ReadSamples(buffer_ptr.AddrOfPinnedObject(), sampleCount); }
finally { buffer_ptr.Free(); }
}
#endregion
#region SampleFormat & SampleFrequency
/// <summary>
/// Gets the OpenTK.Audio.ALFormat for this instance.
/// </summary>
public ALFormat SampleFormat
{
get { return sample_format; }
private set { sample_format = value; }
}
/// <summary>
/// Gets the sampling rate for this instance.
/// </summary>
public int SampleFrequency
{
get { return sample_frequency; }
private set { sample_frequency = value; }
}
#endregion
#region IsRunning
/// <summary>
/// Gets a value indicating whether this instance is currently capturing samples.
/// </summary>
public bool IsRunning
{
get { return _isrecording; }
}
#endregion
#endregion
#region Private Members
// Retrieves the sample size in bytes for various ALFormats.
// Compressed formats always return 1.
static int GetSampleSize(ALFormat format)
{
switch (format)
{
case ALFormat.Mono8: return 1;
case ALFormat.Mono16: return 2;
case ALFormat.Stereo8: return 2;
case ALFormat.Stereo16: return 4;
case ALFormat.MonoFloat32Ext: return 4;
case ALFormat.MonoDoubleExt: return 8;
case ALFormat.StereoFloat32Ext: return 8;
case ALFormat.StereoDoubleExt: return 16;
case ALFormat.MultiQuad8Ext: return 4;
case ALFormat.MultiQuad16Ext: return 8;
case ALFormat.MultiQuad32Ext: return 16;
case ALFormat.Multi51Chn8Ext: return 6;
case ALFormat.Multi51Chn16Ext: return 12;
case ALFormat.Multi51Chn32Ext: return 24;
case ALFormat.Multi61Chn8Ext: return 7;
case ALFormat.Multi71Chn16Ext: return 14;
case ALFormat.Multi71Chn32Ext: return 28;
case ALFormat.MultiRear8Ext: return 1;
case ALFormat.MultiRear16Ext: return 2;
case ALFormat.MultiRear32Ext: return 4;
default: return 1; // Unknown sample size.
}
}
// Converts an error code to an error string with additional information.
string ErrorMessage(string devicename, int frequency, ALFormat bufferformat, int buffersize)
{
string alcerrmsg;
AlcError alcerrcode = CurrentError;
switch (alcerrcode)
{
case AlcError.OutOfMemory:
alcerrmsg = alcerrcode.ToString() + ": The specified device is invalid, or can not capture audio.";
break;
case AlcError.InvalidValue:
alcerrmsg = alcerrcode.ToString() + ": One of the parameters has an invalid value.";
break;
default:
alcerrmsg = alcerrcode.ToString();
break;
}
return "The handle returned by Alc.CaptureOpenDevice is null." +
"\nAlc Error: " + alcerrmsg +
"\nDevice Name: " + devicename +
"\nCapture frequency: " + frequency +
"\nBuffer format: " + bufferformat +
"\nBuffer Size: " + buffersize;
}
#endregion
#region IDisposable Members
~AudioCapture()
{
Dispose();
}
private bool IsDisposed;
/// <summary>Closes the device and disposes the instance.</summary>
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool manual)
{
if (!this.IsDisposed)
{
if (this.Handle != IntPtr.Zero)
{
if (this._isrecording)
this.Stop();
Alc.CaptureCloseDevice(this.Handle);
}
this.IsDisposed = true;
}
}
#endregion Destructor
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using OpenTK.Audio.OpenAL;
namespace OpenTK.Audio
{
/// <summary>
/// Provides methods to instantiate, use and destroy an audio device for recording.
/// Static methods are provided to list available devices known by the driver.
/// </summary>
public sealed class AudioCapture : IDisposable
{
#region Fields
// This must stay private info so the end-user cannot call any Alc commands for the recording device.
IntPtr Handle;
// Alc.CaptureStop should be called prior to device shutdown, this keeps track of Alc.CaptureStart/Stop calls.
bool _isrecording = false;
ALFormat sample_format;
int sample_frequency;
#endregion
#region Constructors
static AudioCapture()
{
if (AudioDeviceEnumerator.IsOpenALSupported) // forces enumeration
{
}
}
/// <summary>
/// Opens the default device for audio recording.
/// Implicitly set parameters are: 22050Hz, 16Bit Mono, 4096 samples ringbuffer.
/// </summary>
public AudioCapture()
: this(AudioCapture.DefaultDevice, 22050, ALFormat.Mono16, 4096)
{
}
/// <summary>Opens a device for audio recording.</summary>
/// <param name="deviceName">The device name.</param>
/// <param name="frequency">The frequency that the data should be captured at.</param>
/// <param name="sampleFormat">The requested capture buffer format.</param>
/// <param name="bufferSize">The size of OpenAL's capture internal ring-buffer. This value expects number of samples, not bytes.</param>
public AudioCapture(string deviceName, int frequency, ALFormat sampleFormat, int bufferSize)
{
if (!AudioDeviceEnumerator.IsOpenALSupported)
throw new DllNotFoundException("openal32.dll");
if (frequency <= 0)
throw new ArgumentOutOfRangeException("frequency");
if (bufferSize <= 0)
throw new ArgumentOutOfRangeException("bufferSize");
// Try to open specified device. If it fails, try to open default device.
device_name = deviceName;
Handle = Alc.CaptureOpenDevice(deviceName, frequency, sampleFormat, bufferSize);
if (Handle == IntPtr.Zero)
{
Debug.WriteLine(ErrorMessage(deviceName, frequency, sampleFormat, bufferSize));
device_name = "IntPtr.Zero";
Handle = Alc.CaptureOpenDevice(null, frequency, sampleFormat, bufferSize);
}
if (Handle == IntPtr.Zero)
{
Debug.WriteLine(ErrorMessage("IntPtr.Zero", frequency, sampleFormat, bufferSize));
device_name = AudioDeviceEnumerator.DefaultRecordingDevice;
Handle = Alc.CaptureOpenDevice(AudioDeviceEnumerator.DefaultRecordingDevice, frequency, sampleFormat, bufferSize);
}
if (Handle == IntPtr.Zero)
{
// Everything we tried failed. Capture may not be supported, bail out.
Debug.WriteLine(ErrorMessage(AudioDeviceEnumerator.DefaultRecordingDevice, frequency, sampleFormat, bufferSize));
device_name = "None";
throw new AudioDeviceException("All attempts to open capture devices returned IntPtr.Zero. See debug log for verbose list.");
}
// handle is not null, check for some Alc Error
CheckErrors();
SampleFormat = sampleFormat;
SampleFrequency = frequency;
}
#endregion Constructor
#region Public Members
#region CurrentDevice
private string device_name;
/// <summary>
/// The name of the device associated with this instance.
/// </summary>
public string CurrentDevice
{
get
{
return device_name;
}
}
#endregion
#region AvailableDevices
/// <summary>
/// Returns a list of strings containing all known recording devices.
/// </summary>
public static IList<string> AvailableDevices
{
get
{
return AudioDeviceEnumerator.AvailableRecordingDevices;
}
}
#endregion
#region DefaultDevice
/// <summary>
/// Returns the name of the device that will be used as recording default.
/// </summary>
public static string DefaultDevice
{
get
{
return AudioDeviceEnumerator.DefaultRecordingDevice;
}
}
#endregion
#region CheckErrors
/// <summary>
/// Checks for ALC error conditions.
/// </summary>
/// <exception cref="OutOfMemoryException">Raised when an out of memory error is detected.</exception>
/// <exception cref="AudioValueException">Raised when an invalid value is detected.</exception>
/// <exception cref="AudioDeviceException">Raised when an invalid device is detected.</exception>
/// <exception cref="AudioContextException">Raised when an invalid context is detected.</exception>
public void CheckErrors()
{
new AudioDeviceErrorChecker(Handle).Dispose();
}
#endregion
#region CurrentError
/// <summary>Returns the ALC error code for this device.</summary>
public AlcError CurrentError
{
get
{
return Alc.GetError(Handle);
}
}
#endregion
#region Start & Stop
/// <summary>
/// Start recording samples.
/// The number of available samples can be obtained through the <see cref="AvailableSamples"/> property.
/// The data can be queried with any <see cref="ReadSamples"/> method.
/// </summary>
public void Start()
{
Alc.CaptureStart(Handle);
_isrecording = true;
}
/// <summary>Stop recording samples. This will not clear previously recorded samples.</summary>
public void Stop()
{
Alc.CaptureStop(Handle);
_isrecording = false;
}
#endregion Start & Stop Capture
#region AvailableSamples
/// <summary>Returns the number of available samples for capture.</summary>
public int AvailableSamples
{
get
{
// TODO: Investigate inconsistency between documentation and actual usage.
// Doc claims the 3rd param is Number-of-Bytes, but it appears to be Number-of-Int32s
int result;
Alc.GetInteger(Handle, AlcGetInteger.CaptureSamples, 1, out result);
return result;
}
}
#endregion Available samples property
#region ReadSamples
/// <summary>Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples.</summary>
/// <param name="buffer">A pointer to a previously initialized and pinned array.</param>
/// <param name="sampleCount">The number of samples to be written to the buffer.</param>
public void ReadSamples(IntPtr buffer, int sampleCount)
{
Alc.CaptureSamples(Handle, buffer, sampleCount);
}
/// <summary>Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples.</summary>
/// <param name="buffer">The buffer to fill.</param>
/// <param name="sampleCount">The number of samples to be written to the buffer.</param>
/// <exception cref="System.ArgumentNullException">Raised when buffer is null.</exception>
/// <exception cref="System.ArgumentOutOfRangeException">Raised when sampleCount is larger than the buffer.</exception>
public void ReadSamples<TBuffer>(TBuffer[] buffer, int sampleCount)
where TBuffer : struct
{
if (buffer == null)
throw new ArgumentNullException("buffer");
int buffer_size = BlittableValueType<TBuffer>.Stride * buffer.Length;
// This is more of a heuristic than a 100% valid check. However, it will work
// correctly for 99.9% of all use cases.
// This should never produce a false positive, but a false negative might
// be produced with compressed sample formats (which are very rare).
// Still, this is better than no check at all.
if (sampleCount * GetSampleSize(SampleFormat) > buffer_size)
throw new ArgumentOutOfRangeException("sampleCount");
GCHandle buffer_ptr = GCHandle.Alloc(buffer, GCHandleType.Pinned);
try { ReadSamples(buffer_ptr.AddrOfPinnedObject(), sampleCount); }
finally { buffer_ptr.Free(); }
}
#endregion
#region SampleFormat & SampleFrequency
/// <summary>
/// Gets the OpenTK.Audio.ALFormat for this instance.
/// </summary>
public ALFormat SampleFormat
{
get { return sample_format; }
private set { sample_format = value; }
}
/// <summary>
/// Gets the sampling rate for this instance.
/// </summary>
public int SampleFrequency
{
get { return sample_frequency; }
private set { sample_frequency = value; }
}
#endregion
#region IsRunning
/// <summary>
/// Gets a value indicating whether this instance is currently capturing samples.
/// </summary>
public bool IsRunning
{
get { return _isrecording; }
}
#endregion
#endregion
#region Private Members
// Retrieves the sample size in bytes for various ALFormats.
// Compressed formats always return 1.
static int GetSampleSize(ALFormat format)
{
switch (format)
{
case ALFormat.Mono8: return 1;
case ALFormat.Mono16: return 2;
case ALFormat.Stereo8: return 2;
case ALFormat.Stereo16: return 4;
case ALFormat.MonoFloat32Ext: return 4;
case ALFormat.MonoDoubleExt: return 8;
case ALFormat.StereoFloat32Ext: return 8;
case ALFormat.StereoDoubleExt: return 16;
case ALFormat.MultiQuad8Ext: return 4;
case ALFormat.MultiQuad16Ext: return 8;
case ALFormat.MultiQuad32Ext: return 16;
case ALFormat.Multi51Chn8Ext: return 6;
case ALFormat.Multi51Chn16Ext: return 12;
case ALFormat.Multi51Chn32Ext: return 24;
case ALFormat.Multi61Chn8Ext: return 7;
case ALFormat.Multi71Chn16Ext: return 14;
case ALFormat.Multi71Chn32Ext: return 28;
case ALFormat.MultiRear8Ext: return 1;
case ALFormat.MultiRear16Ext: return 2;
case ALFormat.MultiRear32Ext: return 4;
default: return 1; // Unknown sample size.
}
}
// Converts an error code to an error string with additional information.
string ErrorMessage(string devicename, int frequency, ALFormat bufferformat, int buffersize)
{
string alcerrmsg;
AlcError alcerrcode = CurrentError;
switch (alcerrcode)
{
case AlcError.OutOfMemory:
alcerrmsg = alcerrcode.ToString() + ": The specified device is invalid, or can not capture audio.";
break;
case AlcError.InvalidValue:
alcerrmsg = alcerrcode.ToString() + ": One of the parameters has an invalid value.";
break;
default:
alcerrmsg = alcerrcode.ToString();
break;
}
return "The handle returned by Alc.CaptureOpenDevice is null." +
"\nAlc Error: " + alcerrmsg +
"\nDevice Name: " + devicename +
"\nCapture frequency: " + frequency +
"\nBuffer format: " + bufferformat +
"\nBuffer Size: " + buffersize;
}
#endregion
#region IDisposable Members
~AudioCapture()
{
Dispose();
}
private bool IsDisposed;
/// <summary>Closes the device and disposes the instance.</summary>
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool manual)
{
if (!this.IsDisposed)
{
if (this.Handle != IntPtr.Zero)
{
if (this._isrecording)
this.Stop();
Alc.CaptureCloseDevice(this.Handle);
}
this.IsDisposed = true;
}
}
#endregion Destructor
}
}

View file

@ -1,44 +1,44 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Audio
{
/// <summary>Represents exceptions related to an OpenTK.Audio.AudioContext.</summary>
public class AudioContextException : AudioException
{
/// <summary>Constructs a new AudioContextException.</summary>
public AudioContextException() : base() { }
/// <summary>Constructs a new AudioContextException with the specified error message.</summary>
/// <param name="message">The error message of the AudioContextException.</param>
public AudioContextException(string message) : base(message) { }
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Audio
{
/// <summary>Represents exceptions related to an OpenTK.Audio.AudioContext.</summary>
public class AudioContextException : AudioException
{
/// <summary>Constructs a new AudioContextException.</summary>
public AudioContextException() : base() { }
/// <summary>Constructs a new AudioContextException with the specified error message.</summary>
/// <param name="message">The error message of the AudioContextException.</param>
public AudioContextException(string message) : base(message) { }
}
}

View file

@ -28,8 +28,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics;
using OpenTK.Audio.OpenAL;
namespace OpenTK.Audio

View file

@ -1,85 +1,85 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Audio.OpenAL;
namespace OpenTK.Audio
{
struct AudioDeviceErrorChecker : IDisposable
{
#region Fields
readonly IntPtr Device;
static readonly string ErrorString = "Device {0} reported {1}.";
#endregion
#region Constructors
public AudioDeviceErrorChecker(IntPtr device)
{
if (device == IntPtr.Zero)
throw new AudioDeviceException();
Device = device;
}
#endregion
#region IDisposable Members
public void Dispose()
{
AlcError err = Alc.GetError(Device);
switch (err)
{
case AlcError.OutOfMemory:
throw new OutOfMemoryException(String.Format(ErrorString, Device, err));
case AlcError.InvalidValue:
throw new AudioValueException(String.Format(ErrorString, Device, err));
case AlcError.InvalidDevice:
throw new AudioDeviceException(String.Format(ErrorString, Device, err));
case AlcError.InvalidContext:
throw new AudioContextException(String.Format(ErrorString, Device, err));
case AlcError.NoError:
default:
// everything went fine, do nothing
break;
}
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Audio.OpenAL;
namespace OpenTK.Audio
{
struct AudioDeviceErrorChecker : IDisposable
{
#region Fields
readonly IntPtr Device;
static readonly string ErrorString = "Device {0} reported {1}.";
#endregion
#region Constructors
public AudioDeviceErrorChecker(IntPtr device)
{
if (device == IntPtr.Zero)
throw new AudioDeviceException();
Device = device;
}
#endregion
#region IDisposable Members
public void Dispose()
{
AlcError err = Alc.GetError(Device);
switch (err)
{
case AlcError.OutOfMemory:
throw new OutOfMemoryException(String.Format(ErrorString, Device, err));
case AlcError.InvalidValue:
throw new AudioValueException(String.Format(ErrorString, Device, err));
case AlcError.InvalidDevice:
throw new AudioDeviceException(String.Format(ErrorString, Device, err));
case AlcError.InvalidContext:
throw new AudioContextException(String.Format(ErrorString, Device, err));
case AlcError.NoError:
default:
// everything went fine, do nothing
break;
}
}
#endregion
}
}

View file

@ -1,43 +1,43 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Audio
{
/// <summary>Represents exceptions related to invalid values.</summary>
public class AudioValueException : AudioException
{
/// <summary>Constructs a new instance.</summary>
public AudioValueException() : base() { }
/// <summary>Constructs a new instance with the specified error message.</summary>
/// <param name="message">The error message of the AudioContextException.</param>
public AudioValueException(string message) : base(message) { }
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Audio
{
/// <summary>Represents exceptions related to invalid values.</summary>
public class AudioValueException : AudioException
{
/// <summary>Constructs a new instance.</summary>
public AudioValueException() : base() { }
/// <summary>Constructs a new instance with the specified error message.</summary>
/// <param name="message">The error message of the AudioContextException.</param>
public AudioValueException(string message) : base(message) { }
}
}

View file

@ -1,61 +1,61 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2008 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
/// <summary>
/// Indicates that this function is generated automatically by a tool.
/// </summary>
public sealed class AutoGeneratedAttribute : Attribute
{
/// <summary>
/// Specifies the category of this OpenGL function.
/// </summary>
public string Category;
/// <summary>
/// Specifies the version of this OpenGL function.
/// </summary>
public string Version;
/// <summary>
/// Specifies the entry point of the OpenGL function.
/// </summary>
public string EntryPoint;
/// <summary>
/// Constructs a new AutoGeneratedAttribute instance.
/// </summary>
public AutoGeneratedAttribute()
{
}
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2008 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
/// <summary>
/// Indicates that this function is generated automatically by a tool.
/// </summary>
public sealed class AutoGeneratedAttribute : Attribute
{
/// <summary>
/// Specifies the category of this OpenGL function.
/// </summary>
public string Category;
/// <summary>
/// Specifies the version of this OpenGL function.
/// </summary>
public string Version;
/// <summary>
/// Specifies the entry point of the OpenGL function.
/// </summary>
public string EntryPoint;
/// <summary>
/// Constructs a new AutoGeneratedAttribute instance.
/// </summary>
public AutoGeneratedAttribute()
{
}
}
}

View file

@ -1,268 +1,268 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Reflection;
namespace OpenTK
{
#region BlittableValueType<T>
/// <summary>
/// Checks whether the specified type parameter is a blittable value type.
/// </summary>
/// <remarks>
/// A blittable value type is a struct that only references other value types recursively,
/// which allows it to be passed to unmanaged code directly.
/// </remarks>
public static class BlittableValueType<T> where T : struct
{
#region Fields
static readonly Type Type;
#endregion
#region Constructors
static BlittableValueType()
{
Type = typeof(T);
}
#endregion
#region Public Members
/// <summary>
/// Gets the size of the type in bytes.
/// </summary>
public static readonly int Stride = Marshal.SizeOf(typeof(T));
#region Check
/// <summary>
/// Checks whether the current typename T is blittable.
/// </summary>
public static bool Check()
{
return Check(Type);
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">A System.Type to check.</param>
public static bool Check(Type type)
{
if (!CheckStructLayoutAttribute(type))
Debug.Print("Warning: type {0} does not specify a StructLayoutAttribute with Pack=1. The memory layout of the struct may change between platforms.", type.Name);
return CheckType(type);
}
#endregion
#endregion
#region Private Members
// Checks whether the parameter is a primitive type or consists of primitive types recursively.
// Throws a NotSupportedException if it is not.
static bool CheckType(Type type)
{
//Debug.Print("Checking type {0} (size: {1} bytes).", type.Name, Marshal.SizeOf(type));
if (type.IsPrimitive)
return true;
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
Debug.Indent();
foreach (FieldInfo field in fields)
{
if (!CheckType(field.FieldType))
return false;
}
Debug.Unindent();
return true;
}
// Checks whether the specified struct defines [StructLayout(LayoutKind.Sequential, Pack=1)]
// or [StructLayout(LayoutKind.Explicit)]
static bool CheckStructLayoutAttribute(Type type)
{
StructLayoutAttribute[] attr = (StructLayoutAttribute[])
type.GetCustomAttributes(typeof(StructLayoutAttribute), true);
if ((attr == null) ||
(attr != null && attr.Length > 0 && attr[0].Value != LayoutKind.Explicit && attr[0].Pack != 1))
return false;
return true;
}
#endregion
}
#endregion
#region BlittableValueType
/// <summary>
/// Checks whether the specified type parameter is a blittable value type.
/// </summary>
/// <remarks>
/// A blittable value type is a struct that only references other value types recursively,
/// which allows it to be passed to unmanaged code directly.
/// </remarks>
public static class BlittableValueType
{
#region Check
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T type) where T : struct
{
return BlittableValueType<T>.Check();
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T[] type) where T : struct
{
return BlittableValueType<T>.Check();
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T[,] type) where T : struct
{
return BlittableValueType<T>.Check();
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T[, ,] type) where T : struct
{
return BlittableValueType<T>.Check();
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
[CLSCompliant(false)]
public static bool Check<T>(T[][] type) where T : struct
{
return BlittableValueType<T>.Check();
}
#endregion
#region From
/// <summary>
/// Returns the size of the specified value type in bytes.
/// </summary>
/// <typeparam name="T">The value type. Must be blittable.</typeparam>
/// <param name="type">An instance of the value type.</param>
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
return BlittableValueType<T>.Stride;
}
/// <summary>
/// Returns the size of a single array element in bytes.
/// </summary>
/// <typeparam name="T">The value type.</typeparam>
/// <param name="type">An instance of the value type.</param>
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T[] type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
return BlittableValueType<T>.Stride;
}
/// <summary>
/// Returns the size of a single array element in bytes.
/// </summary>
/// <typeparam name="T">The value type.</typeparam>
/// <param name="type">An instance of the value type.</param>
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T[,] type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
return BlittableValueType<T>.Stride;
}
/// <summary>
/// Returns the size of a single array element in bytes.
/// </summary>
/// <typeparam name="T">The value type.</typeparam>
/// <param name="type">An instance of the value type.</param>
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T[, ,] type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
return BlittableValueType<T>.Stride;
}
#endregion
}
#endregion
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Reflection;
namespace OpenTK
{
#region BlittableValueType<T>
/// <summary>
/// Checks whether the specified type parameter is a blittable value type.
/// </summary>
/// <remarks>
/// A blittable value type is a struct that only references other value types recursively,
/// which allows it to be passed to unmanaged code directly.
/// </remarks>
public static class BlittableValueType<T> where T : struct
{
#region Fields
static readonly Type Type;
#endregion
#region Constructors
static BlittableValueType()
{
Type = typeof(T);
}
#endregion
#region Public Members
/// <summary>
/// Gets the size of the type in bytes.
/// </summary>
public static readonly int Stride = Marshal.SizeOf(typeof(T));
#region Check
/// <summary>
/// Checks whether the current typename T is blittable.
/// </summary>
public static bool Check()
{
return Check(Type);
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">A System.Type to check.</param>
public static bool Check(Type type)
{
if (!CheckStructLayoutAttribute(type))
Debug.Print("Warning: type {0} does not specify a StructLayoutAttribute with Pack=1. The memory layout of the struct may change between platforms.", type.Name);
return CheckType(type);
}
#endregion
#endregion
#region Private Members
// Checks whether the parameter is a primitive type or consists of primitive types recursively.
// Throws a NotSupportedException if it is not.
static bool CheckType(Type type)
{
//Debug.Print("Checking type {0} (size: {1} bytes).", type.Name, Marshal.SizeOf(type));
if (type.IsPrimitive)
return true;
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
Debug.Indent();
foreach (FieldInfo field in fields)
{
if (!CheckType(field.FieldType))
return false;
}
Debug.Unindent();
return true;
}
// Checks whether the specified struct defines [StructLayout(LayoutKind.Sequential, Pack=1)]
// or [StructLayout(LayoutKind.Explicit)]
static bool CheckStructLayoutAttribute(Type type)
{
StructLayoutAttribute[] attr = (StructLayoutAttribute[])
type.GetCustomAttributes(typeof(StructLayoutAttribute), true);
if ((attr == null) ||
(attr != null && attr.Length > 0 && attr[0].Value != LayoutKind.Explicit && attr[0].Pack != 1))
return false;
return true;
}
#endregion
}
#endregion
#region BlittableValueType
/// <summary>
/// Checks whether the specified type parameter is a blittable value type.
/// </summary>
/// <remarks>
/// A blittable value type is a struct that only references other value types recursively,
/// which allows it to be passed to unmanaged code directly.
/// </remarks>
public static class BlittableValueType
{
#region Check
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T type) where T : struct
{
return BlittableValueType<T>.Check();
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T[] type) where T : struct
{
return BlittableValueType<T>.Check();
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T[,] type) where T : struct
{
return BlittableValueType<T>.Check();
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
public static bool Check<T>(T[, ,] type) where T : struct
{
return BlittableValueType<T>.Check();
}
/// <summary>
/// Checks whether type is a blittable value type.
/// </summary>
/// <param name="type">An instance of the type to check.</param>
[CLSCompliant(false)]
public static bool Check<T>(T[][] type) where T : struct
{
return BlittableValueType<T>.Check();
}
#endregion
#region From
/// <summary>
/// Returns the size of the specified value type in bytes.
/// </summary>
/// <typeparam name="T">The value type. Must be blittable.</typeparam>
/// <param name="type">An instance of the value type.</param>
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
return BlittableValueType<T>.Stride;
}
/// <summary>
/// Returns the size of a single array element in bytes.
/// </summary>
/// <typeparam name="T">The value type.</typeparam>
/// <param name="type">An instance of the value type.</param>
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T[] type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
return BlittableValueType<T>.Stride;
}
/// <summary>
/// Returns the size of a single array element in bytes.
/// </summary>
/// <typeparam name="T">The value type.</typeparam>
/// <param name="type">An instance of the value type.</param>
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T[,] type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
return BlittableValueType<T>.Stride;
}
/// <summary>
/// Returns the size of a single array element in bytes.
/// </summary>
/// <typeparam name="T">The value type.</typeparam>
/// <param name="type">An instance of the value type.</param>
/// <returns>An integer, specifying the size of the type in bytes.</returns>
/// <exception cref="System.ArgumentException">Occurs when type is not blittable.</exception>
public static int StrideOf<T>(T[, ,] type)
where T : struct
{
if (!Check(type))
throw new ArgumentException("type");
return BlittableValueType<T>.Stride;
}
#endregion
}
#endregion
}

File diff suppressed because it is too large Load diff

View file

@ -1,65 +1,65 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace OpenTK.Compute.CL10
{
/// <summary>
/// Provides access to the OpenCL 1.0 flat API.
/// </summary>
public partial class CL
{
#region Private Members
const string Library = "opencl.dll";
#endregion
#region Constructors
static CL()
{
Type imports = typeof(CL).GetNestedType("Core", BindingFlags.Static | BindingFlags.NonPublic);
FieldInfo[] delegates = typeof(CL).GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic).GetFields(BindingFlags.Static | BindingFlags.NonPublic);
if (delegates == null || imports == null)
throw new Exception("[Internal Error] Failed to locate CL.Delegates. Please file a bug report at http://www.opentk.com/issues");
for (int i = 0; i < delegates.Length; i++)
{
MethodInfo method = imports.GetMethod(delegates[i].Name.Substring(2), BindingFlags.Static | BindingFlags.NonPublic);
Delegate @new = Delegate.CreateDelegate(delegates[i].FieldType, method);
delegates[i].SetValue(null, @new);
}
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace OpenTK.Compute.CL10
{
/// <summary>
/// Provides access to the OpenCL 1.0 flat API.
/// </summary>
public partial class CL
{
#region Private Members
const string Library = "opencl.dll";
#endregion
#region Constructors
static CL()
{
Type imports = typeof(CL).GetNestedType("Core", BindingFlags.Static | BindingFlags.NonPublic);
FieldInfo[] delegates = typeof(CL).GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic).GetFields(BindingFlags.Static | BindingFlags.NonPublic);
if (delegates == null || imports == null)
throw new Exception("[Internal Error] Failed to locate CL.Delegates. Please file a bug report at http://www.opentk.com/issues");
for (int i = 0; i < delegates.Length; i++)
{
MethodInfo method = imports.GetMethod(delegates[i].Name.Substring(2), BindingFlags.Static | BindingFlags.NonPublic);
Delegate @new = Delegate.CreateDelegate(delegates[i].FieldType, method);
delegates[i].SetValue(null, @new);
}
}
#endregion
}
}

View file

@ -1,238 +1,238 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace OpenTK.Compute.CL10
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 3019
#pragma warning disable 1591
partial class CL
{
internal static partial class Core
{
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clBuildProgram", ExactSpelling = true)]
internal extern static unsafe int BuildProgram(IntPtr program, uint num_devices, IntPtr* device_list, String options, IntPtr pfn_notify, IntPtr user_data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateBuffer", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateBuffer(IntPtr context, MemFlags flags, IntPtr size, IntPtr host_ptr, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateCommandQueue", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateCommandQueue(IntPtr context, IntPtr device, CommandQueueFlags properties, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateContext", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateContext(ContextProperties* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateContextFromType", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateContextFromType(ContextProperties* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateImage2D", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateImage2D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_row_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateImage3D", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateImage3D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_depth, IntPtr image_row_pitch, IntPtr image_slice_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateKernel", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateKernel(IntPtr program, String kernel_name, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateKernelsInProgram", ExactSpelling = true)]
internal extern static unsafe int CreateKernelsInProgram(IntPtr program, uint num_kernels, IntPtr* kernels, [OutAttribute] uint* num_kernels_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateProgramWithBinary", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte @char, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateProgramWithSource", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateProgramWithSource(IntPtr context, uint count, String[] strings, IntPtr* lengths, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateSampler", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateSampler(IntPtr context, bool normalized_coords, AddressingMode addressing_mode, FilterMode filter_mode, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueBarrier", ExactSpelling = true)]
internal extern static int EnqueueBarrier(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueCopyBuffer", ExactSpelling = true)]
internal extern static unsafe int EnqueueCopyBuffer(IntPtr command_queue, IntPtr src_buffer, IntPtr dst_buffer, IntPtr src_offset, IntPtr dst_offset, IntPtr cb, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueCopyBufferToImage", ExactSpelling = true)]
internal extern static unsafe int EnqueueCopyBufferToImage(IntPtr command_queue, IntPtr src_buffer, IntPtr dst_image, IntPtr src_offset, IntPtr** dst_origin, IntPtr** region, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueCopyImage", ExactSpelling = true)]
internal extern static unsafe int EnqueueCopyImage(IntPtr command_queue, IntPtr src_image, IntPtr dst_image, IntPtr** src_origin, IntPtr** dst_origin, IntPtr** region, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueCopyImageToBuffer", ExactSpelling = true)]
internal extern static unsafe int EnqueueCopyImageToBuffer(IntPtr command_queue, IntPtr src_image, IntPtr dst_buffer, IntPtr** src_origin, IntPtr** region, IntPtr dst_offset, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueMapBuffer", ExactSpelling = true)]
internal extern static unsafe IntPtr EnqueueMapBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_map, MapFlags map_flags, IntPtr offset, IntPtr cb, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueMapImage", ExactSpelling = true)]
internal extern static unsafe IntPtr EnqueueMapImage(IntPtr command_queue, IntPtr image, bool blocking_map, MapFlags map_flags, IntPtr** origin, IntPtr** region, IntPtr* image_row_pitch, IntPtr* image_slice_pitch, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueMarker", ExactSpelling = true)]
internal extern static unsafe int EnqueueMarker(IntPtr command_queue, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueNativeKernel", ExactSpelling = true)]
internal extern static unsafe int EnqueueNativeKernel(IntPtr command_queue, IntPtr user_func, IntPtr args, IntPtr cb_args, uint num_mem_objects, IntPtr* mem_list, IntPtr args_mem_loc, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueNDRangeKernel", ExactSpelling = true)]
internal extern static unsafe int EnqueueNDRangeKernel(IntPtr command_queue, IntPtr kernel, uint work_dim, IntPtr* global_work_offset, IntPtr* global_work_size, IntPtr* local_work_size, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueReadBuffer", ExactSpelling = true)]
internal extern static unsafe int EnqueueReadBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_read, IntPtr offset, IntPtr cb, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueReadImage", ExactSpelling = true)]
internal extern static unsafe int EnqueueReadImage(IntPtr command_queue, IntPtr image, bool blocking_read, IntPtr** origin, IntPtr** region, IntPtr row_pitch, IntPtr slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueTask", ExactSpelling = true)]
internal extern static unsafe int EnqueueTask(IntPtr command_queue, IntPtr kernel, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueUnmapMemObject", ExactSpelling = true)]
internal extern static unsafe int EnqueueUnmapMemObject(IntPtr command_queue, IntPtr memobj, IntPtr mapped_ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueWaitForEvents", ExactSpelling = true)]
internal extern static unsafe int EnqueueWaitForEvents(IntPtr command_queue, uint num_events, IntPtr* event_list);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueWriteBuffer", ExactSpelling = true)]
internal extern static unsafe int EnqueueWriteBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_write, IntPtr offset, IntPtr cb, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueWriteImage", ExactSpelling = true)]
internal extern static unsafe int EnqueueWriteImage(IntPtr command_queue, IntPtr image, bool blocking_write, IntPtr** origin, IntPtr** region, IntPtr input_row_pitch, IntPtr input_slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clFinish", ExactSpelling = true)]
internal extern static int Finish(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clFlush", ExactSpelling = true)]
internal extern static int Flush(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetCommandQueueInfo", ExactSpelling = true)]
internal extern static unsafe int GetCommandQueueInfo(IntPtr command_queue, CommandQueueInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetContextInfo", ExactSpelling = true)]
internal extern static unsafe int GetContextInfo(IntPtr context, ContextInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetDeviceIDs", ExactSpelling = true)]
internal extern static unsafe int GetDeviceIDs(IntPtr platform, DeviceTypeFlags device_type, uint num_entries, IntPtr* devices, uint* num_devices);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetDeviceInfo", ExactSpelling = true)]
internal extern static unsafe int GetDeviceInfo(IntPtr device, DeviceInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetEventInfo", ExactSpelling = true)]
internal extern static unsafe int GetEventInfo(IntPtr @event, EventInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetEventProfilingInfo", ExactSpelling = true)]
internal extern static unsafe int GetEventProfilingInfo(IntPtr @event, ProfilingInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetImageInfo", ExactSpelling = true)]
internal extern static unsafe int GetImageInfo(IntPtr image, ImageInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetKernelInfo", ExactSpelling = true)]
internal extern static unsafe int GetKernelInfo(IntPtr kernel, KernelInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetKernelWorkGroupInfo", ExactSpelling = true)]
internal extern static unsafe int GetKernelWorkGroupInfo(IntPtr kernel, IntPtr device, KernelWorkGroupInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetMemObjectInfo", ExactSpelling = true)]
internal extern static unsafe int GetMemObjectInfo(IntPtr memobj, MemInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetPlatformIDs", ExactSpelling = true)]
internal extern static unsafe int GetPlatformIDs(uint num_entries, IntPtr* platforms, uint* num_platforms);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetPlatformInfo", ExactSpelling = true)]
internal extern static unsafe int GetPlatformInfo(IntPtr platform, PlatformInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetProgramBuildInfo", ExactSpelling = true)]
internal extern static unsafe int GetProgramBuildInfo(IntPtr program, IntPtr device, ProgramBuildInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetProgramInfo", ExactSpelling = true)]
internal extern static unsafe int GetProgramInfo(IntPtr program, ProgramInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetSamplerInfo", ExactSpelling = true)]
internal extern static unsafe int GetSamplerInfo(IntPtr sampler, SamplerInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetSupportedImageFormats", ExactSpelling = true)]
internal extern static unsafe int GetSupportedImageFormats(IntPtr context, MemFlags flags, MemObjectType image_type, uint num_entries, ImageFormat* image_formats, uint* num_image_formats);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseCommandQueue", ExactSpelling = true)]
internal extern static int ReleaseCommandQueue(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseContext", ExactSpelling = true)]
internal extern static int ReleaseContext(IntPtr context);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseEvent", ExactSpelling = true)]
internal extern static int ReleaseEvent(IntPtr @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseKernel", ExactSpelling = true)]
internal extern static int ReleaseKernel(IntPtr kernel);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseMemObject", ExactSpelling = true)]
internal extern static int ReleaseMemObject(IntPtr memobj);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseProgram", ExactSpelling = true)]
internal extern static int ReleaseProgram(IntPtr program);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseSampler", ExactSpelling = true)]
internal extern static int ReleaseSampler(IntPtr sampler);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainCommandQueue", ExactSpelling = true)]
internal extern static int RetainCommandQueue(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainContext", ExactSpelling = true)]
internal extern static int RetainContext(IntPtr context);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainEvent", ExactSpelling = true)]
internal extern static int RetainEvent(IntPtr @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainKernel", ExactSpelling = true)]
internal extern static int RetainKernel(IntPtr kernel);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainMemObject", ExactSpelling = true)]
internal extern static int RetainMemObject(IntPtr memobj);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainProgram", ExactSpelling = true)]
internal extern static int RetainProgram(IntPtr program);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainSampler", ExactSpelling = true)]
internal extern static int RetainSampler(IntPtr sampler);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clSetCommandQueueProperty", ExactSpelling = true)]
internal extern static unsafe int SetCommandQueueProperty(IntPtr command_queue, CommandQueueFlags properties, bool enable, CommandQueueFlags* old_properties);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clSetKernelArg", ExactSpelling = true)]
internal extern static int SetKernelArg(IntPtr kernel, uint arg_index, IntPtr arg_size, IntPtr arg_value);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clUnloadCompiler", ExactSpelling = true)]
internal extern static int UnloadCompiler();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clWaitForEvents", ExactSpelling = true)]
internal extern static unsafe int WaitForEvents(uint num_events, IntPtr* event_list);
}
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace OpenTK.Compute.CL10
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 3019
#pragma warning disable 1591
partial class CL
{
internal static partial class Core
{
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clBuildProgram", ExactSpelling = true)]
internal extern static unsafe int BuildProgram(IntPtr program, uint num_devices, IntPtr* device_list, String options, IntPtr pfn_notify, IntPtr user_data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateBuffer", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateBuffer(IntPtr context, MemFlags flags, IntPtr size, IntPtr host_ptr, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateCommandQueue", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateCommandQueue(IntPtr context, IntPtr device, CommandQueueFlags properties, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateContext", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateContext(ContextProperties* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateContextFromType", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateContextFromType(ContextProperties* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateImage2D", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateImage2D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_row_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateImage3D", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateImage3D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_depth, IntPtr image_row_pitch, IntPtr image_slice_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateKernel", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateKernel(IntPtr program, String kernel_name, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateKernelsInProgram", ExactSpelling = true)]
internal extern static unsafe int CreateKernelsInProgram(IntPtr program, uint num_kernels, IntPtr* kernels, [OutAttribute] uint* num_kernels_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateProgramWithBinary", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte @char, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateProgramWithSource", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateProgramWithSource(IntPtr context, uint count, String[] strings, IntPtr* lengths, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clCreateSampler", ExactSpelling = true)]
internal extern static unsafe IntPtr CreateSampler(IntPtr context, bool normalized_coords, AddressingMode addressing_mode, FilterMode filter_mode, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueBarrier", ExactSpelling = true)]
internal extern static int EnqueueBarrier(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueCopyBuffer", ExactSpelling = true)]
internal extern static unsafe int EnqueueCopyBuffer(IntPtr command_queue, IntPtr src_buffer, IntPtr dst_buffer, IntPtr src_offset, IntPtr dst_offset, IntPtr cb, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueCopyBufferToImage", ExactSpelling = true)]
internal extern static unsafe int EnqueueCopyBufferToImage(IntPtr command_queue, IntPtr src_buffer, IntPtr dst_image, IntPtr src_offset, IntPtr** dst_origin, IntPtr** region, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueCopyImage", ExactSpelling = true)]
internal extern static unsafe int EnqueueCopyImage(IntPtr command_queue, IntPtr src_image, IntPtr dst_image, IntPtr** src_origin, IntPtr** dst_origin, IntPtr** region, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueCopyImageToBuffer", ExactSpelling = true)]
internal extern static unsafe int EnqueueCopyImageToBuffer(IntPtr command_queue, IntPtr src_image, IntPtr dst_buffer, IntPtr** src_origin, IntPtr** region, IntPtr dst_offset, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueMapBuffer", ExactSpelling = true)]
internal extern static unsafe IntPtr EnqueueMapBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_map, MapFlags map_flags, IntPtr offset, IntPtr cb, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueMapImage", ExactSpelling = true)]
internal extern static unsafe IntPtr EnqueueMapImage(IntPtr command_queue, IntPtr image, bool blocking_map, MapFlags map_flags, IntPtr** origin, IntPtr** region, IntPtr* image_row_pitch, IntPtr* image_slice_pitch, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event, [OutAttribute] int* errcode_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueMarker", ExactSpelling = true)]
internal extern static unsafe int EnqueueMarker(IntPtr command_queue, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueNativeKernel", ExactSpelling = true)]
internal extern static unsafe int EnqueueNativeKernel(IntPtr command_queue, IntPtr user_func, IntPtr args, IntPtr cb_args, uint num_mem_objects, IntPtr* mem_list, IntPtr args_mem_loc, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueNDRangeKernel", ExactSpelling = true)]
internal extern static unsafe int EnqueueNDRangeKernel(IntPtr command_queue, IntPtr kernel, uint work_dim, IntPtr* global_work_offset, IntPtr* global_work_size, IntPtr* local_work_size, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueReadBuffer", ExactSpelling = true)]
internal extern static unsafe int EnqueueReadBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_read, IntPtr offset, IntPtr cb, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueReadImage", ExactSpelling = true)]
internal extern static unsafe int EnqueueReadImage(IntPtr command_queue, IntPtr image, bool blocking_read, IntPtr** origin, IntPtr** region, IntPtr row_pitch, IntPtr slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueTask", ExactSpelling = true)]
internal extern static unsafe int EnqueueTask(IntPtr command_queue, IntPtr kernel, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueUnmapMemObject", ExactSpelling = true)]
internal extern static unsafe int EnqueueUnmapMemObject(IntPtr command_queue, IntPtr memobj, IntPtr mapped_ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueWaitForEvents", ExactSpelling = true)]
internal extern static unsafe int EnqueueWaitForEvents(IntPtr command_queue, uint num_events, IntPtr* event_list);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueWriteBuffer", ExactSpelling = true)]
internal extern static unsafe int EnqueueWriteBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_write, IntPtr offset, IntPtr cb, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clEnqueueWriteImage", ExactSpelling = true)]
internal extern static unsafe int EnqueueWriteImage(IntPtr command_queue, IntPtr image, bool blocking_write, IntPtr** origin, IntPtr** region, IntPtr input_row_pitch, IntPtr input_slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clFinish", ExactSpelling = true)]
internal extern static int Finish(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clFlush", ExactSpelling = true)]
internal extern static int Flush(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetCommandQueueInfo", ExactSpelling = true)]
internal extern static unsafe int GetCommandQueueInfo(IntPtr command_queue, CommandQueueInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetContextInfo", ExactSpelling = true)]
internal extern static unsafe int GetContextInfo(IntPtr context, ContextInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetDeviceIDs", ExactSpelling = true)]
internal extern static unsafe int GetDeviceIDs(IntPtr platform, DeviceTypeFlags device_type, uint num_entries, IntPtr* devices, uint* num_devices);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetDeviceInfo", ExactSpelling = true)]
internal extern static unsafe int GetDeviceInfo(IntPtr device, DeviceInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetEventInfo", ExactSpelling = true)]
internal extern static unsafe int GetEventInfo(IntPtr @event, EventInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetEventProfilingInfo", ExactSpelling = true)]
internal extern static unsafe int GetEventProfilingInfo(IntPtr @event, ProfilingInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetImageInfo", ExactSpelling = true)]
internal extern static unsafe int GetImageInfo(IntPtr image, ImageInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetKernelInfo", ExactSpelling = true)]
internal extern static unsafe int GetKernelInfo(IntPtr kernel, KernelInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetKernelWorkGroupInfo", ExactSpelling = true)]
internal extern static unsafe int GetKernelWorkGroupInfo(IntPtr kernel, IntPtr device, KernelWorkGroupInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetMemObjectInfo", ExactSpelling = true)]
internal extern static unsafe int GetMemObjectInfo(IntPtr memobj, MemInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetPlatformIDs", ExactSpelling = true)]
internal extern static unsafe int GetPlatformIDs(uint num_entries, IntPtr* platforms, uint* num_platforms);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetPlatformInfo", ExactSpelling = true)]
internal extern static unsafe int GetPlatformInfo(IntPtr platform, PlatformInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetProgramBuildInfo", ExactSpelling = true)]
internal extern static unsafe int GetProgramBuildInfo(IntPtr program, IntPtr device, ProgramBuildInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetProgramInfo", ExactSpelling = true)]
internal extern static unsafe int GetProgramInfo(IntPtr program, ProgramInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetSamplerInfo", ExactSpelling = true)]
internal extern static unsafe int GetSamplerInfo(IntPtr sampler, SamplerInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clGetSupportedImageFormats", ExactSpelling = true)]
internal extern static unsafe int GetSupportedImageFormats(IntPtr context, MemFlags flags, MemObjectType image_type, uint num_entries, ImageFormat* image_formats, uint* num_image_formats);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseCommandQueue", ExactSpelling = true)]
internal extern static int ReleaseCommandQueue(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseContext", ExactSpelling = true)]
internal extern static int ReleaseContext(IntPtr context);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseEvent", ExactSpelling = true)]
internal extern static int ReleaseEvent(IntPtr @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseKernel", ExactSpelling = true)]
internal extern static int ReleaseKernel(IntPtr kernel);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseMemObject", ExactSpelling = true)]
internal extern static int ReleaseMemObject(IntPtr memobj);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseProgram", ExactSpelling = true)]
internal extern static int ReleaseProgram(IntPtr program);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clReleaseSampler", ExactSpelling = true)]
internal extern static int ReleaseSampler(IntPtr sampler);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainCommandQueue", ExactSpelling = true)]
internal extern static int RetainCommandQueue(IntPtr command_queue);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainContext", ExactSpelling = true)]
internal extern static int RetainContext(IntPtr context);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainEvent", ExactSpelling = true)]
internal extern static int RetainEvent(IntPtr @event);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainKernel", ExactSpelling = true)]
internal extern static int RetainKernel(IntPtr kernel);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainMemObject", ExactSpelling = true)]
internal extern static int RetainMemObject(IntPtr memobj);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainProgram", ExactSpelling = true)]
internal extern static int RetainProgram(IntPtr program);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clRetainSampler", ExactSpelling = true)]
internal extern static int RetainSampler(IntPtr sampler);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clSetCommandQueueProperty", ExactSpelling = true)]
internal extern static unsafe int SetCommandQueueProperty(IntPtr command_queue, CommandQueueFlags properties, bool enable, CommandQueueFlags* old_properties);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clSetKernelArg", ExactSpelling = true)]
internal extern static int SetKernelArg(IntPtr kernel, uint arg_index, IntPtr arg_size, IntPtr arg_value);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clUnloadCompiler", ExactSpelling = true)]
internal extern static int UnloadCompiler();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(CL.Library, EntryPoint = "clWaitForEvents", ExactSpelling = true)]
internal extern static unsafe int WaitForEvents(uint num_events, IntPtr* event_list);
}
}
}

View file

@ -1,237 +1,237 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace OpenTK.Compute.CL10
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 0649
#pragma warning disable 3019
#pragma warning disable 1591
partial class CL
{
internal static partial class Delegates
{
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int BuildProgram(IntPtr program, uint num_devices, IntPtr* device_list, String options, IntPtr pfn_notify, IntPtr user_data);
internal unsafe static BuildProgram clBuildProgram;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateBuffer(IntPtr context, MemFlags flags, IntPtr size, IntPtr host_ptr, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateBuffer clCreateBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateCommandQueue(IntPtr context, IntPtr device, CommandQueueFlags properties, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateCommandQueue clCreateCommandQueue;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateContext(ContextProperties* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] int* errcode_ret);
internal unsafe static CreateContext clCreateContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateContextFromType(ContextProperties* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateContextFromType clCreateContextFromType;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateImage2D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_row_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
internal unsafe static CreateImage2D clCreateImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateImage3D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_depth, IntPtr image_row_pitch, IntPtr image_slice_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
internal unsafe static CreateImage3D clCreateImage3D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateKernel(IntPtr program, String kernel_name, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateKernel clCreateKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int CreateKernelsInProgram(IntPtr program, uint num_kernels, IntPtr* kernels, [OutAttribute] uint* num_kernels_ret);
internal unsafe static CreateKernelsInProgram clCreateKernelsInProgram;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte @char, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateProgramWithBinary clCreateProgramWithBinary;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateProgramWithSource(IntPtr context, uint count, String[] strings, IntPtr* lengths, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateProgramWithSource clCreateProgramWithSource;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateSampler(IntPtr context, bool normalized_coords, AddressingMode addressing_mode, FilterMode filter_mode, [OutAttribute] int* errcode_ret);
internal unsafe static CreateSampler clCreateSampler;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int EnqueueBarrier(IntPtr command_queue);
internal static EnqueueBarrier clEnqueueBarrier;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueCopyBuffer(IntPtr command_queue, IntPtr src_buffer, IntPtr dst_buffer, IntPtr src_offset, IntPtr dst_offset, IntPtr cb, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueCopyBuffer clEnqueueCopyBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueCopyBufferToImage(IntPtr command_queue, IntPtr src_buffer, IntPtr dst_image, IntPtr src_offset, IntPtr** dst_origin, IntPtr** region, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueCopyBufferToImage clEnqueueCopyBufferToImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueCopyImage(IntPtr command_queue, IntPtr src_image, IntPtr dst_image, IntPtr** src_origin, IntPtr** dst_origin, IntPtr** region, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueCopyImage clEnqueueCopyImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueCopyImageToBuffer(IntPtr command_queue, IntPtr src_image, IntPtr dst_buffer, IntPtr** src_origin, IntPtr** region, IntPtr dst_offset, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr EnqueueMapBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_map, MapFlags map_flags, IntPtr offset, IntPtr cb, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event, [OutAttribute] int* errcode_ret);
internal unsafe static EnqueueMapBuffer clEnqueueMapBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr EnqueueMapImage(IntPtr command_queue, IntPtr image, bool blocking_map, MapFlags map_flags, IntPtr** origin, IntPtr** region, IntPtr* image_row_pitch, IntPtr* image_slice_pitch, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event, [OutAttribute] int* errcode_ret);
internal unsafe static EnqueueMapImage clEnqueueMapImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueMarker(IntPtr command_queue, IntPtr* @event);
internal unsafe static EnqueueMarker clEnqueueMarker;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueNativeKernel(IntPtr command_queue, IntPtr user_func, IntPtr args, IntPtr cb_args, uint num_mem_objects, IntPtr* mem_list, IntPtr args_mem_loc, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueNativeKernel clEnqueueNativeKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueNDRangeKernel(IntPtr command_queue, IntPtr kernel, uint work_dim, IntPtr* global_work_offset, IntPtr* global_work_size, IntPtr* local_work_size, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueNDRangeKernel clEnqueueNDRangeKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueReadBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_read, IntPtr offset, IntPtr cb, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueReadBuffer clEnqueueReadBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueReadImage(IntPtr command_queue, IntPtr image, bool blocking_read, IntPtr** origin, IntPtr** region, IntPtr row_pitch, IntPtr slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueReadImage clEnqueueReadImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueTask(IntPtr command_queue, IntPtr kernel, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueTask clEnqueueTask;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueUnmapMemObject(IntPtr command_queue, IntPtr memobj, IntPtr mapped_ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueUnmapMemObject clEnqueueUnmapMemObject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueWaitForEvents(IntPtr command_queue, uint num_events, IntPtr* event_list);
internal unsafe static EnqueueWaitForEvents clEnqueueWaitForEvents;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueWriteBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_write, IntPtr offset, IntPtr cb, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueWriteBuffer clEnqueueWriteBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueWriteImage(IntPtr command_queue, IntPtr image, bool blocking_write, IntPtr** origin, IntPtr** region, IntPtr input_row_pitch, IntPtr input_slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueWriteImage clEnqueueWriteImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int Finish(IntPtr command_queue);
internal static Finish clFinish;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int Flush(IntPtr command_queue);
internal static Flush clFlush;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetCommandQueueInfo(IntPtr command_queue, CommandQueueInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetCommandQueueInfo clGetCommandQueueInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetContextInfo(IntPtr context, ContextInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetContextInfo clGetContextInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetDeviceIDs(IntPtr platform, DeviceTypeFlags device_type, uint num_entries, IntPtr* devices, uint* num_devices);
internal unsafe static GetDeviceIDs clGetDeviceIDs;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetDeviceInfo(IntPtr device, DeviceInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetDeviceInfo clGetDeviceInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetEventInfo(IntPtr @event, EventInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetEventInfo clGetEventInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetEventProfilingInfo(IntPtr @event, ProfilingInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetEventProfilingInfo clGetEventProfilingInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetImageInfo(IntPtr image, ImageInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetImageInfo clGetImageInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetKernelInfo(IntPtr kernel, KernelInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetKernelInfo clGetKernelInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetKernelWorkGroupInfo(IntPtr kernel, IntPtr device, KernelWorkGroupInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetKernelWorkGroupInfo clGetKernelWorkGroupInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetMemObjectInfo(IntPtr memobj, MemInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetMemObjectInfo clGetMemObjectInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetPlatformIDs(uint num_entries, IntPtr* platforms, uint* num_platforms);
internal unsafe static GetPlatformIDs clGetPlatformIDs;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetPlatformInfo(IntPtr platform, PlatformInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetPlatformInfo clGetPlatformInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetProgramBuildInfo(IntPtr program, IntPtr device, ProgramBuildInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetProgramBuildInfo clGetProgramBuildInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetProgramInfo(IntPtr program, ProgramInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetProgramInfo clGetProgramInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetSamplerInfo(IntPtr sampler, SamplerInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetSamplerInfo clGetSamplerInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetSupportedImageFormats(IntPtr context, MemFlags flags, MemObjectType image_type, uint num_entries, ImageFormat* image_formats, uint* num_image_formats);
internal unsafe static GetSupportedImageFormats clGetSupportedImageFormats;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseCommandQueue(IntPtr command_queue);
internal static ReleaseCommandQueue clReleaseCommandQueue;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseContext(IntPtr context);
internal static ReleaseContext clReleaseContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseEvent(IntPtr @event);
internal static ReleaseEvent clReleaseEvent;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseKernel(IntPtr kernel);
internal static ReleaseKernel clReleaseKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseMemObject(IntPtr memobj);
internal static ReleaseMemObject clReleaseMemObject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseProgram(IntPtr program);
internal static ReleaseProgram clReleaseProgram;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseSampler(IntPtr sampler);
internal static ReleaseSampler clReleaseSampler;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainCommandQueue(IntPtr command_queue);
internal static RetainCommandQueue clRetainCommandQueue;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainContext(IntPtr context);
internal static RetainContext clRetainContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainEvent(IntPtr @event);
internal static RetainEvent clRetainEvent;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainKernel(IntPtr kernel);
internal static RetainKernel clRetainKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainMemObject(IntPtr memobj);
internal static RetainMemObject clRetainMemObject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainProgram(IntPtr program);
internal static RetainProgram clRetainProgram;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainSampler(IntPtr sampler);
internal static RetainSampler clRetainSampler;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int SetCommandQueueProperty(IntPtr command_queue, CommandQueueFlags properties, bool enable, CommandQueueFlags* old_properties);
internal unsafe static SetCommandQueueProperty clSetCommandQueueProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int SetKernelArg(IntPtr kernel, uint arg_index, IntPtr arg_size, IntPtr arg_value);
internal static SetKernelArg clSetKernelArg;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int UnloadCompiler();
internal static UnloadCompiler clUnloadCompiler;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int WaitForEvents(uint num_events, IntPtr* event_list);
internal unsafe static WaitForEvents clWaitForEvents;
}
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace OpenTK.Compute.CL10
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 0649
#pragma warning disable 3019
#pragma warning disable 1591
partial class CL
{
internal static partial class Delegates
{
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int BuildProgram(IntPtr program, uint num_devices, IntPtr* device_list, String options, IntPtr pfn_notify, IntPtr user_data);
internal unsafe static BuildProgram clBuildProgram;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateBuffer(IntPtr context, MemFlags flags, IntPtr size, IntPtr host_ptr, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateBuffer clCreateBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateCommandQueue(IntPtr context, IntPtr device, CommandQueueFlags properties, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateCommandQueue clCreateCommandQueue;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateContext(ContextProperties* properties, uint num_devices, IntPtr* devices, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] int* errcode_ret);
internal unsafe static CreateContext clCreateContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateContextFromType(ContextProperties* properties, DeviceTypeFlags device_type, IntPtr pfn_notify, IntPtr user_data, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateContextFromType clCreateContextFromType;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateImage2D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_row_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
internal unsafe static CreateImage2D clCreateImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateImage3D(IntPtr context, MemFlags flags, ImageFormat* image_format, IntPtr image_width, IntPtr image_height, IntPtr image_depth, IntPtr image_row_pitch, IntPtr image_slice_pitch, IntPtr host_ptr, [OutAttribute] int* errcode_ret);
internal unsafe static CreateImage3D clCreateImage3D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateKernel(IntPtr program, String kernel_name, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateKernel clCreateKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int CreateKernelsInProgram(IntPtr program, uint num_kernels, IntPtr* kernels, [OutAttribute] uint* num_kernels_ret);
internal unsafe static CreateKernelsInProgram clCreateKernelsInProgram;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateProgramWithBinary(IntPtr context, uint num_devices, IntPtr* device_list, IntPtr* lengths, byte @char, int* binary_status, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateProgramWithBinary clCreateProgramWithBinary;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateProgramWithSource(IntPtr context, uint count, String[] strings, IntPtr* lengths, [OutAttribute] OpenTK.Compute.CL10.ErrorCode* errcode_ret);
internal unsafe static CreateProgramWithSource clCreateProgramWithSource;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr CreateSampler(IntPtr context, bool normalized_coords, AddressingMode addressing_mode, FilterMode filter_mode, [OutAttribute] int* errcode_ret);
internal unsafe static CreateSampler clCreateSampler;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int EnqueueBarrier(IntPtr command_queue);
internal static EnqueueBarrier clEnqueueBarrier;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueCopyBuffer(IntPtr command_queue, IntPtr src_buffer, IntPtr dst_buffer, IntPtr src_offset, IntPtr dst_offset, IntPtr cb, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueCopyBuffer clEnqueueCopyBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueCopyBufferToImage(IntPtr command_queue, IntPtr src_buffer, IntPtr dst_image, IntPtr src_offset, IntPtr** dst_origin, IntPtr** region, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueCopyBufferToImage clEnqueueCopyBufferToImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueCopyImage(IntPtr command_queue, IntPtr src_image, IntPtr dst_image, IntPtr** src_origin, IntPtr** dst_origin, IntPtr** region, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueCopyImage clEnqueueCopyImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueCopyImageToBuffer(IntPtr command_queue, IntPtr src_image, IntPtr dst_buffer, IntPtr** src_origin, IntPtr** region, IntPtr dst_offset, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr EnqueueMapBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_map, MapFlags map_flags, IntPtr offset, IntPtr cb, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event, [OutAttribute] int* errcode_ret);
internal unsafe static EnqueueMapBuffer clEnqueueMapBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr EnqueueMapImage(IntPtr command_queue, IntPtr image, bool blocking_map, MapFlags map_flags, IntPtr** origin, IntPtr** region, IntPtr* image_row_pitch, IntPtr* image_slice_pitch, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event, [OutAttribute] int* errcode_ret);
internal unsafe static EnqueueMapImage clEnqueueMapImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueMarker(IntPtr command_queue, IntPtr* @event);
internal unsafe static EnqueueMarker clEnqueueMarker;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueNativeKernel(IntPtr command_queue, IntPtr user_func, IntPtr args, IntPtr cb_args, uint num_mem_objects, IntPtr* mem_list, IntPtr args_mem_loc, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueNativeKernel clEnqueueNativeKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueNDRangeKernel(IntPtr command_queue, IntPtr kernel, uint work_dim, IntPtr* global_work_offset, IntPtr* global_work_size, IntPtr* local_work_size, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueNDRangeKernel clEnqueueNDRangeKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueReadBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_read, IntPtr offset, IntPtr cb, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueReadBuffer clEnqueueReadBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueReadImage(IntPtr command_queue, IntPtr image, bool blocking_read, IntPtr** origin, IntPtr** region, IntPtr row_pitch, IntPtr slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueReadImage clEnqueueReadImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueTask(IntPtr command_queue, IntPtr kernel, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueTask clEnqueueTask;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueUnmapMemObject(IntPtr command_queue, IntPtr memobj, IntPtr mapped_ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueUnmapMemObject clEnqueueUnmapMemObject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueWaitForEvents(IntPtr command_queue, uint num_events, IntPtr* event_list);
internal unsafe static EnqueueWaitForEvents clEnqueueWaitForEvents;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueWriteBuffer(IntPtr command_queue, IntPtr buffer, bool blocking_write, IntPtr offset, IntPtr cb, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueWriteBuffer clEnqueueWriteBuffer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int EnqueueWriteImage(IntPtr command_queue, IntPtr image, bool blocking_write, IntPtr** origin, IntPtr** region, IntPtr input_row_pitch, IntPtr input_slice_pitch, IntPtr ptr, uint num_events_in_wait_list, IntPtr* event_wait_list, IntPtr* @event);
internal unsafe static EnqueueWriteImage clEnqueueWriteImage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int Finish(IntPtr command_queue);
internal static Finish clFinish;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int Flush(IntPtr command_queue);
internal static Flush clFlush;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetCommandQueueInfo(IntPtr command_queue, CommandQueueInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetCommandQueueInfo clGetCommandQueueInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetContextInfo(IntPtr context, ContextInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetContextInfo clGetContextInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetDeviceIDs(IntPtr platform, DeviceTypeFlags device_type, uint num_entries, IntPtr* devices, uint* num_devices);
internal unsafe static GetDeviceIDs clGetDeviceIDs;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetDeviceInfo(IntPtr device, DeviceInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetDeviceInfo clGetDeviceInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetEventInfo(IntPtr @event, EventInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetEventInfo clGetEventInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetEventProfilingInfo(IntPtr @event, ProfilingInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetEventProfilingInfo clGetEventProfilingInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetImageInfo(IntPtr image, ImageInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetImageInfo clGetImageInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetKernelInfo(IntPtr kernel, KernelInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetKernelInfo clGetKernelInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetKernelWorkGroupInfo(IntPtr kernel, IntPtr device, KernelWorkGroupInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetKernelWorkGroupInfo clGetKernelWorkGroupInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetMemObjectInfo(IntPtr memobj, MemInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetMemObjectInfo clGetMemObjectInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetPlatformIDs(uint num_entries, IntPtr* platforms, uint* num_platforms);
internal unsafe static GetPlatformIDs clGetPlatformIDs;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetPlatformInfo(IntPtr platform, PlatformInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetPlatformInfo clGetPlatformInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetProgramBuildInfo(IntPtr program, IntPtr device, ProgramBuildInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetProgramBuildInfo clGetProgramBuildInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetProgramInfo(IntPtr program, ProgramInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetProgramInfo clGetProgramInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetSamplerInfo(IntPtr sampler, SamplerInfo param_name, IntPtr param_value_size, IntPtr param_value, [OutAttribute] IntPtr* param_value_size_ret);
internal unsafe static GetSamplerInfo clGetSamplerInfo;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int GetSupportedImageFormats(IntPtr context, MemFlags flags, MemObjectType image_type, uint num_entries, ImageFormat* image_formats, uint* num_image_formats);
internal unsafe static GetSupportedImageFormats clGetSupportedImageFormats;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseCommandQueue(IntPtr command_queue);
internal static ReleaseCommandQueue clReleaseCommandQueue;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseContext(IntPtr context);
internal static ReleaseContext clReleaseContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseEvent(IntPtr @event);
internal static ReleaseEvent clReleaseEvent;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseKernel(IntPtr kernel);
internal static ReleaseKernel clReleaseKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseMemObject(IntPtr memobj);
internal static ReleaseMemObject clReleaseMemObject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseProgram(IntPtr program);
internal static ReleaseProgram clReleaseProgram;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int ReleaseSampler(IntPtr sampler);
internal static ReleaseSampler clReleaseSampler;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainCommandQueue(IntPtr command_queue);
internal static RetainCommandQueue clRetainCommandQueue;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainContext(IntPtr context);
internal static RetainContext clRetainContext;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainEvent(IntPtr @event);
internal static RetainEvent clRetainEvent;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainKernel(IntPtr kernel);
internal static RetainKernel clRetainKernel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainMemObject(IntPtr memobj);
internal static RetainMemObject clRetainMemObject;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainProgram(IntPtr program);
internal static RetainProgram clRetainProgram;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int RetainSampler(IntPtr sampler);
internal static RetainSampler clRetainSampler;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int SetCommandQueueProperty(IntPtr command_queue, CommandQueueFlags properties, bool enable, CommandQueueFlags* old_properties);
internal unsafe static SetCommandQueueProperty clSetCommandQueueProperty;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int SetKernelArg(IntPtr kernel, uint arg_index, IntPtr arg_size, IntPtr arg_value);
internal static SetKernelArg clSetKernelArg;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate int UnloadCompiler();
internal static UnloadCompiler clUnloadCompiler;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate int WaitForEvents(uint num_events, IntPtr* event_list);
internal unsafe static WaitForEvents clWaitForEvents;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,53 +1,53 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Compute.CL10
{
struct ErrorHelper : IDisposable
{
#region Constructors
public ErrorHelper(IntPtr context)
{
}
#endregion
#region IDisposable Members
public void Dispose()
{
throw new NotImplementedException();
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Compute.CL10
{
struct ErrorHelper : IDisposable
{
#region Constructors
public ErrorHelper(IntPtr context)
{
}
#endregion
#region IDisposable Members
public void Dispose()
{
throw new NotImplementedException();
}
#endregion
}
}

View file

@ -1,45 +1,45 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OpenTK.Compute.CL10
{
[StructLayout(LayoutKind.Sequential)]
public struct ImageFormat
{
ChannelOrder image_channel_order;
ChannelType image_channel_data_type;
public ChannelOrder ChannelOrder { get { return image_channel_order; } set { image_channel_order = value; } }
public ChannelType ChannelType { get { return image_channel_data_type; } set { image_channel_data_type = value; } }
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OpenTK.Compute.CL10
{
[StructLayout(LayoutKind.Sequential)]
public struct ImageFormat
{
ChannelOrder image_channel_order;
ChannelType image_channel_data_type;
public ChannelOrder ChannelOrder { get { return image_channel_order; } set { image_channel_order = value; } }
public ChannelType ChannelType { get { return image_channel_data_type; } set { image_channel_data_type = value; } }
}
}

View file

@ -1,35 +1,35 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Compute
{
}

View file

@ -1,34 +1,34 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}

View file

@ -1,35 +1,35 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}

View file

@ -1,37 +1,37 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Security;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Security;
namespace OpenTK.Compute
{
}

View file

@ -1,35 +1,35 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Compute
{
}

View file

@ -1,34 +1,34 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}

View file

@ -1,34 +1,34 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}

View file

@ -1,34 +1,34 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}

View file

@ -1,34 +1,34 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}

View file

@ -1,34 +1,34 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}

View file

@ -1,34 +1,34 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}

View file

@ -1,34 +1,34 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
}

View file

@ -1,193 +1,193 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
#region struct Handle<T>
struct Handle<T> : IEquatable<Handle<T>>, IComparable<Handle<T>>
{
#region Fields
IntPtr handle;
/// <summary>
/// Gets a System.IntPtr that represents the handle of this ContextHandle.
/// </summary>
public IntPtr Value { get { return handle; } }
/// <summary>A read-only field that represents a handle that has been initialized to zero.</summary>
public static readonly Handle<T> Zero = new Handle<T>(IntPtr.Zero);
#endregion
#region Constructors
/// <summary>
/// Constructs a new instance with the specified handle.
/// </summary>
/// <param name="h">A System.IntPtr containing the value for this instance.</param>
public Handle(IntPtr h) { handle = h; }
#endregion
#region Public Members
#region ToString
/// <summary>
/// Converts this instance to its equivalent string representation.
/// </summary>
/// <returns>A System.String that contains the string representation of this instance.</returns>
public override string ToString()
{
return Value.ToString();
}
#endregion
#region Equals
/// <summary>
/// Compares this instance to the specified object.
/// </summary>
/// <param name="obj">The System.Object to compare to.</param>
/// <returns>True if obj is a ContextHandle that is equal to this instance; false otherwise.</returns>
public override bool Equals(object obj)
{
if (obj is Handle<T>)
return this.Equals((Handle<T>)obj);
return false;
}
#endregion
#region GetHashCode
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>A System.Int32 with the hash code of this instance.</returns>
public override int GetHashCode()
{
return Value.GetHashCode();
}
#endregion
#region public static explicit operator IntPtr(Handle<T> c)
/// <summary>
/// Converts the specified ContextHandle to the equivalent IntPtr.
/// </summary>
/// <param name="c">The ContextHandle to convert.</param>
/// <returns>A System.IntPtr equivalent to the specified ContextHandle.</returns>
public static explicit operator IntPtr(Handle<T> c)
{
return c != Handle<T>.Zero ? c.Value : IntPtr.Zero;
}
#endregion
#region public static explicit operator Handle<T>(IntPtr p)
/// <summary>
/// Converts the specified IntPtr to the equivalent ContextHandle.
/// </summary>
/// <param name="p">The System.IntPtr to convert.</param>
/// <returns>A ContextHandle equivalent to the specified IntPtr.</returns>
public static explicit operator Handle<T>(IntPtr p)
{
return new Handle<T>(p);
}
#endregion
/// <summary>
/// Compares two instances for equality.
/// </summary>
/// <param name="left">The instance to compare.</param>
/// <param name="right">The instance to compare to.</param>
/// <returns>True if left is equal to right; false otherwise.</returns>
public static bool operator ==(Handle<T> left, Handle<T> right)
{
return left.Equals(right);
}
/// <summary>
/// Compares two instances for inequality.
/// </summary>
/// <param name="left">The instance to compare.</param>
/// <param name="right">The instance to compare to.</param>
/// <returns>True if left is not equal to right; false otherwise.</returns>
public static bool operator !=(Handle<T> left, Handle<T> right)
{
return !left.Equals(right);
}
#endregion
#region IComparable<Handle<T>> Members
/// <summary>
/// Compares the numerical value of this instance to other and returns a value indicating their relative order.
/// </summary>
/// <param name="other">The instance to compare to.</param>
/// <returns>Less than 0, if this instance is less than other; 0 if both are equal; Greater than 0 if other is greater than this instance.</returns>
public int CompareTo(Handle<T> other)
{
unsafe
{
return Value.ToInt64().CompareTo(other.Value.ToInt64());
}
}
#endregion
#region IEquatable<Handle<T>> Members
/// <summary>
/// Compares this instance to the specified ContextHandle for equality.
/// </summary>
/// <param name="other">The ContextHandle to compare to.</param>
/// <returns>True if this instance is equal to other; false otherwise.</returns>
public bool Equals(Handle<T> other)
{
return Value == other.Value;
}
#endregion
}
#endregion
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OpenTK.Compute
{
#region struct Handle<T>
struct Handle<T> : IEquatable<Handle<T>>, IComparable<Handle<T>>
{
#region Fields
IntPtr handle;
/// <summary>
/// Gets a System.IntPtr that represents the handle of this ContextHandle.
/// </summary>
public IntPtr Value { get { return handle; } }
/// <summary>A read-only field that represents a handle that has been initialized to zero.</summary>
public static readonly Handle<T> Zero = new Handle<T>(IntPtr.Zero);
#endregion
#region Constructors
/// <summary>
/// Constructs a new instance with the specified handle.
/// </summary>
/// <param name="h">A System.IntPtr containing the value for this instance.</param>
public Handle(IntPtr h) { handle = h; }
#endregion
#region Public Members
#region ToString
/// <summary>
/// Converts this instance to its equivalent string representation.
/// </summary>
/// <returns>A System.String that contains the string representation of this instance.</returns>
public override string ToString()
{
return Value.ToString();
}
#endregion
#region Equals
/// <summary>
/// Compares this instance to the specified object.
/// </summary>
/// <param name="obj">The System.Object to compare to.</param>
/// <returns>True if obj is a ContextHandle that is equal to this instance; false otherwise.</returns>
public override bool Equals(object obj)
{
if (obj is Handle<T>)
return this.Equals((Handle<T>)obj);
return false;
}
#endregion
#region GetHashCode
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>A System.Int32 with the hash code of this instance.</returns>
public override int GetHashCode()
{
return Value.GetHashCode();
}
#endregion
#region public static explicit operator IntPtr(Handle<T> c)
/// <summary>
/// Converts the specified ContextHandle to the equivalent IntPtr.
/// </summary>
/// <param name="c">The ContextHandle to convert.</param>
/// <returns>A System.IntPtr equivalent to the specified ContextHandle.</returns>
public static explicit operator IntPtr(Handle<T> c)
{
return c != Handle<T>.Zero ? c.Value : IntPtr.Zero;
}
#endregion
#region public static explicit operator Handle<T>(IntPtr p)
/// <summary>
/// Converts the specified IntPtr to the equivalent ContextHandle.
/// </summary>
/// <param name="p">The System.IntPtr to convert.</param>
/// <returns>A ContextHandle equivalent to the specified IntPtr.</returns>
public static explicit operator Handle<T>(IntPtr p)
{
return new Handle<T>(p);
}
#endregion
/// <summary>
/// Compares two instances for equality.
/// </summary>
/// <param name="left">The instance to compare.</param>
/// <param name="right">The instance to compare to.</param>
/// <returns>True if left is equal to right; false otherwise.</returns>
public static bool operator ==(Handle<T> left, Handle<T> right)
{
return left.Equals(right);
}
/// <summary>
/// Compares two instances for inequality.
/// </summary>
/// <param name="left">The instance to compare.</param>
/// <param name="right">The instance to compare to.</param>
/// <returns>True if left is not equal to right; false otherwise.</returns>
public static bool operator !=(Handle<T> left, Handle<T> right)
{
return !left.Equals(right);
}
#endregion
#region IComparable<Handle<T>> Members
/// <summary>
/// Compares the numerical value of this instance to other and returns a value indicating their relative order.
/// </summary>
/// <param name="other">The instance to compare to.</param>
/// <returns>Less than 0, if this instance is less than other; 0 if both are equal; Greater than 0 if other is greater than this instance.</returns>
public int CompareTo(Handle<T> other)
{
unsafe
{
return Value.ToInt64().CompareTo(other.Value.ToInt64());
}
}
#endregion
#region IEquatable<Handle<T>> Members
/// <summary>
/// Compares this instance to the specified ContextHandle for equality.
/// </summary>
/// <param name="other">The ContextHandle to compare to.</param>
/// <returns>True if this instance is equal to other; false otherwise.</returns>
public bool Equals(Handle<T> other)
{
return Value == other.Value;
}
#endregion
}
#endregion
}

View file

@ -1,70 +1,70 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
namespace OpenTK
{
/// <summary>
/// Defines the arguments for frame events.
/// A FrameEventArgs instance is only valid for the duration of the relevant event;
/// do not store references to FrameEventArgs outside this event.
/// </summary>
public class FrameEventArgs : EventArgs
{
double elapsed;
/// <summary>
/// Constructs a new FrameEventArgs instance.
/// </summary>
public FrameEventArgs()
{ }
/// <summary>
/// Constructs a new FrameEventArgs instance.
/// </summary>
/// <param name="elapsed">The amount of time that has elapsed since the previous event, in seconds.</param>
public FrameEventArgs(double elapsed)
{
Time = elapsed;
}
/// <summary>
/// Gets a <see cref="System.Double"/> that indicates how many seconds of time elapsed since the previous event.
/// </summary>
public double Time
{
get { return elapsed; }
internal set
{
if (value <= 0)
throw new ArgumentOutOfRangeException();
elapsed = value;
}
}
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
namespace OpenTK
{
/// <summary>
/// Defines the arguments for frame events.
/// A FrameEventArgs instance is only valid for the duration of the relevant event;
/// do not store references to FrameEventArgs outside this event.
/// </summary>
public class FrameEventArgs : EventArgs
{
double elapsed;
/// <summary>
/// Constructs a new FrameEventArgs instance.
/// </summary>
public FrameEventArgs()
{ }
/// <summary>
/// Constructs a new FrameEventArgs instance.
/// </summary>
/// <param name="elapsed">The amount of time that has elapsed since the previous event, in seconds.</param>
public FrameEventArgs(double elapsed)
{
Time = elapsed;
}
/// <summary>
/// Gets a <see cref="System.Double"/> that indicates how many seconds of time elapsed since the previous event.
/// </summary>
public double Time
{
get { return elapsed; }
internal set
{
if (value <= 0)
throw new ArgumentOutOfRangeException();
elapsed = value;
}
}
}
}

View file

@ -1,208 +1,208 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace OpenTK.Graphics
{
/// <summary>
/// Provides a common foundation for all flat API classes.
/// </summary>
public abstract class BindingsBase
{
#region Fields
/// <summary>
/// A reflection handle to the nested type that contains the function delegates.
/// </summary>
readonly protected Type DelegatesClass;
/// <summary>
/// A refection handle to the nested type that contains core functions (i.e. not extensions).
/// </summary>
readonly protected Type CoreClass;
/// <summary>
/// A mapping of core function names to MethodInfo handles.
/// </summary>
readonly protected SortedList<string, MethodInfo> CoreFunctionMap = new SortedList<string, MethodInfo>();
bool rebuildExtensionList = true;
#endregion
#region Constructors
/// <summary>
/// Constructs a new BindingsBase instance.
/// </summary>
public BindingsBase()
{
DelegatesClass = this.GetType().GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic);
CoreClass = this.GetType().GetNestedType("Core", BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] methods = CoreClass.GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
CoreFunctionMap = new SortedList<string, MethodInfo>(methods.Length);
foreach (MethodInfo m in methods)
{
CoreFunctionMap.Add(m.Name, m);
}
}
#endregion
#region Protected Members
/// <summary>
/// Gets or sets a <see cref="System.Boolean"/> that indicates whether the list of supported extensions may have changed.
/// </summary>
protected bool RebuildExtensionList
{
get { return rebuildExtensionList; }
set { rebuildExtensionList = value; }
}
#endregion
#region Internal Members
#region LoadAll
internal void LoadAll()
{
// Using reflection is more than 3 times faster than directly loading delegates on the first
// run, probably due to code generation overhead. Subsequent runs are faster with direct loading
// than with reflection, but the first time is more significant.
int supported = 0;
FieldInfo[] delegates = DelegatesClass.GetFields(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
if (delegates == null)
throw new InvalidOperationException("The specified type does not have any loadable extensions.");
Debug.Write("Load extensions for " + this.GetType().FullName + "... ");
System.Diagnostics.Stopwatch time = new System.Diagnostics.Stopwatch();
time.Reset();
time.Start();
foreach (FieldInfo f in delegates)
{
Delegate d = LoadDelegate(f.Name, f.FieldType);
if (d != null)
++supported;
f.SetValue(null, d);
}
rebuildExtensionList = true;
time.Stop();
Debug.Print("{0} extensions loaded in {1} ms.", supported, time.ElapsedMilliseconds);
time.Reset();
}
#endregion
#region Load
/// <summary>
/// Loads all extension and core functions.
/// </summary>
internal bool Load(string function)
{
FieldInfo f = DelegatesClass.GetField(function, BindingFlags.Static | BindingFlags.NonPublic);
if (f == null)
return false;
Delegate old = f.GetValue(null) as Delegate;
Delegate @new = LoadDelegate(f.Name, f.FieldType);
if (old.Target != @new.Target)
{
f.SetValue(null, @new);
}
return @new != null;
}
#endregion
#endregion
#region Private Members
#region LoadDelegate
/// <summary>
/// Tries to load the specified core or extension function.
/// </summary>
/// <param name="function">The name of the function (i.e. glShaderSource)</param>
/// <returns>True if the function was found and reloaded, false otherwise.</returns>
/// <remarks>
/// <para>
/// Use this function if you require greater granularity when loading entry points.
/// </para>
/// </remarks>
Delegate LoadDelegate(string name, Type signature)
{
MethodInfo m;
return
GetExtensionDelegate(name, signature) ??
(CoreFunctionMap.TryGetValue((name.Substring(2)), out m) ?
Delegate.CreateDelegate(signature, m) : null);
}
#endregion
#region GetExtensionDelegate
// Creates a System.Delegate that can be used to call a dynamically exported OpenGL function.
internal static Delegate GetExtensionDelegate(string name, Type signature)
{
IntPtr address = (GraphicsContext.CurrentContext as IGraphicsContextInternal).GetAddress(name);
if (address == IntPtr.Zero ||
address == new IntPtr(1) || // Workaround for buggy nvidia drivers which return
address == new IntPtr(2)) // 1 or 2 instead of IntPtr.Zero for some extensions.
{
return null;
}
else
{
return Marshal.GetDelegateForFunctionPointer(address, signature);
}
}
#endregion
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace OpenTK.Graphics
{
/// <summary>
/// Provides a common foundation for all flat API classes.
/// </summary>
public abstract class BindingsBase
{
#region Fields
/// <summary>
/// A reflection handle to the nested type that contains the function delegates.
/// </summary>
readonly protected Type DelegatesClass;
/// <summary>
/// A refection handle to the nested type that contains core functions (i.e. not extensions).
/// </summary>
readonly protected Type CoreClass;
/// <summary>
/// A mapping of core function names to MethodInfo handles.
/// </summary>
readonly protected SortedList<string, MethodInfo> CoreFunctionMap = new SortedList<string, MethodInfo>();
bool rebuildExtensionList = true;
#endregion
#region Constructors
/// <summary>
/// Constructs a new BindingsBase instance.
/// </summary>
public BindingsBase()
{
DelegatesClass = this.GetType().GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic);
CoreClass = this.GetType().GetNestedType("Core", BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] methods = CoreClass.GetMethods(BindingFlags.Static | BindingFlags.NonPublic);
CoreFunctionMap = new SortedList<string, MethodInfo>(methods.Length);
foreach (MethodInfo m in methods)
{
CoreFunctionMap.Add(m.Name, m);
}
}
#endregion
#region Protected Members
/// <summary>
/// Gets or sets a <see cref="System.Boolean"/> that indicates whether the list of supported extensions may have changed.
/// </summary>
protected bool RebuildExtensionList
{
get { return rebuildExtensionList; }
set { rebuildExtensionList = value; }
}
#endregion
#region Internal Members
#region LoadAll
internal void LoadAll()
{
// Using reflection is more than 3 times faster than directly loading delegates on the first
// run, probably due to code generation overhead. Subsequent runs are faster with direct loading
// than with reflection, but the first time is more significant.
int supported = 0;
FieldInfo[] delegates = DelegatesClass.GetFields(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
if (delegates == null)
throw new InvalidOperationException("The specified type does not have any loadable extensions.");
Debug.Write("Load extensions for " + this.GetType().FullName + "... ");
System.Diagnostics.Stopwatch time = new System.Diagnostics.Stopwatch();
time.Reset();
time.Start();
foreach (FieldInfo f in delegates)
{
Delegate d = LoadDelegate(f.Name, f.FieldType);
if (d != null)
++supported;
f.SetValue(null, d);
}
rebuildExtensionList = true;
time.Stop();
Debug.Print("{0} extensions loaded in {1} ms.", supported, time.ElapsedMilliseconds);
time.Reset();
}
#endregion
#region Load
/// <summary>
/// Loads all extension and core functions.
/// </summary>
internal bool Load(string function)
{
FieldInfo f = DelegatesClass.GetField(function, BindingFlags.Static | BindingFlags.NonPublic);
if (f == null)
return false;
Delegate old = f.GetValue(null) as Delegate;
Delegate @new = LoadDelegate(f.Name, f.FieldType);
if (old.Target != @new.Target)
{
f.SetValue(null, @new);
}
return @new != null;
}
#endregion
#endregion
#region Private Members
#region LoadDelegate
/// <summary>
/// Tries to load the specified core or extension function.
/// </summary>
/// <param name="function">The name of the function (i.e. glShaderSource)</param>
/// <returns>True if the function was found and reloaded, false otherwise.</returns>
/// <remarks>
/// <para>
/// Use this function if you require greater granularity when loading entry points.
/// </para>
/// </remarks>
Delegate LoadDelegate(string name, Type signature)
{
MethodInfo m;
return
GetExtensionDelegate(name, signature) ??
(CoreFunctionMap.TryGetValue((name.Substring(2)), out m) ?
Delegate.CreateDelegate(signature, m) : null);
}
#endregion
#region GetExtensionDelegate
// Creates a System.Delegate that can be used to call a dynamically exported OpenGL function.
internal static Delegate GetExtensionDelegate(string name, Type signature)
{
IntPtr address = (GraphicsContext.CurrentContext as IGraphicsContextInternal).GetAddress(name);
if (address == IntPtr.Zero ||
address == new IntPtr(1) || // Workaround for buggy nvidia drivers which return
address == new IntPtr(2)) // 1 or 2 instead of IntPtr.Zero for some extensions.
{
return null;
}
else
{
return Marshal.GetDelegateForFunctionPointer(address, signature);
}
}
#endregion
#endregion
}
}

View file

@ -1,361 +1,361 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace OpenTK.Graphics.ES10
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 3019
#pragma warning disable 1591
partial class GL
{
internal static partial class Core
{
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glActiveTexture", ExactSpelling = true)]
internal extern static void ActiveTexture(OpenTK.Graphics.ES10.All texture);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glAlphaFunc", ExactSpelling = true)]
internal extern static void AlphaFunc(OpenTK.Graphics.ES10.All func, Single @ref);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glAlphaFuncx", ExactSpelling = true)]
internal extern static void AlphaFuncx(OpenTK.Graphics.ES10.All func, int @ref);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glBindTexture", ExactSpelling = true)]
internal extern static void BindTexture(OpenTK.Graphics.ES10.All target, UInt32 texture);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glBlendFunc", ExactSpelling = true)]
internal extern static void BlendFunc(OpenTK.Graphics.ES10.All sfactor, OpenTK.Graphics.ES10.All dfactor);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClear", ExactSpelling = true)]
internal extern static void Clear(UInt32 mask);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearColor", ExactSpelling = true)]
internal extern static void ClearColor(Single red, Single green, Single blue, Single alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearColorx", ExactSpelling = true)]
internal extern static void ClearColorx(int red, int green, int blue, int alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearDepthf", ExactSpelling = true)]
internal extern static void ClearDepthf(Single depth);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearDepthx", ExactSpelling = true)]
internal extern static void ClearDepthx(int depth);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearStencil", ExactSpelling = true)]
internal extern static void ClearStencil(Int32 s);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClientActiveTexture", ExactSpelling = true)]
internal extern static void ClientActiveTexture(OpenTK.Graphics.ES10.All texture);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glColor4f", ExactSpelling = true)]
internal extern static void Color4f(Single red, Single green, Single blue, Single alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glColor4x", ExactSpelling = true)]
internal extern static void Color4x(int red, int green, int blue, int alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glColorMask", ExactSpelling = true)]
internal extern static void ColorMask(bool red, bool green, bool blue, bool alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glColorPointer", ExactSpelling = true)]
internal extern static void ColorPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCompressedTexImage2D", ExactSpelling = true)]
internal extern static void CompressedTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 width, Int32 height, Int32 border, Int32 imageSize, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCompressedTexSubImage2D", ExactSpelling = true)]
internal extern static void CompressedTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, Int32 imageSize, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCopyTexImage2D", ExactSpelling = true)]
internal extern static void CopyTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 x, Int32 y, Int32 width, Int32 height, Int32 border);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCopyTexSubImage2D", ExactSpelling = true)]
internal extern static void CopyTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 x, Int32 y, Int32 width, Int32 height);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCullFace", ExactSpelling = true)]
internal extern static void CullFace(OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDeleteTextures", ExactSpelling = true)]
internal extern static unsafe void DeleteTextures(Int32 n, UInt32* textures);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDepthFunc", ExactSpelling = true)]
internal extern static void DepthFunc(OpenTK.Graphics.ES10.All func);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDepthMask", ExactSpelling = true)]
internal extern static void DepthMask(bool flag);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDepthRangef", ExactSpelling = true)]
internal extern static void DepthRangef(Single zNear, Single zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDepthRangex", ExactSpelling = true)]
internal extern static void DepthRangex(int zNear, int zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDisable", ExactSpelling = true)]
internal extern static void Disable(OpenTK.Graphics.ES10.All cap);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDisableClientState", ExactSpelling = true)]
internal extern static void DisableClientState(OpenTK.Graphics.ES10.All array);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDrawArrays", ExactSpelling = true)]
internal extern static void DrawArrays(OpenTK.Graphics.ES10.All mode, Int32 first, Int32 count);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDrawElements", ExactSpelling = true)]
internal extern static void DrawElements(OpenTK.Graphics.ES10.All mode, Int32 count, OpenTK.Graphics.ES10.All type, IntPtr indices);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glEnable", ExactSpelling = true)]
internal extern static void Enable(OpenTK.Graphics.ES10.All cap);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glEnableClientState", ExactSpelling = true)]
internal extern static void EnableClientState(OpenTK.Graphics.ES10.All array);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFinish", ExactSpelling = true)]
internal extern static void Finish();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFlush", ExactSpelling = true)]
internal extern static void Flush();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFogf", ExactSpelling = true)]
internal extern static void Fogf(OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFogfv", ExactSpelling = true)]
internal extern static unsafe void Fogfv(OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFogx", ExactSpelling = true)]
internal extern static void Fogx(OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFogxv", ExactSpelling = true)]
internal extern static unsafe void Fogxv(OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFrontFace", ExactSpelling = true)]
internal extern static void FrontFace(OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFrustumf", ExactSpelling = true)]
internal extern static void Frustumf(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFrustumx", ExactSpelling = true)]
internal extern static void Frustumx(int left, int right, int bottom, int top, int zNear, int zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGenTextures", ExactSpelling = true)]
internal extern static unsafe void GenTextures(Int32 n, UInt32* textures);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetError", ExactSpelling = true)]
internal extern static OpenTK.Graphics.ES10.All GetError();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetIntegerv", ExactSpelling = true)]
internal extern static unsafe void GetIntegerv(OpenTK.Graphics.ES10.All pname, Int32* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetString", ExactSpelling = true)]
internal extern static unsafe IntPtr GetString(OpenTK.Graphics.ES10.All name);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glHint", ExactSpelling = true)]
internal extern static void Hint(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightf", ExactSpelling = true)]
internal extern static void Lightf(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightfv", ExactSpelling = true)]
internal extern static unsafe void Lightfv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightModelf", ExactSpelling = true)]
internal extern static void LightModelf(OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightModelfv", ExactSpelling = true)]
internal extern static unsafe void LightModelfv(OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightModelx", ExactSpelling = true)]
internal extern static void LightModelx(OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightModelxv", ExactSpelling = true)]
internal extern static unsafe void LightModelxv(OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightx", ExactSpelling = true)]
internal extern static void Lightx(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightxv", ExactSpelling = true)]
internal extern static unsafe void Lightxv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLineWidth", ExactSpelling = true)]
internal extern static void LineWidth(Single width);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLineWidthx", ExactSpelling = true)]
internal extern static void LineWidthx(int width);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLoadIdentity", ExactSpelling = true)]
internal extern static void LoadIdentity();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLoadMatrixf", ExactSpelling = true)]
internal extern static unsafe void LoadMatrixf(Single* m);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLoadMatrixx", ExactSpelling = true)]
internal extern static unsafe void LoadMatrixx(int* m);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLogicOp", ExactSpelling = true)]
internal extern static void LogicOp(OpenTK.Graphics.ES10.All opcode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMaterialf", ExactSpelling = true)]
internal extern static void Materialf(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMaterialfv", ExactSpelling = true)]
internal extern static unsafe void Materialfv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMaterialx", ExactSpelling = true)]
internal extern static void Materialx(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMaterialxv", ExactSpelling = true)]
internal extern static unsafe void Materialxv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMatrixMode", ExactSpelling = true)]
internal extern static void MatrixMode(OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMultiTexCoord4f", ExactSpelling = true)]
internal extern static void MultiTexCoord4f(OpenTK.Graphics.ES10.All target, Single s, Single t, Single r, Single q);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMultiTexCoord4x", ExactSpelling = true)]
internal extern static void MultiTexCoord4x(OpenTK.Graphics.ES10.All target, int s, int t, int r, int q);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMultMatrixf", ExactSpelling = true)]
internal extern static unsafe void MultMatrixf(Single* m);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMultMatrixx", ExactSpelling = true)]
internal extern static unsafe void MultMatrixx(int* m);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glNormal3f", ExactSpelling = true)]
internal extern static void Normal3f(Single nx, Single ny, Single nz);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glNormal3x", ExactSpelling = true)]
internal extern static void Normal3x(int nx, int ny, int nz);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glNormalPointer", ExactSpelling = true)]
internal extern static void NormalPointer(OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glOrthof", ExactSpelling = true)]
internal extern static void Orthof(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glOrthox", ExactSpelling = true)]
internal extern static void Orthox(int left, int right, int bottom, int top, int zNear, int zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPixelStorei", ExactSpelling = true)]
internal extern static void PixelStorei(OpenTK.Graphics.ES10.All pname, Int32 param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPointSize", ExactSpelling = true)]
internal extern static void PointSize(Single size);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPointSizex", ExactSpelling = true)]
internal extern static void PointSizex(int size);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPolygonOffset", ExactSpelling = true)]
internal extern static void PolygonOffset(Single factor, Single units);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPolygonOffsetx", ExactSpelling = true)]
internal extern static void PolygonOffsetx(int factor, int units);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPopMatrix", ExactSpelling = true)]
internal extern static void PopMatrix();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPushMatrix", ExactSpelling = true)]
internal extern static void PushMatrix();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glReadPixels", ExactSpelling = true)]
internal extern static void ReadPixels(Int32 x, Int32 y, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glRotatef", ExactSpelling = true)]
internal extern static void Rotatef(Single angle, Single x, Single y, Single z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glRotatex", ExactSpelling = true)]
internal extern static void Rotatex(int angle, int x, int y, int z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glSampleCoverage", ExactSpelling = true)]
internal extern static void SampleCoverage(Single value, bool invert);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glSampleCoveragex", ExactSpelling = true)]
internal extern static void SampleCoveragex(int value, bool invert);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glScalef", ExactSpelling = true)]
internal extern static void Scalef(Single x, Single y, Single z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glScalex", ExactSpelling = true)]
internal extern static void Scalex(int x, int y, int z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glScissor", ExactSpelling = true)]
internal extern static void Scissor(Int32 x, Int32 y, Int32 width, Int32 height);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glShadeModel", ExactSpelling = true)]
internal extern static void ShadeModel(OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glStencilFunc", ExactSpelling = true)]
internal extern static void StencilFunc(OpenTK.Graphics.ES10.All func, Int32 @ref, UInt32 mask);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glStencilMask", ExactSpelling = true)]
internal extern static void StencilMask(UInt32 mask);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glStencilOp", ExactSpelling = true)]
internal extern static void StencilOp(OpenTK.Graphics.ES10.All fail, OpenTK.Graphics.ES10.All zfail, OpenTK.Graphics.ES10.All zpass);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexCoordPointer", ExactSpelling = true)]
internal extern static void TexCoordPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexEnvf", ExactSpelling = true)]
internal extern static void TexEnvf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexEnvfv", ExactSpelling = true)]
internal extern static unsafe void TexEnvfv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexEnvx", ExactSpelling = true)]
internal extern static void TexEnvx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexEnvxv", ExactSpelling = true)]
internal extern static unsafe void TexEnvxv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexImage2D", ExactSpelling = true)]
internal extern static void TexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 internalformat, Int32 width, Int32 height, Int32 border, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexParameterf", ExactSpelling = true)]
internal extern static void TexParameterf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexParameterx", ExactSpelling = true)]
internal extern static void TexParameterx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexSubImage2D", ExactSpelling = true)]
internal extern static void TexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTranslatef", ExactSpelling = true)]
internal extern static void Translatef(Single x, Single y, Single z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTranslatex", ExactSpelling = true)]
internal extern static void Translatex(int x, int y, int z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glVertexPointer", ExactSpelling = true)]
internal extern static void VertexPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glViewport", ExactSpelling = true)]
internal extern static void Viewport(Int32 x, Int32 y, Int32 width, Int32 height);
}
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace OpenTK.Graphics.ES10
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 3019
#pragma warning disable 1591
partial class GL
{
internal static partial class Core
{
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glActiveTexture", ExactSpelling = true)]
internal extern static void ActiveTexture(OpenTK.Graphics.ES10.All texture);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glAlphaFunc", ExactSpelling = true)]
internal extern static void AlphaFunc(OpenTK.Graphics.ES10.All func, Single @ref);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glAlphaFuncx", ExactSpelling = true)]
internal extern static void AlphaFuncx(OpenTK.Graphics.ES10.All func, int @ref);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glBindTexture", ExactSpelling = true)]
internal extern static void BindTexture(OpenTK.Graphics.ES10.All target, UInt32 texture);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glBlendFunc", ExactSpelling = true)]
internal extern static void BlendFunc(OpenTK.Graphics.ES10.All sfactor, OpenTK.Graphics.ES10.All dfactor);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClear", ExactSpelling = true)]
internal extern static void Clear(UInt32 mask);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearColor", ExactSpelling = true)]
internal extern static void ClearColor(Single red, Single green, Single blue, Single alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearColorx", ExactSpelling = true)]
internal extern static void ClearColorx(int red, int green, int blue, int alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearDepthf", ExactSpelling = true)]
internal extern static void ClearDepthf(Single depth);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearDepthx", ExactSpelling = true)]
internal extern static void ClearDepthx(int depth);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClearStencil", ExactSpelling = true)]
internal extern static void ClearStencil(Int32 s);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glClientActiveTexture", ExactSpelling = true)]
internal extern static void ClientActiveTexture(OpenTK.Graphics.ES10.All texture);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glColor4f", ExactSpelling = true)]
internal extern static void Color4f(Single red, Single green, Single blue, Single alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glColor4x", ExactSpelling = true)]
internal extern static void Color4x(int red, int green, int blue, int alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glColorMask", ExactSpelling = true)]
internal extern static void ColorMask(bool red, bool green, bool blue, bool alpha);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glColorPointer", ExactSpelling = true)]
internal extern static void ColorPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCompressedTexImage2D", ExactSpelling = true)]
internal extern static void CompressedTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 width, Int32 height, Int32 border, Int32 imageSize, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCompressedTexSubImage2D", ExactSpelling = true)]
internal extern static void CompressedTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, Int32 imageSize, IntPtr data);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCopyTexImage2D", ExactSpelling = true)]
internal extern static void CopyTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 x, Int32 y, Int32 width, Int32 height, Int32 border);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCopyTexSubImage2D", ExactSpelling = true)]
internal extern static void CopyTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 x, Int32 y, Int32 width, Int32 height);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glCullFace", ExactSpelling = true)]
internal extern static void CullFace(OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDeleteTextures", ExactSpelling = true)]
internal extern static unsafe void DeleteTextures(Int32 n, UInt32* textures);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDepthFunc", ExactSpelling = true)]
internal extern static void DepthFunc(OpenTK.Graphics.ES10.All func);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDepthMask", ExactSpelling = true)]
internal extern static void DepthMask(bool flag);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDepthRangef", ExactSpelling = true)]
internal extern static void DepthRangef(Single zNear, Single zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDepthRangex", ExactSpelling = true)]
internal extern static void DepthRangex(int zNear, int zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDisable", ExactSpelling = true)]
internal extern static void Disable(OpenTK.Graphics.ES10.All cap);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDisableClientState", ExactSpelling = true)]
internal extern static void DisableClientState(OpenTK.Graphics.ES10.All array);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDrawArrays", ExactSpelling = true)]
internal extern static void DrawArrays(OpenTK.Graphics.ES10.All mode, Int32 first, Int32 count);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glDrawElements", ExactSpelling = true)]
internal extern static void DrawElements(OpenTK.Graphics.ES10.All mode, Int32 count, OpenTK.Graphics.ES10.All type, IntPtr indices);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glEnable", ExactSpelling = true)]
internal extern static void Enable(OpenTK.Graphics.ES10.All cap);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glEnableClientState", ExactSpelling = true)]
internal extern static void EnableClientState(OpenTK.Graphics.ES10.All array);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFinish", ExactSpelling = true)]
internal extern static void Finish();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFlush", ExactSpelling = true)]
internal extern static void Flush();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFogf", ExactSpelling = true)]
internal extern static void Fogf(OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFogfv", ExactSpelling = true)]
internal extern static unsafe void Fogfv(OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFogx", ExactSpelling = true)]
internal extern static void Fogx(OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFogxv", ExactSpelling = true)]
internal extern static unsafe void Fogxv(OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFrontFace", ExactSpelling = true)]
internal extern static void FrontFace(OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFrustumf", ExactSpelling = true)]
internal extern static void Frustumf(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glFrustumx", ExactSpelling = true)]
internal extern static void Frustumx(int left, int right, int bottom, int top, int zNear, int zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGenTextures", ExactSpelling = true)]
internal extern static unsafe void GenTextures(Int32 n, UInt32* textures);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetError", ExactSpelling = true)]
internal extern static OpenTK.Graphics.ES10.All GetError();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetIntegerv", ExactSpelling = true)]
internal extern static unsafe void GetIntegerv(OpenTK.Graphics.ES10.All pname, Int32* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glGetString", ExactSpelling = true)]
internal extern static unsafe IntPtr GetString(OpenTK.Graphics.ES10.All name);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glHint", ExactSpelling = true)]
internal extern static void Hint(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightf", ExactSpelling = true)]
internal extern static void Lightf(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightfv", ExactSpelling = true)]
internal extern static unsafe void Lightfv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightModelf", ExactSpelling = true)]
internal extern static void LightModelf(OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightModelfv", ExactSpelling = true)]
internal extern static unsafe void LightModelfv(OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightModelx", ExactSpelling = true)]
internal extern static void LightModelx(OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightModelxv", ExactSpelling = true)]
internal extern static unsafe void LightModelxv(OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightx", ExactSpelling = true)]
internal extern static void Lightx(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLightxv", ExactSpelling = true)]
internal extern static unsafe void Lightxv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLineWidth", ExactSpelling = true)]
internal extern static void LineWidth(Single width);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLineWidthx", ExactSpelling = true)]
internal extern static void LineWidthx(int width);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLoadIdentity", ExactSpelling = true)]
internal extern static void LoadIdentity();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLoadMatrixf", ExactSpelling = true)]
internal extern static unsafe void LoadMatrixf(Single* m);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLoadMatrixx", ExactSpelling = true)]
internal extern static unsafe void LoadMatrixx(int* m);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glLogicOp", ExactSpelling = true)]
internal extern static void LogicOp(OpenTK.Graphics.ES10.All opcode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMaterialf", ExactSpelling = true)]
internal extern static void Materialf(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMaterialfv", ExactSpelling = true)]
internal extern static unsafe void Materialfv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMaterialx", ExactSpelling = true)]
internal extern static void Materialx(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMaterialxv", ExactSpelling = true)]
internal extern static unsafe void Materialxv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMatrixMode", ExactSpelling = true)]
internal extern static void MatrixMode(OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMultiTexCoord4f", ExactSpelling = true)]
internal extern static void MultiTexCoord4f(OpenTK.Graphics.ES10.All target, Single s, Single t, Single r, Single q);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMultiTexCoord4x", ExactSpelling = true)]
internal extern static void MultiTexCoord4x(OpenTK.Graphics.ES10.All target, int s, int t, int r, int q);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMultMatrixf", ExactSpelling = true)]
internal extern static unsafe void MultMatrixf(Single* m);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glMultMatrixx", ExactSpelling = true)]
internal extern static unsafe void MultMatrixx(int* m);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glNormal3f", ExactSpelling = true)]
internal extern static void Normal3f(Single nx, Single ny, Single nz);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glNormal3x", ExactSpelling = true)]
internal extern static void Normal3x(int nx, int ny, int nz);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glNormalPointer", ExactSpelling = true)]
internal extern static void NormalPointer(OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glOrthof", ExactSpelling = true)]
internal extern static void Orthof(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glOrthox", ExactSpelling = true)]
internal extern static void Orthox(int left, int right, int bottom, int top, int zNear, int zFar);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPixelStorei", ExactSpelling = true)]
internal extern static void PixelStorei(OpenTK.Graphics.ES10.All pname, Int32 param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPointSize", ExactSpelling = true)]
internal extern static void PointSize(Single size);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPointSizex", ExactSpelling = true)]
internal extern static void PointSizex(int size);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPolygonOffset", ExactSpelling = true)]
internal extern static void PolygonOffset(Single factor, Single units);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPolygonOffsetx", ExactSpelling = true)]
internal extern static void PolygonOffsetx(int factor, int units);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPopMatrix", ExactSpelling = true)]
internal extern static void PopMatrix();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glPushMatrix", ExactSpelling = true)]
internal extern static void PushMatrix();
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glReadPixels", ExactSpelling = true)]
internal extern static void ReadPixels(Int32 x, Int32 y, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glRotatef", ExactSpelling = true)]
internal extern static void Rotatef(Single angle, Single x, Single y, Single z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glRotatex", ExactSpelling = true)]
internal extern static void Rotatex(int angle, int x, int y, int z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glSampleCoverage", ExactSpelling = true)]
internal extern static void SampleCoverage(Single value, bool invert);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glSampleCoveragex", ExactSpelling = true)]
internal extern static void SampleCoveragex(int value, bool invert);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glScalef", ExactSpelling = true)]
internal extern static void Scalef(Single x, Single y, Single z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glScalex", ExactSpelling = true)]
internal extern static void Scalex(int x, int y, int z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glScissor", ExactSpelling = true)]
internal extern static void Scissor(Int32 x, Int32 y, Int32 width, Int32 height);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glShadeModel", ExactSpelling = true)]
internal extern static void ShadeModel(OpenTK.Graphics.ES10.All mode);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glStencilFunc", ExactSpelling = true)]
internal extern static void StencilFunc(OpenTK.Graphics.ES10.All func, Int32 @ref, UInt32 mask);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glStencilMask", ExactSpelling = true)]
internal extern static void StencilMask(UInt32 mask);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glStencilOp", ExactSpelling = true)]
internal extern static void StencilOp(OpenTK.Graphics.ES10.All fail, OpenTK.Graphics.ES10.All zfail, OpenTK.Graphics.ES10.All zpass);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexCoordPointer", ExactSpelling = true)]
internal extern static void TexCoordPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexEnvf", ExactSpelling = true)]
internal extern static void TexEnvf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexEnvfv", ExactSpelling = true)]
internal extern static unsafe void TexEnvfv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexEnvx", ExactSpelling = true)]
internal extern static void TexEnvx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexEnvxv", ExactSpelling = true)]
internal extern static unsafe void TexEnvxv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int* @params);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexImage2D", ExactSpelling = true)]
internal extern static void TexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 internalformat, Int32 width, Int32 height, Int32 border, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexParameterf", ExactSpelling = true)]
internal extern static void TexParameterf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexParameterx", ExactSpelling = true)]
internal extern static void TexParameterx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTexSubImage2D", ExactSpelling = true)]
internal extern static void TexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTranslatef", ExactSpelling = true)]
internal extern static void Translatef(Single x, Single y, Single z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glTranslatex", ExactSpelling = true)]
internal extern static void Translatex(int x, int y, int z);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glVertexPointer", ExactSpelling = true)]
internal extern static void VertexPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
[System.Security.SuppressUnmanagedCodeSecurity()]
[System.Runtime.InteropServices.DllImport(GL.Library, EntryPoint = "glViewport", ExactSpelling = true)]
internal extern static void Viewport(Int32 x, Int32 y, Int32 width, Int32 height);
}
}
}

View file

@ -1,360 +1,360 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace OpenTK.Graphics.ES10
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 0649
#pragma warning disable 3019
#pragma warning disable 1591
partial class GL
{
internal static partial class Delegates
{
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ActiveTexture(OpenTK.Graphics.ES10.All texture);
internal static ActiveTexture glActiveTexture;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void AlphaFunc(OpenTK.Graphics.ES10.All func, Single @ref);
internal static AlphaFunc glAlphaFunc;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void AlphaFuncx(OpenTK.Graphics.ES10.All func, int @ref);
internal static AlphaFuncx glAlphaFuncx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BindTexture(OpenTK.Graphics.ES10.All target, UInt32 texture);
internal static BindTexture glBindTexture;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BlendFunc(OpenTK.Graphics.ES10.All sfactor, OpenTK.Graphics.ES10.All dfactor);
internal static BlendFunc glBlendFunc;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Clear(UInt32 mask);
internal static Clear glClear;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearColor(Single red, Single green, Single blue, Single alpha);
internal static ClearColor glClearColor;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearColorx(int red, int green, int blue, int alpha);
internal static ClearColorx glClearColorx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearDepthf(Single depth);
internal static ClearDepthf glClearDepthf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearDepthx(int depth);
internal static ClearDepthx glClearDepthx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearStencil(Int32 s);
internal static ClearStencil glClearStencil;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClientActiveTexture(OpenTK.Graphics.ES10.All texture);
internal static ClientActiveTexture glClientActiveTexture;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Color4f(Single red, Single green, Single blue, Single alpha);
internal static Color4f glColor4f;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Color4x(int red, int green, int blue, int alpha);
internal static Color4x glColor4x;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ColorMask(bool red, bool green, bool blue, bool alpha);
internal static ColorMask glColorMask;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ColorPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
internal static ColorPointer glColorPointer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CompressedTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 width, Int32 height, Int32 border, Int32 imageSize, IntPtr data);
internal static CompressedTexImage2D glCompressedTexImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CompressedTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, Int32 imageSize, IntPtr data);
internal static CompressedTexSubImage2D glCompressedTexSubImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CopyTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 x, Int32 y, Int32 width, Int32 height, Int32 border);
internal static CopyTexImage2D glCopyTexImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CopyTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 x, Int32 y, Int32 width, Int32 height);
internal static CopyTexSubImage2D glCopyTexSubImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CullFace(OpenTK.Graphics.ES10.All mode);
internal static CullFace glCullFace;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void DeleteTextures(Int32 n, UInt32* textures);
internal unsafe static DeleteTextures glDeleteTextures;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DepthFunc(OpenTK.Graphics.ES10.All func);
internal static DepthFunc glDepthFunc;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DepthMask(bool flag);
internal static DepthMask glDepthMask;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DepthRangef(Single zNear, Single zFar);
internal static DepthRangef glDepthRangef;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DepthRangex(int zNear, int zFar);
internal static DepthRangex glDepthRangex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Disable(OpenTK.Graphics.ES10.All cap);
internal static Disable glDisable;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DisableClientState(OpenTK.Graphics.ES10.All array);
internal static DisableClientState glDisableClientState;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DrawArrays(OpenTK.Graphics.ES10.All mode, Int32 first, Int32 count);
internal static DrawArrays glDrawArrays;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DrawElements(OpenTK.Graphics.ES10.All mode, Int32 count, OpenTK.Graphics.ES10.All type, IntPtr indices);
internal static DrawElements glDrawElements;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Enable(OpenTK.Graphics.ES10.All cap);
internal static Enable glEnable;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EnableClientState(OpenTK.Graphics.ES10.All array);
internal static EnableClientState glEnableClientState;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Finish();
internal static Finish glFinish;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Flush();
internal static Flush glFlush;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Fogf(OpenTK.Graphics.ES10.All pname, Single param);
internal static Fogf glFogf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Fogfv(OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static Fogfv glFogfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Fogx(OpenTK.Graphics.ES10.All pname, int param);
internal static Fogx glFogx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Fogxv(OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static Fogxv glFogxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void FrontFace(OpenTK.Graphics.ES10.All mode);
internal static FrontFace glFrontFace;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Frustumf(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
internal static Frustumf glFrustumf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Frustumx(int left, int right, int bottom, int top, int zNear, int zFar);
internal static Frustumx glFrustumx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GenTextures(Int32 n, UInt32* textures);
internal unsafe static GenTextures glGenTextures;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate OpenTK.Graphics.ES10.All GetError();
internal static GetError glGetError;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetIntegerv(OpenTK.Graphics.ES10.All pname, Int32* @params);
internal unsafe static GetIntegerv glGetIntegerv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr GetString(OpenTK.Graphics.ES10.All name);
internal unsafe static GetString glGetString;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Hint(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All mode);
internal static Hint glHint;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Lightf(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single param);
internal static Lightf glLightf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Lightfv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static Lightfv glLightfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LightModelf(OpenTK.Graphics.ES10.All pname, Single param);
internal static LightModelf glLightModelf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LightModelfv(OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static LightModelfv glLightModelfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LightModelx(OpenTK.Graphics.ES10.All pname, int param);
internal static LightModelx glLightModelx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LightModelxv(OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static LightModelxv glLightModelxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Lightx(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int param);
internal static Lightx glLightx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Lightxv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static Lightxv glLightxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LineWidth(Single width);
internal static LineWidth glLineWidth;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LineWidthx(int width);
internal static LineWidthx glLineWidthx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LoadIdentity();
internal static LoadIdentity glLoadIdentity;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LoadMatrixf(Single* m);
internal unsafe static LoadMatrixf glLoadMatrixf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LoadMatrixx(int* m);
internal unsafe static LoadMatrixx glLoadMatrixx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LogicOp(OpenTK.Graphics.ES10.All opcode);
internal static LogicOp glLogicOp;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Materialf(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single param);
internal static Materialf glMaterialf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Materialfv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static Materialfv glMaterialfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Materialx(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int param);
internal static Materialx glMaterialx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Materialxv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static Materialxv glMaterialxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void MatrixMode(OpenTK.Graphics.ES10.All mode);
internal static MatrixMode glMatrixMode;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void MultiTexCoord4f(OpenTK.Graphics.ES10.All target, Single s, Single t, Single r, Single q);
internal static MultiTexCoord4f glMultiTexCoord4f;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void MultiTexCoord4x(OpenTK.Graphics.ES10.All target, int s, int t, int r, int q);
internal static MultiTexCoord4x glMultiTexCoord4x;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void MultMatrixf(Single* m);
internal unsafe static MultMatrixf glMultMatrixf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void MultMatrixx(int* m);
internal unsafe static MultMatrixx glMultMatrixx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Normal3f(Single nx, Single ny, Single nz);
internal static Normal3f glNormal3f;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Normal3x(int nx, int ny, int nz);
internal static Normal3x glNormal3x;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NormalPointer(OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
internal static NormalPointer glNormalPointer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Orthof(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
internal static Orthof glOrthof;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Orthox(int left, int right, int bottom, int top, int zNear, int zFar);
internal static Orthox glOrthox;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PixelStorei(OpenTK.Graphics.ES10.All pname, Int32 param);
internal static PixelStorei glPixelStorei;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PointSize(Single size);
internal static PointSize glPointSize;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PointSizex(int size);
internal static PointSizex glPointSizex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PolygonOffset(Single factor, Single units);
internal static PolygonOffset glPolygonOffset;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PolygonOffsetx(int factor, int units);
internal static PolygonOffsetx glPolygonOffsetx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PopMatrix();
internal static PopMatrix glPopMatrix;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PushMatrix();
internal static PushMatrix glPushMatrix;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ReadPixels(Int32 x, Int32 y, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
internal static ReadPixels glReadPixels;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Rotatef(Single angle, Single x, Single y, Single z);
internal static Rotatef glRotatef;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Rotatex(int angle, int x, int y, int z);
internal static Rotatex glRotatex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void SampleCoverage(Single value, bool invert);
internal static SampleCoverage glSampleCoverage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void SampleCoveragex(int value, bool invert);
internal static SampleCoveragex glSampleCoveragex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Scalef(Single x, Single y, Single z);
internal static Scalef glScalef;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Scalex(int x, int y, int z);
internal static Scalex glScalex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Scissor(Int32 x, Int32 y, Int32 width, Int32 height);
internal static Scissor glScissor;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ShadeModel(OpenTK.Graphics.ES10.All mode);
internal static ShadeModel glShadeModel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void StencilFunc(OpenTK.Graphics.ES10.All func, Int32 @ref, UInt32 mask);
internal static StencilFunc glStencilFunc;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void StencilMask(UInt32 mask);
internal static StencilMask glStencilMask;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void StencilOp(OpenTK.Graphics.ES10.All fail, OpenTK.Graphics.ES10.All zfail, OpenTK.Graphics.ES10.All zpass);
internal static StencilOp glStencilOp;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexCoordPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
internal static TexCoordPointer glTexCoordPointer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexEnvf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
internal static TexEnvf glTexEnvf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void TexEnvfv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static TexEnvfv glTexEnvfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexEnvx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
internal static TexEnvx glTexEnvx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void TexEnvxv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static TexEnvxv glTexEnvxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 internalformat, Int32 width, Int32 height, Int32 border, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
internal static TexImage2D glTexImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexParameterf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
internal static TexParameterf glTexParameterf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexParameterx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
internal static TexParameterx glTexParameterx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
internal static TexSubImage2D glTexSubImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Translatef(Single x, Single y, Single z);
internal static Translatef glTranslatef;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Translatex(int x, int y, int z);
internal static Translatex glTranslatex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void VertexPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
internal static VertexPointer glVertexPointer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Viewport(Int32 x, Int32 y, Int32 width, Int32 height);
internal static Viewport glViewport;
}
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
namespace OpenTK.Graphics.ES10
{
using System;
using System.Runtime.InteropServices;
#pragma warning disable 0649
#pragma warning disable 3019
#pragma warning disable 1591
partial class GL
{
internal static partial class Delegates
{
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ActiveTexture(OpenTK.Graphics.ES10.All texture);
internal static ActiveTexture glActiveTexture;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void AlphaFunc(OpenTK.Graphics.ES10.All func, Single @ref);
internal static AlphaFunc glAlphaFunc;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void AlphaFuncx(OpenTK.Graphics.ES10.All func, int @ref);
internal static AlphaFuncx glAlphaFuncx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BindTexture(OpenTK.Graphics.ES10.All target, UInt32 texture);
internal static BindTexture glBindTexture;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void BlendFunc(OpenTK.Graphics.ES10.All sfactor, OpenTK.Graphics.ES10.All dfactor);
internal static BlendFunc glBlendFunc;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Clear(UInt32 mask);
internal static Clear glClear;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearColor(Single red, Single green, Single blue, Single alpha);
internal static ClearColor glClearColor;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearColorx(int red, int green, int blue, int alpha);
internal static ClearColorx glClearColorx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearDepthf(Single depth);
internal static ClearDepthf glClearDepthf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearDepthx(int depth);
internal static ClearDepthx glClearDepthx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClearStencil(Int32 s);
internal static ClearStencil glClearStencil;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ClientActiveTexture(OpenTK.Graphics.ES10.All texture);
internal static ClientActiveTexture glClientActiveTexture;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Color4f(Single red, Single green, Single blue, Single alpha);
internal static Color4f glColor4f;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Color4x(int red, int green, int blue, int alpha);
internal static Color4x glColor4x;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ColorMask(bool red, bool green, bool blue, bool alpha);
internal static ColorMask glColorMask;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ColorPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
internal static ColorPointer glColorPointer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CompressedTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 width, Int32 height, Int32 border, Int32 imageSize, IntPtr data);
internal static CompressedTexImage2D glCompressedTexImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CompressedTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, Int32 imageSize, IntPtr data);
internal static CompressedTexSubImage2D glCompressedTexSubImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CopyTexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, OpenTK.Graphics.ES10.All internalformat, Int32 x, Int32 y, Int32 width, Int32 height, Int32 border);
internal static CopyTexImage2D glCopyTexImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CopyTexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 x, Int32 y, Int32 width, Int32 height);
internal static CopyTexSubImage2D glCopyTexSubImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void CullFace(OpenTK.Graphics.ES10.All mode);
internal static CullFace glCullFace;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void DeleteTextures(Int32 n, UInt32* textures);
internal unsafe static DeleteTextures glDeleteTextures;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DepthFunc(OpenTK.Graphics.ES10.All func);
internal static DepthFunc glDepthFunc;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DepthMask(bool flag);
internal static DepthMask glDepthMask;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DepthRangef(Single zNear, Single zFar);
internal static DepthRangef glDepthRangef;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DepthRangex(int zNear, int zFar);
internal static DepthRangex glDepthRangex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Disable(OpenTK.Graphics.ES10.All cap);
internal static Disable glDisable;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DisableClientState(OpenTK.Graphics.ES10.All array);
internal static DisableClientState glDisableClientState;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DrawArrays(OpenTK.Graphics.ES10.All mode, Int32 first, Int32 count);
internal static DrawArrays glDrawArrays;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void DrawElements(OpenTK.Graphics.ES10.All mode, Int32 count, OpenTK.Graphics.ES10.All type, IntPtr indices);
internal static DrawElements glDrawElements;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Enable(OpenTK.Graphics.ES10.All cap);
internal static Enable glEnable;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void EnableClientState(OpenTK.Graphics.ES10.All array);
internal static EnableClientState glEnableClientState;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Finish();
internal static Finish glFinish;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Flush();
internal static Flush glFlush;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Fogf(OpenTK.Graphics.ES10.All pname, Single param);
internal static Fogf glFogf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Fogfv(OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static Fogfv glFogfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Fogx(OpenTK.Graphics.ES10.All pname, int param);
internal static Fogx glFogx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Fogxv(OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static Fogxv glFogxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void FrontFace(OpenTK.Graphics.ES10.All mode);
internal static FrontFace glFrontFace;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Frustumf(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
internal static Frustumf glFrustumf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Frustumx(int left, int right, int bottom, int top, int zNear, int zFar);
internal static Frustumx glFrustumx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GenTextures(Int32 n, UInt32* textures);
internal unsafe static GenTextures glGenTextures;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate OpenTK.Graphics.ES10.All GetError();
internal static GetError glGetError;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void GetIntegerv(OpenTK.Graphics.ES10.All pname, Int32* @params);
internal unsafe static GetIntegerv glGetIntegerv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate IntPtr GetString(OpenTK.Graphics.ES10.All name);
internal unsafe static GetString glGetString;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Hint(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All mode);
internal static Hint glHint;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Lightf(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single param);
internal static Lightf glLightf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Lightfv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static Lightfv glLightfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LightModelf(OpenTK.Graphics.ES10.All pname, Single param);
internal static LightModelf glLightModelf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LightModelfv(OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static LightModelfv glLightModelfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LightModelx(OpenTK.Graphics.ES10.All pname, int param);
internal static LightModelx glLightModelx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LightModelxv(OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static LightModelxv glLightModelxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Lightx(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int param);
internal static Lightx glLightx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Lightxv(OpenTK.Graphics.ES10.All light, OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static Lightxv glLightxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LineWidth(Single width);
internal static LineWidth glLineWidth;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LineWidthx(int width);
internal static LineWidthx glLineWidthx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LoadIdentity();
internal static LoadIdentity glLoadIdentity;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LoadMatrixf(Single* m);
internal unsafe static LoadMatrixf glLoadMatrixf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void LoadMatrixx(int* m);
internal unsafe static LoadMatrixx glLoadMatrixx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void LogicOp(OpenTK.Graphics.ES10.All opcode);
internal static LogicOp glLogicOp;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Materialf(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single param);
internal static Materialf glMaterialf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Materialfv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static Materialfv glMaterialfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Materialx(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int param);
internal static Materialx glMaterialx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void Materialxv(OpenTK.Graphics.ES10.All face, OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static Materialxv glMaterialxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void MatrixMode(OpenTK.Graphics.ES10.All mode);
internal static MatrixMode glMatrixMode;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void MultiTexCoord4f(OpenTK.Graphics.ES10.All target, Single s, Single t, Single r, Single q);
internal static MultiTexCoord4f glMultiTexCoord4f;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void MultiTexCoord4x(OpenTK.Graphics.ES10.All target, int s, int t, int r, int q);
internal static MultiTexCoord4x glMultiTexCoord4x;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void MultMatrixf(Single* m);
internal unsafe static MultMatrixf glMultMatrixf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void MultMatrixx(int* m);
internal unsafe static MultMatrixx glMultMatrixx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Normal3f(Single nx, Single ny, Single nz);
internal static Normal3f glNormal3f;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Normal3x(int nx, int ny, int nz);
internal static Normal3x glNormal3x;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void NormalPointer(OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
internal static NormalPointer glNormalPointer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Orthof(Single left, Single right, Single bottom, Single top, Single zNear, Single zFar);
internal static Orthof glOrthof;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Orthox(int left, int right, int bottom, int top, int zNear, int zFar);
internal static Orthox glOrthox;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PixelStorei(OpenTK.Graphics.ES10.All pname, Int32 param);
internal static PixelStorei glPixelStorei;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PointSize(Single size);
internal static PointSize glPointSize;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PointSizex(int size);
internal static PointSizex glPointSizex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PolygonOffset(Single factor, Single units);
internal static PolygonOffset glPolygonOffset;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PolygonOffsetx(int factor, int units);
internal static PolygonOffsetx glPolygonOffsetx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PopMatrix();
internal static PopMatrix glPopMatrix;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void PushMatrix();
internal static PushMatrix glPushMatrix;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ReadPixels(Int32 x, Int32 y, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
internal static ReadPixels glReadPixels;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Rotatef(Single angle, Single x, Single y, Single z);
internal static Rotatef glRotatef;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Rotatex(int angle, int x, int y, int z);
internal static Rotatex glRotatex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void SampleCoverage(Single value, bool invert);
internal static SampleCoverage glSampleCoverage;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void SampleCoveragex(int value, bool invert);
internal static SampleCoveragex glSampleCoveragex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Scalef(Single x, Single y, Single z);
internal static Scalef glScalef;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Scalex(int x, int y, int z);
internal static Scalex glScalex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Scissor(Int32 x, Int32 y, Int32 width, Int32 height);
internal static Scissor glScissor;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void ShadeModel(OpenTK.Graphics.ES10.All mode);
internal static ShadeModel glShadeModel;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void StencilFunc(OpenTK.Graphics.ES10.All func, Int32 @ref, UInt32 mask);
internal static StencilFunc glStencilFunc;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void StencilMask(UInt32 mask);
internal static StencilMask glStencilMask;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void StencilOp(OpenTK.Graphics.ES10.All fail, OpenTK.Graphics.ES10.All zfail, OpenTK.Graphics.ES10.All zpass);
internal static StencilOp glStencilOp;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexCoordPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
internal static TexCoordPointer glTexCoordPointer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexEnvf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
internal static TexEnvf glTexEnvf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void TexEnvfv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single* @params);
internal unsafe static TexEnvfv glTexEnvfv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexEnvx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
internal static TexEnvx glTexEnvx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal unsafe delegate void TexEnvxv(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int* @params);
internal unsafe static TexEnvxv glTexEnvxv;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 internalformat, Int32 width, Int32 height, Int32 border, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
internal static TexImage2D glTexImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexParameterf(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, Single param);
internal static TexParameterf glTexParameterf;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexParameterx(OpenTK.Graphics.ES10.All target, OpenTK.Graphics.ES10.All pname, int param);
internal static TexParameterx glTexParameterx;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void TexSubImage2D(OpenTK.Graphics.ES10.All target, Int32 level, Int32 xoffset, Int32 yoffset, Int32 width, Int32 height, OpenTK.Graphics.ES10.All format, OpenTK.Graphics.ES10.All type, IntPtr pixels);
internal static TexSubImage2D glTexSubImage2D;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Translatef(Single x, Single y, Single z);
internal static Translatef glTranslatef;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Translatex(int x, int y, int z);
internal static Translatex glTranslatex;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void VertexPointer(Int32 size, OpenTK.Graphics.ES10.All type, Int32 stride, IntPtr pointer);
internal static VertexPointer glVertexPointer;
[System.Security.SuppressUnmanagedCodeSecurity()]
internal delegate void Viewport(Int32 x, Int32 y, Int32 width, Int32 height);
internal static Viewport glViewport;
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,134 +1,134 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace OpenTK.Graphics.ES10
{
// Used in debug-mode only, for automatic OpenGL error-checking.
//
// Works like this: an instance is created before each OpenGL function is called.
// The constructor resets the OpenGL error state. Once the native function returns,
// the error state is checked again, raising the relevant exceptions.
//
// A using-region is used to ensure Dispose() is called.
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
struct ErrorHelper : IDisposable
{
#region Fields
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
#endregion
#region Constructors
public ErrorHelper(IGraphicsContext context)
{
if (context == null)
throw new GraphicsContextMissingException();
Context = (GraphicsContext)context;
lock (SyncRoot)
{
if (!ContextErrors.ContainsKey(Context))
ContextErrors.Add(Context, new List<ErrorCode>());
}
ResetErrors();
}
#endregion
#region Public Members
// Retrieve all OpenGL errors to clear the error list.
// See http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html
[Conditional("DEBUG")]
internal void ResetErrors()
{
if (Context.ErrorChecking)
{
while ((ErrorCode)GL.GetError() != ErrorCode.NoError)
{ }
}
}
// Retrieve all OpenGL errors and throw an exception if anything other than NoError is returned.
[Conditional("DEBUG")]
internal void CheckErrors()
{
if (Context.ErrorChecking)
{
List<ErrorCode> error_list = ContextErrors[Context];
error_list.Clear();
ErrorCode error;
do
{
error = (ErrorCode)GL.GetError();
error_list.Add(error);
} while (error != ErrorCode.NoError);
if (error_list.Count != 1)
{
StringBuilder sb = new StringBuilder();
foreach (ErrorCode e in error_list)
{
if (e != ErrorCode.NoError)
{
sb.Append(e.ToString());
sb.Append(", ");
}
else
break;
}
sb.Remove(sb.Length - 2, 2); // Remove the last comma
throw new GraphicsErrorException(sb.ToString());
}
}
}
#endregion
#region IDisposable Members
public void Dispose()
{
CheckErrors();
}
#endregion
}
}
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace OpenTK.Graphics.ES10
{
// Used in debug-mode only, for automatic OpenGL error-checking.
//
// Works like this: an instance is created before each OpenGL function is called.
// The constructor resets the OpenGL error state. Once the native function returns,
// the error state is checked again, raising the relevant exceptions.
//
// A using-region is used to ensure Dispose() is called.
//
// Make sure that no error checking is added to the GetError function,
// as that would cause infinite recursion!
struct ErrorHelper : IDisposable
{
#region Fields
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
#endregion
#region Constructors
public ErrorHelper(IGraphicsContext context)
{
if (context == null)
throw new GraphicsContextMissingException();
Context = (GraphicsContext)context;
lock (SyncRoot)
{
if (!ContextErrors.ContainsKey(Context))
ContextErrors.Add(Context, new List<ErrorCode>());
}
ResetErrors();
}
#endregion
#region Public Members
// Retrieve all OpenGL errors to clear the error list.
// See http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html
[Conditional("DEBUG")]
internal void ResetErrors()
{
if (Context.ErrorChecking)
{
while ((ErrorCode)GL.GetError() != ErrorCode.NoError)
{ }
}
}
// Retrieve all OpenGL errors and throw an exception if anything other than NoError is returned.
[Conditional("DEBUG")]
internal void CheckErrors()
{
if (Context.ErrorChecking)
{
List<ErrorCode> error_list = ContextErrors[Context];
error_list.Clear();
ErrorCode error;
do
{
error = (ErrorCode)GL.GetError();
error_list.Add(error);
} while (error != ErrorCode.NoError);
if (error_list.Count != 1)
{
StringBuilder sb = new StringBuilder();
foreach (ErrorCode e in error_list)
{
if (e != ErrorCode.NoError)
{
sb.Append(e.ToString());
sb.Append(", ");
}
else
break;
}
sb.Remove(sb.Length - 2, 2); // Remove the last comma
throw new GraphicsErrorException(sb.ToString());
}
}
}
#endregion
#region IDisposable Members
public void Dispose()
{
CheckErrors();
}
#endregion
}
}

View file

@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Graphics.ES10
{
/// <summary>
/// Provides access to OpenGL ES 1.0 methods.
/// </summary>
public sealed partial class GL : BindingsBase
{
const string Library = "libGLES.dll";
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Graphics.ES10
{
/// <summary>
/// Provides access to OpenGL ES 1.0 methods.
/// </summary>
public sealed partial class GL : BindingsBase
{
const string Library = "libGLES.dll";
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more