This commit is contained in:
the_fiddler 2006-09-24 14:04:39 +00:00
parent 91d668210d
commit 3a5dff7e16
97 changed files with 52478 additions and 0 deletions

103
OpenTK.sln Normal file
View file

@ -0,0 +1,103 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documentation", "Documentation", "{80BD2C66-A90B-42E7-BED8-CBF7BB8C2E3F}"
ProjectSection(SolutionItems) = preProject
license.txt = license.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Specifications", "Specifications", "{B23A6DCD-9FE9-4523-95FB-01C8D4631555}"
ProjectSection(SolutionItems) = preProject
Specifications\enum.spec = Specifications\enum.spec
Specifications\enumext.spec = Specifications\enumext.spec
Specifications\gl.spec = Specifications\gl.spec
Specifications\TypeMap.txt = Specifications\TypeMap.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Projects", "Projects", "{E9FF51BB-295E-4891-AA30-D1374F26DCE0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{C6E60A87-12B4-444A-BE03-7E980EAC0172}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenTK", "OpenTK", "{7E640424-E2CD-4DD5-9392-7A706D73930E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenGL", "OpenGL", "{70FA6EE8-62C6-437F-AD82-117F2D9CDE68}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenGL", "OpenGL", "{2F3FEAD4-0FBD-48CC-AFA0-29FFF28284C2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenAL", "OpenAL", "{30996477-EDDE-4E45-AB3D-5E466314C755}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Math", "Math", "{84EAC24B-BF87-477C-838D-7110A1A24D41}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Input", "Input", "{4BB769A0-1B69-474E-A99A-B6B9BE1A3A1E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platform", "Platform", "{50DCE788-72FC-47E0-A6BD-50BCCE3FCE5B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Examples.OpenGL.DisplayLists", "Source\Examples\OpenGL\DisplayLists\OpenTK.Examples.OpenGL.DisplayLists.csproj", "{0D470B2A-C200-4D27-90C1-B691405E4069}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Examples.OpenGL.TwoContexts", "Source\Examples\OpenGL\TwoContexts\OpenTK.Examples.OpenGL.TwoContexts.csproj", "{6CC64414-ADED-4148-9969-B2957DD6377A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Examples.OpenGL.Window", "Source\Examples\OpenGL\Window\OpenTK.Examples.OpenGL.Window.csproj", "{E4CEA249-4014-49CB-AF37-5A303A4A08D1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.OpenGL.Bind", "Source\OpenGL\Bind\OpenTK.OpenGL.Bind.csproj", "{1EDDE592-3923-4898-9006-3D69579E1745}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.OpenGL", "Source\OpenGL\OpenGL\OpenTK.OpenGL.csproj", "{836876D1-0C8D-4240-BEE4-859D9D3D46CB}"
ProjectSection(ProjectDependencies) = postProject
{FDFA00B6-FA81-4658-86E1-F312EFB42E1C} = {FDFA00B6-FA81-4658-86E1-F312EFB42E1C}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Platform.Windows", "Source\Platform\Windows\OpenTK.Platform.Windows.csproj", "{FDFA00B6-FA81-4658-86E1-F312EFB42E1C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{84C34705-D460-4028-AE58-C32CF210F9BF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D470B2A-C200-4D27-90C1-B691405E4069}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D470B2A-C200-4D27-90C1-B691405E4069}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D470B2A-C200-4D27-90C1-B691405E4069}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D470B2A-C200-4D27-90C1-B691405E4069}.Release|Any CPU.Build.0 = Release|Any CPU
{6CC64414-ADED-4148-9969-B2957DD6377A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CC64414-ADED-4148-9969-B2957DD6377A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CC64414-ADED-4148-9969-B2957DD6377A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CC64414-ADED-4148-9969-B2957DD6377A}.Release|Any CPU.Build.0 = Release|Any CPU
{E4CEA249-4014-49CB-AF37-5A303A4A08D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E4CEA249-4014-49CB-AF37-5A303A4A08D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E4CEA249-4014-49CB-AF37-5A303A4A08D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E4CEA249-4014-49CB-AF37-5A303A4A08D1}.Release|Any CPU.Build.0 = Release|Any CPU
{1EDDE592-3923-4898-9006-3D69579E1745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EDDE592-3923-4898-9006-3D69579E1745}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EDDE592-3923-4898-9006-3D69579E1745}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EDDE592-3923-4898-9006-3D69579E1745}.Release|Any CPU.Build.0 = Release|Any CPU
{836876D1-0C8D-4240-BEE4-859D9D3D46CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{836876D1-0C8D-4240-BEE4-859D9D3D46CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{836876D1-0C8D-4240-BEE4-859D9D3D46CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{836876D1-0C8D-4240-BEE4-859D9D3D46CB}.Release|Any CPU.Build.0 = Release|Any CPU
{FDFA00B6-FA81-4658-86E1-F312EFB42E1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDFA00B6-FA81-4658-86E1-F312EFB42E1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDFA00B6-FA81-4658-86E1-F312EFB42E1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDFA00B6-FA81-4658-86E1-F312EFB42E1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{84C34705-D460-4028-AE58-C32CF210F9BF} = {80BD2C66-A90B-42E7-BED8-CBF7BB8C2E3F}
{C6E60A87-12B4-444A-BE03-7E980EAC0172} = {E9FF51BB-295E-4891-AA30-D1374F26DCE0}
{7E640424-E2CD-4DD5-9392-7A706D73930E} = {E9FF51BB-295E-4891-AA30-D1374F26DCE0}
{70FA6EE8-62C6-437F-AD82-117F2D9CDE68} = {C6E60A87-12B4-444A-BE03-7E980EAC0172}
{2F3FEAD4-0FBD-48CC-AFA0-29FFF28284C2} = {7E640424-E2CD-4DD5-9392-7A706D73930E}
{30996477-EDDE-4E45-AB3D-5E466314C755} = {7E640424-E2CD-4DD5-9392-7A706D73930E}
{84EAC24B-BF87-477C-838D-7110A1A24D41} = {7E640424-E2CD-4DD5-9392-7A706D73930E}
{4BB769A0-1B69-474E-A99A-B6B9BE1A3A1E} = {7E640424-E2CD-4DD5-9392-7A706D73930E}
{50DCE788-72FC-47E0-A6BD-50BCCE3FCE5B} = {7E640424-E2CD-4DD5-9392-7A706D73930E}
{0D470B2A-C200-4D27-90C1-B691405E4069} = {70FA6EE8-62C6-437F-AD82-117F2D9CDE68}
{6CC64414-ADED-4148-9969-B2957DD6377A} = {70FA6EE8-62C6-437F-AD82-117F2D9CDE68}
{E4CEA249-4014-49CB-AF37-5A303A4A08D1} = {70FA6EE8-62C6-437F-AD82-117F2D9CDE68}
{1EDDE592-3923-4898-9006-3D69579E1745} = {2F3FEAD4-0FBD-48CC-AFA0-29FFF28284C2}
{836876D1-0C8D-4240-BEE4-859D9D3D46CB} = {2F3FEAD4-0FBD-48CC-AFA0-29FFF28284C2}
{FDFA00B6-FA81-4658-86E1-F312EFB42E1C} = {50DCE788-72FC-47E0-A6BD-50BCCE3FCE5B}
EndGlobalSection
EndGlobal

BIN
OpenTK.suo Normal file

Binary file not shown.

View file

@ -0,0 +1,38 @@
namespace OpenTK.OpenGL.Test
{
partial class DisplayLists
{
/// <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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "Form1";
}
#endregion
}
}

View file

@ -0,0 +1,104 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace OpenTK.OpenGL.Test
{
public partial class DisplayLists : Form
{
Context context;
uint[] lists = new uint[2];
public DisplayLists()
{
InitializeComponent();
context = Context.Create(this, 8, 8, 8, 8, 0, 0, false);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Text =
GL.GetString(Enums.StringName.VENDOR) + " " +
GL.GetString(Enums.StringName.RENDERER) + " " +
GL.GetString(Enums.StringName.VERSION);
lists[0] = GL.GenLists(1);
lists[1] = GL.GenLists(1);
GL.NewList(lists[0], Enums.ListMode.COMPILE);
GL.Begin(Enums.BeginMode.TRIANGLES);
GL.Color3f(1.0f, 0.0f, 0.0f); GL.Vertex3f(-0.5f, -0.5f, 1.0f);
GL.Color3f(0.0f, 1.0f, 0.0f); GL.Vertex3f(0.5f, -0.5f, 1.0f);
GL.Color3f(0.0f, 0.0f, 1.0f); GL.Vertex3f(0.0f, 0.5f, 1.0f);
GL.End();
GL.EndList();
GL.NewList(lists[1], Enums.ListMode.COMPILE);
GL.Begin(Enums.BeginMode.QUADS);
GL.Color3f(0.1f, 0.1f, 0.5f); GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Color3f(1.0f, 1.0f, 1.0f); GL.Vertex3f(-1.0f, -0.5f, 1.0f);
GL.Color3f(1.0f, 0.0f, 0.0f); GL.Vertex3f(-0.5f, -0.5f, 1.0f);
GL.Color3f(0.1f, 0.1f, 0.5f); GL.Vertex3f(-0.5f, -1.0f, 1.0f);
GL.End();
GL.EndList();
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
OnResize(e);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
if (ClientSize.Height == 0)
ClientSize = new System.Drawing.Size(ClientSize.Width, 1);
GL.Viewport(0, 0, ClientSize.Width, ClientSize.Height);
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, ClientSize.Width / (double)ClientSize.Height, 1.0, 64.0);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
Glu.LookAt(
0.0, 0.0, 5.0,
0.0, 0.0, -1.0,
0.0, 1.0, 0.0
);
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT);
GL.CallLists(2, Enums.ListNameType.UNSIGNED_INT, lists);
context.SwapBuffers();
}
[STAThread]
static void Main()
{
Application.Run(new DisplayLists());
}
}
}

View file

@ -0,0 +1,92 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0D470B2A-C200-4D27-90C1-B691405E4069}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenTK.OpenGL.Examples.DisplayLists</RootNamespace>
<AssemblyName>OpenTK.OpenGL.Examples.DisplayLists</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\Binaries\Debug\Examples\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\Binaries\Release\Examples\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll</HintPath>
</Reference>
<Reference Include="System.Data">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll</HintPath>
</Reference>
<Reference Include="System.Deployment">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="System.Xml">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DisplayLists.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DisplayLists.Designer.cs">
<DependentUpon>DisplayLists.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\OpenGL\OpenGL\OpenTK.OpenGL.csproj">
<Project>{836876D1-0C8D-4240-BEE4-859D9D3D46CB}</Project>
<Name>OpenTK.OpenGL</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,33 @@
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("DisplayLists")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DisplayLists")]
[assembly: AssemblyCopyright("Copyright © 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("377262fd-fe73-4f2a-846c-987d2e0a980a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.OpenGL.Examples.DisplayLists.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.OpenGL.Examples.DisplayLists.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;
}
}
}
}

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.OpenGL.Examples.DisplayLists.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View file

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View file

@ -0,0 +1,4 @@
bin\Debug\DisplayLists.exe
bin\Debug\DisplayLists.pdb
bin\Debug\OpenGL.dll
bin\Debug\OpenGL.pdb

View file

@ -0,0 +1,3 @@
obj\Debug\ResolveAssemblyReference.cache
obj\Debug\OpenTK.OpenGL.Examples.DisplayLists.Properties.Resources.resources
obj\Debug\OpenTK.OpenGL.DisplayLists.csproj.GenerateResource.Cache

View file

@ -0,0 +1,96 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6CC64414-ADED-4148-9969-B2957DD6377A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenTK.OpenGL.Examples.TwoContexts</RootNamespace>
<AssemblyName>OpenTK.OpenGL.Examples.TwoContexts</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\Binaries\Debug\Examples\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\Binaries\Release\Examples\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll</HintPath>
</Reference>
<Reference Include="System.Data">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll</HintPath>
</Reference>
<Reference Include="System.Deployment">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="System.Xml">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="TwoContexts.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="TwoContexts.Designer.cs">
<DependentUpon>TwoContexts.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="TwoContexts.resx">
<SubType>Designer</SubType>
<DependentUpon>TwoContexts.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\OpenGL\OpenGL\OpenTK.OpenGL.csproj">
<Project>{836876D1-0C8D-4240-BEE4-859D9D3D46CB}</Project>
<Name>OpenTK.OpenGL</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,33 @@
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("TwoContexts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TwoContexts")]
[assembly: AssemblyCopyright("Copyright © 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f658d492-480e-49b8-9198-8001df3e576a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.OpenGL.Examples.TwoContexts.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.OpenGL.Examples.TwoContexts.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;
}
}
}
}

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.OpenGL.Examples.TwoContexts.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View file

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View file

@ -0,0 +1,76 @@
namespace OpenTK.OpenGL.Test
{
partial class TwoContexts
{
/// <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.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.SuspendLayout();
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(12, 12);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(268, 100);
this.panel1.TabIndex = 0;
this.panel1.Resize += new System.EventHandler(this.panel1_Resize);
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
this.panel1.SizeChanged += new System.EventHandler(this.panel1_Resize);
//
// panel2
//
this.panel2.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.panel2.Location = new System.Drawing.Point(12, 154);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(268, 100);
this.panel2.TabIndex = 1;
this.panel2.Resize += new System.EventHandler(this.panel2_Resize);
this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint);
//
// TwoContexts
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "TwoContexts";
this.Text = "TwoContexts";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
}
}

View file

@ -0,0 +1,142 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenTK.OpenGL;
namespace OpenTK.OpenGL.Test
{
public partial class TwoContexts : Form
{
Context context1, context2;
public TwoContexts()
{
InitializeComponent();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
context1 = Context.Create(panel1, 8, 8, 8, 8, 0, 0, false);
context2 = Context.Create(panel2, 8, 8, 8, 8, 0, 0, false);
Text =
GL.GetString(Enums.StringName.VENDOR) + " " +
GL.GetString(Enums.StringName.RENDERER) + " " +
GL.GetString(Enums.StringName.VERSION);
context1.MakeCurrent();
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
context2.MakeCurrent();
GL.ClearColor(0.7f, 0.1f, 0.1f, 0.0f);
panel1_Resize(null, null);
panel2_Resize(null, null);
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
context1.MakeCurrent();
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
Glu.LookAt(
0.0, 0.0, 5.0,
0.0, 0.0, -1.0,
0.0, 1.0, 0.0
);
GL.Begin(Enums.BeginMode.TRIANGLES);
GL.Color3f(1.0f, 0.0f, 0.0f); GL.Vertex3f(-1.0f, -1.0f, -5.0f);
GL.Color3f(0.0f, 0.0f, 1.0f); GL.Vertex3f( 1.0f, 1.0f, -5.0f);
GL.Color3f(0.0f, 1.0f, 0.0f); GL.Vertex3f(-1.0f, 1.0f, -5.0f);
GL.End();
context1.SwapBuffers();
}
private void panel1_Resize(object sender, EventArgs e)
{
context1.MakeCurrent();
if (panel1.ClientSize.Height == 0)
panel1.ClientSize = new System.Drawing.Size(panel1.ClientSize.Width, 1);
GL.Viewport(0, 0, panel1.ClientSize.Width, panel1.ClientSize.Height);
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, panel1.ClientSize.Width / (double)panel1.ClientSize.Height, 1.0, 64.0);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
context2.MakeCurrent();
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
Glu.LookAt(
0.0, 0.0, 5.0,
0.0, 0.0, -1.0,
0.0, 1.0, 0.0
);
GL.Begin(Enums.BeginMode.TRIANGLES);
GL.Color3f(1.0f, 0.0f, 0.0f); GL.Vertex3f(-1.0f, -1.0f, -5.0f);
GL.Color3f(0.0f, 0.0f, 1.0f); GL.Vertex3f(1.0f, 1.0f, -5.0f);
GL.Color3f(0.0f, 1.0f, 0.0f); GL.Vertex3f(-1.0f, 1.0f, -5.0f);
GL.End();
context2.SwapBuffers();
}
private void panel2_Resize(object sender, EventArgs e)
{
context2.MakeCurrent();
if (panel2.ClientSize.Height == 0)
panel2.ClientSize = new System.Drawing.Size(panel2.ClientSize.Width, 1);
GL.Viewport(0, 0, panel2.ClientSize.Width, panel2.ClientSize.Height);
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, panel2.ClientSize.Width / (double)panel2.ClientSize.Height, 1.0, 64.0);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new TwoContexts());
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,4 @@
obj\Debug\ResolveAssemblyReference.cache
obj\Debug\OpenTK.OpenGL.Examples.TwoContexts.Properties.Resources.resources
obj\Debug\OpenTK.OpenGL.Test.TwoContexts.resources
obj\Debug\OpenTK.OpenGL.TwoContexts.csproj.GenerateResource.Cache

View file

@ -0,0 +1,92 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E4CEA249-4014-49CB-AF37-5A303A4A08D1}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenTK.OpenGL.Examples.Window</RootNamespace>
<AssemblyName>OpenTK.OpenGL.Examples.Window</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\Binaries\Debug\Examples\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\..\Binaries\Release\Examples\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll</HintPath>
</Reference>
<Reference Include="System.Data">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll</HintPath>
</Reference>
<Reference Include="System.Deployment">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Drawing">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="System.Xml">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Window.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Window.Designer.cs">
<DependentUpon>Window.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\OpenGL\OpenGL\OpenTK.OpenGL.csproj">
<Project>{836876D1-0C8D-4240-BEE4-859D9D3D46CB}</Project>
<Name>OpenTK.OpenGL</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,97 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
using System.Threading;
using OpenTK.OpenGL;
namespace Test
{
class Program : Form
{
public Context context;
Program()
{
context = Context.Create(this, 8, 8, 8, 8, 0, 0, false);
//this.Text =
// GL.GetString(Enums.StringName.VENDOR) + " " +
// GL.GetString(Enums.StringName.RENDERER) + " " +
// GL.GetString(Enums.StringName.VERSION);
Text = Width.ToString() + "x" + Height.ToString();
this.CenterToScreen();
this.ResizeRedraw = true;
}
protected override void OnResize(EventArgs e)
{
System.Drawing.Size size = ClientSize;
if (size.Height == 0)
size.Height = 1;
// Set the viewport to be the entire window
GL.Viewport(0, 0, size.Width, size.Height);
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, (double)size.Width / (double)size.Height, 1.0, 20.0);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
Glu.LookAt( 0.0, 0.0, -5.0,
0.0, 0.0, 1.0,
0.0, 1.0, 0.0 );
Text = "Size: " + size.Width.ToString() + "x" + size.Height.ToString();
ClientSize = size;
base.OnResize(e);
}
protected override void OnPaint(PaintEventArgs e)
{
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT);
GL.PushMatrix();
GL.Begin(Enums.BeginMode.TRIANGLES);
GL.Color3f(1.0f, 0.0f, 0.0f); GL.Vertex3f(-0.5f, -0.5f, 5.0f);
GL.Color3f(0.0f, 1.0f, 0.0f); GL.Vertex3f( 0.5f, -0.5f, 5.0f);
GL.Color3f(0.0f, 0.0f, 1.0f); GL.Vertex3f( 0.0f, 0.5f, 5.0f);
GL.End();
GL.PopMatrix();
context.SwapBuffers();
base.OnPaint(e);
}
[STAThread]
static void Main()
{
Thread.Sleep(100);
Application.Run(new Program());
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// Program
//
this.ClientSize = new System.Drawing.Size(632, 446);
this.Name = "Program";
this.ResumeLayout(false);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,33 @@
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("Window")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Window")]
[assembly: AssemblyCopyright("Copyright © 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("24d8672e-23eb-48d2-9733-545e9f2148bc")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.OpenGL.Examples.Window.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.OpenGL.Examples.Window.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;
}
}
}
}

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.OpenGL.Examples.Window.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View file

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View file

@ -0,0 +1,38 @@
namespace OpenTK.OpenGL.Test
{
partial class Window
{
/// <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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "GLForm";
}
#endregion
}
}

View file

@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenTK.OpenGL;
namespace OpenTK.OpenGL.Test
{
public partial class Window : Form
{
public Context context;
public Window()
{
InitializeComponent();
context = Context.Create(this, 8, 8, 8, 8, 16, 0, false);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Text =
GL.GetString(Enums.StringName.VENDOR) + " " +
GL.GetString(Enums.StringName.RENDERER) + " " +
GL.GetString(Enums.StringName.VERSION);
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
OnResize(e);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
if (ClientSize.Height == 0)
ClientSize = new System.Drawing.Size(ClientSize.Width, 1);
GL.Viewport(0, 0, ClientSize.Width, ClientSize.Height);
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, ClientSize.Width / (double)ClientSize.Height, 1.0, 64.0);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
Glu.LookAt(
0.0, 0.0, 5.0,
0.0, 0.0, -1.0,
0.0, 1.0, 0.0
);
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT);
GL.Begin(Enums.BeginMode.TRIANGLES);
GL.Color3f(1.0f, 0.0f, 0.0f); GL.Vertex3i(-1, -1, 1);
GL.Color3f(0.0f, 0.0f, 1.0f); GL.Vertex3i(1, -1, 1);
GL.Color3f(0.0f, 1.0f, 0.0f); GL.Vertex3i(1, 1, 1);
GL.End();
context.SwapBuffers();
}
[STAThread]
static void Main()
{
Application.Run(new Window());
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,3 @@
obj\Debug\ResolveAssemblyReference.cache
obj\Debug\OpenTK.OpenGL.Examples.Window.Properties.Resources.resources
obj\Debug\OpenTK.OpenGL.Window.csproj.GenerateResource.Cache

View file

@ -0,0 +1,6 @@
bin\Debug\Window.exe
bin\Debug\Window.pdb
bin\Debug\OpenGL.dll
bin\Debug\OpenGL.pdb
..\Binaries\Debug\Window.exe
..\Binaries\Debug\Window.pdb

BIN
Source/OpenGL/Bind/Bind.suo Normal file

Binary file not shown.

View file

@ -0,0 +1,91 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
/// <summary>
/// Represents an opengl constant in C# format. Both the constant name and value
/// can be retrieved or set. All opengl constants are translated to 'const uint'.
/// </summary>
public class Constant
{
#region Name
string _name;
/// <summary>
/// Gets or sets the name of the opengl constant (eg. GL_LINES).
/// </summary>
public string Name
{
get { return _name; }
set
{
if (!String.IsNullOrEmpty(value))
_name = value.Trim();
}
}
#endregion
#region Value
string _value;
/// <summary>
/// Gets or sets the value of the opengl constant (eg. 0x00000001).
/// </summary>
public string Value
{
get { return _value; }
set
{
if (!String.IsNullOrEmpty(value))
_value = value.Trim();
}
}
#endregion
#region Constructors
/// <summary>
/// Creates an empty Constant.
/// </summary>
public Constant()
{
}
/// <summary>
/// Creates a Constant with the given name and value.
/// </summary>
/// <param name="name">The Name of the Constant.</param>
/// <param name="value">The Type of the Constant.</param>
public Constant(string name, string value)
{
Name = name;
Value = value;
}
#endregion
#region Helper functions
/// <summary>
/// Returns a string that represents the full constant declaration without decorations
/// (eg const uint GL_XXX_YYY = 0xDEADBEEF).
/// </summary>
/// <returns></returns>
new public string ToString()
{
return "uint " + Name + " = " + Value;
}
#endregion
}
}

View file

@ -0,0 +1,48 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
public class Enum
{
public Enum()
{
}
string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
System.Collections.Hashtable _constant_collection = new System.Collections.Hashtable();
public System.Collections.Hashtable ConstantCollection
{
get { return _constant_collection; }
set { _constant_collection = value; }
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine(" public enum " + Name + " : uint");
sb.AppendLine(" {");
foreach (Constant c in ConstantCollection.Values)
{
sb.AppendLine(" " + c.Name + " = " + c.Value + ",");
}
sb.AppendLine(" }");
return sb.ToString();
}
}
}

View file

@ -0,0 +1,130 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
/// <summary>
/// Represents an opengl function.
/// The return value, function name, function parameters and opengl version can be retrieved or set.
/// </summary>
public class Function
{
#region Needs wrapper property
bool _needs_wrapper;
/// <summary>
/// Indicates whether this function needs to be wrapped with a Marshaling function.
/// This flag is set if a function contains an Array parameter, or returns
/// an Array or string.
/// </summary>
public bool NeedsWrapper
{
get { return _needs_wrapper; }
set { _needs_wrapper = value; }
}
#endregion
#region Return value property
string _return_value;
/// <summary>
/// Gets or sets the return value of the opengl function.
/// </summary>
public string ReturnValue
{
get { return _return_value; }
set { _return_value = value; }
}
#endregion
#region Name property
string _name;
/// <summary>
/// Gets or sets the name of the opengl function.
/// </summary>
public string Name
{
get { return _name; }
set
{
if (!String.IsNullOrEmpty(value))
_name = value.Trim();
else
_name = value;
}
}
#endregion
#region Parameter collection property
ParameterCollection _parameters = new ParameterCollection();
public ParameterCollection Parameters
{
get { return _parameters; }
set { _parameters = value; }
}
#endregion
#region Version property
string _version;
/// <summary>
/// Defines the opengl version that introduced this function.
/// </summary>
public string Version
{
get { return _version; }
set { _version = value; }
}
#endregion
#region Extension property
bool _extension = false;
public bool Extension
{
get { return _extension; }
set { _extension = value; }
}
#endregion
#region Constructor
public Function()
{
}
#endregion
#region ToString function
/// <summary>
/// Gets the string representing the full function declaration without decorations
/// (ie "void glClearColor(float red, float green, float blue, float alpha)"
/// </summary>
override public string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append(ReturnValue + " " + Name + Parameters.ToString());
return sb.ToString();
}
#endregion
}
}

View file

@ -0,0 +1,127 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OpenTK.OpenGL.Bind
{
/// <summary>
/// Represents a single parameter of an opengl function.
/// </summary>
public class Parameter
{
#region Name property
string _name;
/// <summary>
/// Gets or sets the name of the parameter.
/// </summary>
public string Name
{
get { return _name; }
set { _name = value; }
}
#endregion
#region MarshalAs property
UnmanagedType _unmanaged_type;
/// <summary>
/// Gets or sets the name of the parameter.
/// </summary>
public UnmanagedType UnmanagedType
{
get { return _unmanaged_type; }
set { _unmanaged_type = value; }
}
#endregion
#region Type property
string _type;
/// <summary>
/// Gets the type of the parameter.
/// </summary>
public string Type
{
get { return _type; }
set { _type = value; }
}
#endregion
#region Flow property
/// <summary>
/// Enumarates the possible flows of a parameter (ie. is this parameter
/// used as input or as output?)
/// </summary>
public enum FlowDirection
{
Undefined = 0,
In,
Out
}
FlowDirection _flow;
/// <summary>
/// Gets or sets the flow of the parameter.
/// </summary>
public FlowDirection Flow
{
get { return _flow; }
set { _flow = value; }
}
#endregion
#region Array property
bool _array = false;
public bool Array
{
get { return _array; }
set { _array = value; }
}
#endregion
#region Constructors
/// <summary>
/// Creates a new Parameter without type and name.
/// </summary>
public Parameter() { }
#endregion
#region ToString function
override public string ToString()
{
StringBuilder sb = new StringBuilder();
if (UnmanagedType == UnmanagedType.AsAny && Flow == FlowDirection.In)
sb.Append("[MarshalAs(UnmanagedType.AsAny)] ");
if (Flow == FlowDirection.Out)
sb.Append("out ");
sb.Append(Type);
sb.Append(" ");
sb.Append(Name);
return sb.ToString();
}
#endregion
}
}

View file

@ -0,0 +1,48 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
public class ParameterCollection : List<Parameter>
{
#region Constructors
public ParameterCollection()
{
}
#endregion
override public string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("(");
if (this.Count > 0)
{
foreach (Parameter p in this)
{
sb.Append(p.ToString());
sb.Append(", ");
}
sb.Replace(", ", ")", sb.Length - 2, 2);
}
else
sb.Append(")");
return sb.ToString();
}
public bool ContainsType(string type)
{
foreach (Parameter p in this)
if (p.Type == type)
return true;
return false;
}
}
}

View file

@ -0,0 +1,82 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Text;
using System.IO;
using System.Security;
using System.Security.Permissions;
using Settings = OpenTK.OpenGL.Bind.Properties.Bind;
using System.Threading;
[assembly:CLSCompliant(true), FileIOPermission(SecurityAction.RequestMinimum, Unrestricted = true)]
namespace OpenTK.OpenGL.Bind
{
static class MainClass
{
static void Main(string[] arguments)
{
Console.WriteLine("{0} {1} by Stephen Apostolopoulos (stapostol@gmail.com)",
System.Reflection.Assembly.GetExecutingAssembly().GetName().Name,
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
try
{
foreach (string a in arguments)
{
if (a.StartsWith("--") || a.StartsWith("-") || a.StartsWith("/"))
{
string[] b = a.Split(new char[] { '-', '/', '=' }, StringSplitOptions.RemoveEmptyEntries);
switch (b[0])
{
case "?":
case "help":
Console.WriteLine("Help not implemented yet.");
return;
case "in":
case "input":
Properties.Bind.Default.InputPath = b[1];
break;
case "out":
case "Properties.Bind.Default.OutputPath":
Properties.Bind.Default.OutputPath = b[1];
break;
case "class":
Properties.Bind.Default.OutputGLClass = b[1];
break;
default:
throw new ArgumentException("Argument " + a + " not recognized. Use the '/?' switch for help.");
}
}
}
}
catch (NullReferenceException e)
{
Console.WriteLine("Argument error ({0}). Please use the '/?' switch for help.", e.ToString());
return;
}
catch (ArgumentException e)
{
Console.WriteLine("Argument error ({0}). Please use the '/?' switch for help.", e.ToString());
return;
}
try
{
new Process();
}
catch (SecurityException e)
{
Console.WriteLine("Security violation \"{0}\" in method \"{1}\".", e.Message, e.Method);
Console.WriteLine("This application does not have permission to take the requested actions.");
}
/*finally
{
Console.WriteLine("Press any key to continue...");
while (!Console.KeyAvailable)
Thread.Sleep(100);
}*/
}
}
}

View file

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1EDDE592-3923-4898-9006-3D69579E1745}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenTK.OpenGL.Bind</RootNamespace>
<AssemblyName>OpenTK.OpenGL.Bind</AssemblyName>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\Binaries\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\Binaries\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup>
<Compile Include="Data\Constant.cs" />
<Compile Include="Data\Enum.cs" />
<Compile Include="Data\Function.cs" />
<Compile Include="Data\Parameter.cs" />
<Compile Include="Data\ParameterCollection.cs" />
<Compile Include="Main.cs" />
<Compile Include="Process\Process.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Bind.cs" />
<Compile Include="Properties\Bind.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Bind.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Process\ReadSpecs.cs" />
<Compile Include="Process\WriteContextLoad.cs" />
<Compile Include="Process\WriteDelegateList.cs" />
<Compile Include="Process\WriteEnums.cs" />
<Compile Include="Process\WriteFunctions.cs" />
<Compile Include="Process\WriteWrappers.cs" />
<Compile Include="Translation.cs" />
</ItemGroup>
<PropertyGroup>
<PostBuildEvent>$(TargetName)</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll</HintPath>
</Reference>
<Reference Include="System.Data">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll</HintPath>
</Reference>
<Reference Include="System.Deployment">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.XML">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="Properties\app.config" />
<None Include="Properties\Bind.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Bind.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
</Project>

View file

@ -0,0 +1,16 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory>
</InstallUrlHistory>
<SupportUrlHistory>
</SupportUrlHistory>
<UpdateUrlHistory>
</UpdateUrlHistory>
<BootstrapperUrlHistory>
</BootstrapperUrlHistory>
<ApplicationRevision>0</ApplicationRevision>
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,87 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Threading;
namespace OpenTK.OpenGL.Bind
{
partial class Process
{
#region Enum collection property
System.Collections.Hashtable _enum_collection = new System.Collections.Hashtable();
public System.Collections.Hashtable EnumCollection
{
get { return _enum_collection; }
set { _enum_collection = value; }
}
#endregion
#region Function collection property
List<Function> _function_collection = new List<Function>();
public List<Function> FunctionCollection
{
get { return _function_collection; }
set { _function_collection = value; }
}
#endregion
#region Wrapper collection property
List<Function> _wrapper_collection = new List<Function>();
public List<Function> WrapperCollection
{
get { return _wrapper_collection; }
set { _wrapper_collection = value; }
}
#endregion
#region Constructor
/// <summary>
/// Processes the file given in the input_file parameter and writes the output
/// to the path sepcified by the Properties.Bind.Default.OutputPath parameter. The Block parameter
/// contains the complete list of bindings for this class.
/// </summary>
/// <param name="Properties.Bind.Default.InputPath">A string containing the path to the input file.</param>
/// <param name="Properties.Bind.Default.OutputPath">A string containing the path to the output directory.</param>
/// <param name="complete_block">Contains the full list of constants and functions generated by this processor.</param>
public Process()
{
long ticks = System.DateTime.Now.Ticks;
ReadSpecs("gl.spec");
ReadSpecs("enum.spec");
ReadSpecs("enumext.spec");
Translation.Translate(FunctionCollection, WrapperCollection);
Translation.Translate(EnumCollection);
WriteFunctions(Properties.Bind.Default.OutputPath);
WriteEnums(Properties.Bind.Default.OutputPath);
WriteWrappers(Properties.Bind.Default.OutputPath);
WritePerContextLoad(Properties.Bind.Default.OutputPath, "WindowsContext", "1.0", "1.1");
WritePerContextLoad(Properties.Bind.Default.OutputPath, "WindowsVistaContext", "1.0", "1.1", "1.2", "1.3", "1.4");
WritePerContextLoad(Properties.Bind.Default.OutputPath, "X11Context", "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "2.0");
ticks = System.DateTime.Now.Ticks - ticks;
Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0);
Thread.Sleep(1000); // In order to allow new files to be copied to be parsed by the OpenTK build target.
}
#endregion
}
}

View file

@ -0,0 +1,205 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
/* There are several errors in the spec files.
* enum.spec:
* A missing "#" to comment out a constant for a commented-out SGI extension (inoffensive, but erroneous nonetheless).
* Uses LightProperty instead of the correct LightParameter.
* References the commented out SGIX_icc_texture enum.
*
* enumext.spec
* The renaming scheme for the 2.0 version (e.g. SRC_ALPHA2 instead of SOURCE_ALPHA2) references the GL_* versions
* instead of the * which will break when a generator does not add the GL_ prefix. Moreover these reside in different enums
* so the reference will only work for the C preprocessor. As a workaround I added the missing constants outside of any enum.
*/
namespace OpenTK.OpenGL.Bind
{
public partial class Process
{
void ReadSpecs(string specfile)
{
string path = Path.Combine(Properties.Bind.Default.InputPath, specfile);
StreamReader sr;
try
{
sr = new StreamReader(path);
}
catch (Exception)
{
Console.WriteLine("Error opening spec file: {0}", path);
return;
}
Console.WriteLine("Reading specs from: {0}", specfile);
do
{
string line = sr.ReadLine().Trim();
if (String.IsNullOrEmpty(line) ||
line.StartsWith("#") || // Disregard comments.
line.StartsWith("passthru") || // Disregard passthru statements.
line.StartsWith("required-props:") ||
line.StartsWith("param:") ||
line.StartsWith("dlflags:") ||
line.StartsWith("glxflags:") ||
line.StartsWith("vectorequiv:") ||
line.StartsWith("category:") ||
line.StartsWith("version:") ||
line.StartsWith("glxsingle:") ||
line.StartsWith("glxropcode:") ||
line.StartsWith("glxvendorpriv:") ||
line.StartsWith("glsflags:") ||
line.StartsWith("glsopcode:") ||
line.StartsWith("glsalias:") ||
line.StartsWith("wglflags:") ||
line.StartsWith("extension:") ||
line.StartsWith("alias:") ||
line.StartsWith("offset:"))
continue;
while (line.Contains("(") && !sr.EndOfStream)
//complete_block.Functions.Add(ReadFunction(sr, line));
FunctionCollection.Add(ReadFunction(sr, ref line));
while (line.Contains("enum") && !sr.EndOfStream)
{
Enum e = ReadEnum(sr, ref line);
if (EnumCollection.ContainsKey(e.Name))
{
//Merge keys:
foreach (Constant c in e.ConstantCollection.Values)
{
if (!((Enum)EnumCollection[e.Name]).ConstantCollection.ContainsKey(c.Name))
((Enum)EnumCollection[e.Name]).ConstantCollection.Add(c.Name, c);
}
}
else
EnumCollection.Add(e.Name, e);
}
// EnumCollection.Add(ReadEnum(sr, ref line));
}
while (!sr.EndOfStream);
}
#region Read enumeration function
private Enum ReadEnum(StreamReader sr, ref string line)
{
Enum e = new Enum();
e.Name = line.Split(Translation.Separators, StringSplitOptions.RemoveEmptyEntries)[0];
do
{
line = sr.ReadLine();
if (String.IsNullOrEmpty(line) || line.StartsWith("#"))
continue;
if (line.Contains("enum:") || sr.EndOfStream)
break;
line = line.Replace('\t', ' ');
string[] words = line.Split(Translation.Separators, StringSplitOptions.RemoveEmptyEntries);
if (words.Length == 0)
continue;
Constant c = new Constant();
if (words[0] == "use")
{
c.Name = words[2];
c.Value = words[1] + "." + words[2];
}
if (line.Contains("="))
{
c.Name = words[0];
c.Value = words[2];
}
if (!String.IsNullOrEmpty(c.Name) && !e.ConstantCollection.ContainsKey(c.Name))
e.ConstantCollection.Add(c.Name, c);
}
while (!sr.EndOfStream);
return e;
}
#endregion
#region Read function function
Function ReadFunction(StreamReader sr, ref string line)
{
Function f = new Function();
//string line = sr.ReadLine();
f.Name = line.Split(Translation.Separators, StringSplitOptions.RemoveEmptyEntries)[0];
if (f.Name.EndsWith("ARB") ||
f.Name.EndsWith("EXT") ||
f.Name.EndsWith("ATI") ||
f.Name.EndsWith("NV") ||
f.Name.EndsWith("SUN") ||
f.Name.EndsWith("SUNX") ||
f.Name.EndsWith("SGI") ||
f.Name.EndsWith("SGIS") ||
f.Name.EndsWith("SGIX") ||
f.Name.EndsWith("MESA") ||
f.Name.EndsWith("3DFX") ||
f.Name.EndsWith("IBM") ||
f.Name.EndsWith("GREMEDY") ||
f.Name.EndsWith("HP") ||
f.Name.EndsWith("INTEL") ||
f.Name.EndsWith("PGI") ||
f.Name.EndsWith("INGR") ||
f.Name.EndsWith("APPLE"))
f.Extension = true;
do
{
line = sr.ReadLine();
line = line.Replace('\t', ' ');
string[] words = line.Split(Translation.Separators, StringSplitOptions.RemoveEmptyEntries);
if (String.IsNullOrEmpty(line) || words.Length == 0)
break;
switch (words[0])
{
case "return":
f.ReturnValue = words[1];
break;
case "param":
Parameter p = new Parameter();
p.Name = words[1];
p.Flow = words[3] == "in" ? Parameter.FlowDirection.In : Parameter.FlowDirection.Out;
p.Type = words[2];
if (words[4] == "array")
p.Array = true;
f.Parameters.Add(p);
break;
case "version":
f.Version = words[1];
break;
}
}
while (!sr.EndOfStream);
return f;
}
#endregion
}
}

View file

@ -0,0 +1,151 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace OpenTK.OpenGL.Bind
{
partial class Process
{
#region Write the per-context load function
/// <summary>
/// Write the platform specific Load() and LoadExtensions() functions.
/// </summary>
/// <param name="Properties.Bind.Default.OutputPath">The folder where the generated file will be saved.</param>
/// <param name="class_name">The name of the partial class that contains the load functions.</param>
/// <param name="core_blocks">The names of the function groups that are considered "core" for the specified platform. (e.g. GL_VERSION_1_1 for Windows prior to Vista)</param>
void WritePerContextLoad(string output_path, string class_name, params string[] import_functions)
{
if (!Directory.Exists(output_path))
Directory.CreateDirectory(output_path);
string filename = Path.Combine(output_path, class_name + "Load.cs");
StreamWriter sw = new StreamWriter(filename, false);
Console.WriteLine("Writing {0} to {1}", class_name, output_path);
// Write using directives.
sw.WriteLine("using System;");
sw.WriteLine("using System.Runtime.InteropServices;");
sw.WriteLine("using {0};", Properties.Bind.Default.OutputNamespace);
sw.WriteLine();
// Open namespace and class.
sw.WriteLine("namespace {0}.{1}", Properties.Bind.Default.OutputNamespace, Properties.Bind.Default.OutputPlatformNamespace);
sw.WriteLine("{");
sw.WriteLine(" public partial class {0}", class_name);
sw.WriteLine(" {");
#region Write the DllImports
// Write the [DllImported] functions.
sw.WriteLine(" #region DllImports");
sw.WriteLine();
sw.WriteLine(" internal class Imports");
sw.WriteLine(" {");
foreach (Function f in FunctionCollection)
{
if (IsImportFunction(f, import_functions))
{
sw.WriteLine(" [DllImport(_dll_name, EntryPoint = \"{0}\")]", "gl" + f.Name);
sw.WriteLine(" public static extern {0};", f.ToString());
sw.WriteLine();
}
}
sw.WriteLine(" }");
sw.WriteLine(" #endregion");
sw.WriteLine();
#endregion
#region Write the Load function for the opengl core.
// Write the Load function.
sw.WriteLine(" #region Load core");
sw.WriteLine();
sw.WriteLine(" /// <summary>");
sw.WriteLine(" /// Loads the core opengl functions (versions 1.0-2.0).");
sw.WriteLine(" /// </summary>");
sw.WriteLine(" public override void Load()");
sw.WriteLine(" {");
sw.WriteLine(" if ({0}.CoreLoaded) return;", Properties.Bind.Default.OutputGLClass);
sw.WriteLine(" if ({0}.ExtensionsLoaded) return;", Properties.Bind.Default.OutputGLClass);
foreach (Function f in FunctionCollection)
{
if (!f.Extension)
{
if (IsImportFunction(f, import_functions))
sw.WriteLine(" {0}.{1} = new {0}.Delegates.{1}(Imports.{1});",
Properties.Bind.Default.OutputGLClass,
f.Name);
else
sw.WriteLine(" {0}.{1} = ({0}.Delegates.{1}) GetAddress(\"gl{1}\", typeof({0}.Delegates.{1}));",
Properties.Bind.Default.OutputGLClass,
f.Name);
}
}
sw.WriteLine(" CoreLoaded = true;");
sw.WriteLine(" }");
sw.WriteLine();
sw.WriteLine(" #endregion");
sw.WriteLine();
#endregion
#region Write the LoadExtensions function for the opengl extensions.
// Write the LoadExtensions function.
sw.WriteLine(" #region Load extensions");
sw.WriteLine();
sw.WriteLine(" /// <summary>");
sw.WriteLine(" /// Loads the opengl extensions (e.g. ARB, EXT, vendor and platform specific functions).");
sw.WriteLine(" /// </summary>");
sw.WriteLine(" public override void LoadExtensions()");
sw.WriteLine(" {");
foreach (Function f in FunctionCollection)
{
if (f.Extension)
sw.WriteLine(" {0}.{1} = ({0}.Delegates.{1}) GetAddress(\"gl{1}\", typeof({0}.Delegates.{1}));",
Properties.Bind.Default.OutputGLClass,
f.Name);
}
sw.WriteLine(" CoreLoaded = true;");
sw.WriteLine(" }");
sw.WriteLine();
sw.WriteLine(" #endregion");
#endregion
sw.WriteLine(" }");
sw.WriteLine("}");
sw.Flush();
sw.Close();
}
private bool IsImportFunction(Function f, string[] import_functions)
{
if (f.Extension)
return false;
foreach (string s in import_functions)
if (f.Version == s)
return true;
return false;
}
#endregion
}
}

View file

@ -0,0 +1,71 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace OpenTK.OpenGL.Bind
{
/*
partial class Process
{
#region Write Delegates.
/// <summary>
/// Writes the full list of delegates for opengl functions.
/// </summary>
/// <param name="output_path">The path where the GL class will be written to.</param>
void WriteDelegates(string output_path, string class_name)
{
if (!Directory.Exists(output_path))
Directory.CreateDirectory(output_path);
string delegates_path = Path.Combine(output_path, "GLFunctions.cs");
StreamWriter sw = new StreamWriter(delegates_path, false);
Console.WriteLine("Writing delegates to: {0}", delegates_path);
sw.WriteLine("using System;");
sw.WriteLine("using System.Runtime.InteropServices;");
sw.WriteLine("using {0};", _opengl_delegates_namespace);
sw.WriteLine();
sw.WriteLine("namespace {0}", _opengl_namespace);
sw.WriteLine("{");
sw.WriteLine(" public partial class {0}", class_name);
sw.WriteLine(" {");
sw.WriteLine(" #region OpenGL Function Declarations.");
sw.WriteLine();
foreach (Block b in BlockList)
{
sw.WriteLine(" #region {0} Functions", b.Name);
sw.WriteLine();
foreach (Function f in b.Functions)
{
//sw.WriteLine(" public static {0} {1};", f.Name, f.Name.TrimStart('g', 'l'));
if (!f.NeedsWrapper)
sw.WriteLine(" public static {0} {1};", f.Name, f.Name.TrimStart('g', 'l'));
else
sw.WriteLine(" public static {0} _{1};", f.Name, f.Name.TrimStart('g', 'l'));
}
sw.WriteLine();
sw.WriteLine(" #endregion");
sw.WriteLine();
}
sw.WriteLine(" #endregion");
sw.WriteLine(" }");
sw.WriteLine("}");
sw.Flush();
sw.Close();
}
#endregion
}
*/
}

View file

@ -0,0 +1,92 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace OpenTK.OpenGL.Bind
{
partial class Process
{
public void WriteEnums(string output_path)
{
if (!Directory.Exists(output_path))
Directory.CreateDirectory(output_path);
StreamWriter sw = new StreamWriter(Path.Combine(output_path, "GLConstants.cs"), false);
Console.WriteLine("Writing opengl constants to: {0}", output_path);
sw.WriteLine("using System;");
sw.WriteLine();
sw.WriteLine("namespace {0}", Properties.Bind.Default.OutputNamespace);
sw.WriteLine("{");
sw.WriteLine(" public static class Enums");
sw.WriteLine(" {");
WriteMissingConstants(sw);
sw.WriteLine(" #region OpenGL enums");
sw.WriteLine();
foreach (Enum e in EnumCollection.Values)
{
sw.WriteLine(e.ToString());
}
sw.WriteLine();
sw.WriteLine(" #endregion");
sw.WriteLine(" }");
sw.WriteLine("}");
sw.WriteLine();
sw.Flush();
sw.Close();
}
private void WriteMissingConstants(StreamWriter sw)
{
sw.WriteLine(" #region Missing Constants");
sw.WriteLine();
// Version 1.4 enum
sw.WriteLine(" const uint GL_FOG_COORDINATE_SOURCE = 0x8450;");
sw.WriteLine(" const uint GL_FOG_COORDINATE = 0x8451;");
sw.WriteLine(" const uint GL_CURRENT_FOG_COORDINATE = 0x8453;");
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY_TYPE = 0x8454;");
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY_STRIDE = 0x8455;");
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY_POINTER = 0x8456;");
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY = 0x8457;");
// Version 1.5 enum
sw.WriteLine(" const uint GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING = 0x889D;");
// Version 1.3 enum
sw.WriteLine(" const uint GL_SOURCE0_RGB = 0x8580;");
sw.WriteLine(" const uint GL_SOURCE1_RGB = 0x8581;");
sw.WriteLine(" const uint GL_SOURCE2_RGB = 0x8582;");
sw.WriteLine(" const uint GL_SOURCE0_ALPHA = 0x8588;");
sw.WriteLine(" const uint GL_SOURCE1_ALPHA = 0x8589;");
sw.WriteLine(" const uint GL_SOURCE2_ALPHA = 0x858A;");
// Version 2.0 enum
sw.WriteLine(" const uint GL_BLEND_EQUATION = 0x8009;");
sw.WriteLine(" const uint GL_MODELVIEW_MATRIX = 0x0BA6;");
sw.WriteLine(" const uint GL_MODELVIEW = 0x1700;");
sw.WriteLine(" const uint GL_MODELVIEW_STACK_DEPTH = 0x0BA3;");
// NV_texture_shader enum
sw.WriteLine(" const uint GL_OFFSET_TEXTURE_MATRIX_NV = 0x86E1;");
sw.WriteLine(" const uint GL_OFFSET_TEXTURE_SCALE_NV = 0x86E2;");
sw.WriteLine(" const uint GL_OFFSET_TEXTURE_BIAS_NV = 0x86E3;");
sw.WriteLine();
sw.WriteLine(" #endregion");
sw.WriteLine();
}
}
}

View file

@ -0,0 +1,71 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace OpenTK.OpenGL.Bind
{
public partial class Process
{
/// <summary>
/// Writes the Translated opengl functions and function prototypes to the static opengl class.
/// </summary>
/// <param name="output_path">The folder wherein the class will be written.</param>
public void WriteFunctions(string output_path)
{
if (!Directory.Exists(output_path))
Directory.CreateDirectory(output_path);
StreamWriter sw = new StreamWriter(Path.Combine(output_path, "GLFunctions.cs"), false);
Console.WriteLine("Writing opengl functions to: {0}", output_path);
sw.WriteLine("using System;");
sw.WriteLine("using System.Runtime.InteropServices;");
sw.WriteLine();
sw.WriteLine("namespace {0}", Properties.Bind.Default.OutputNamespace);
sw.WriteLine("{");
sw.WriteLine(" public static partial class {0}", Properties.Bind.Default.OutputGLClass);
sw.WriteLine(" {");
sw.WriteLine(" public static bool ExtensionsLoaded = false;");
sw.WriteLine(" public static bool CoreLoaded = false;");
sw.WriteLine();
sw.WriteLine(" #region OpenGL functions");
sw.WriteLine();
foreach (Function f in FunctionCollection)
{
sw.WriteLine(" public static Delegates.{0} {0};", f.Name);
}
sw.WriteLine();
sw.WriteLine(" #endregion");
sw.WriteLine();
sw.WriteLine(" #region OpenGL function prototypes");
sw.WriteLine();
sw.WriteLine(" public static class Delegates");
sw.WriteLine(" {");
foreach (Function f in FunctionCollection)
{
sw.WriteLine(" public delegate {0};", f.ToString());
}
sw.WriteLine(" }");
sw.WriteLine();
sw.WriteLine(" #endregion");
sw.WriteLine(" }");
sw.WriteLine("}");
sw.WriteLine();
sw.Flush();
sw.Close();
}
}
}

View file

@ -0,0 +1,241 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace OpenTK.OpenGL.Bind
{
partial class Process
{
#region Write Wrappers
void WriteWrappers(string output_path)
{
if (!Directory.Exists(output_path))
Directory.CreateDirectory(output_path);
output_path = Path.Combine(output_path, "GLWrappers.cs");
StreamWriter sw = new StreamWriter(output_path, false);
Console.WriteLine("Writing wrappers to {0}", output_path);
sw.WriteLine("using System;");
sw.WriteLine("using System.Runtime.InteropServices;");
sw.WriteLine();
sw.WriteLine("namespace {0}", Properties.Bind.Default.OutputNamespace);
sw.WriteLine("{");
sw.WriteLine(" public partial class {0}", Properties.Bind.Default.OutputGLClass);
sw.WriteLine(" {");
sw.WriteLine(" #region Wrappers");
sw.WriteLine();
foreach (Function fw in WrapperCollection)
{
sw.WriteLine(" // Wrapper for function {0}", fw.Name);
if (fw.Parameters.ContainsType("object"))
{
Function f = WeakNameLookup(fw.Name, FunctionCollection);
sw.WriteLine(" public {0} {1}{2}", fw.ReturnValue, fw.Name, fw.Parameters.ToString());
sw.WriteLine(" {");
int i = 0;
StringBuilder sb = new StringBuilder();
sb.Append("(");
foreach (Parameter p in fw.Parameters)
{
if (p.Type == "object")
{
sw.WriteLine(" GCHandle h{0} = GCHandle.Alloc({1}, GCHandleType.Pinned);", i, p.Name);
sb.Append("h" + i + ".AddrOfPinnedObject()" + ", ");
i++;
}
else
{
sb.Append(p.Name + ", ");
}
}
sb.Replace(", ", ")", sb.Length - 2, 2);
sw.WriteLine(" try");
sw.WriteLine(" {");
if (fw.ReturnValue == "void")
sw.WriteLine(" {0}{1};", f.Name, sb.ToString());
else
sw.WriteLine(" return {0}{1};", f.Name, sb.ToString());
sw.WriteLine(" }");
sw.WriteLine(" finally");
sw.WriteLine(" {");
while (i > 0)
{
sw.WriteLine(" h{0}.Free();", --i);
}
sw.WriteLine(" }");
sw.WriteLine(" }");
sw.WriteLine();
}
}
#region Commented out
/*
foreach (Function f in FunctionCollection)
{
if (f.NeedsWrapper)
{
sw.WriteLine(" // Wrapper for function {0}", f.Name);
if (f.ReturnValue == "IntPtr")
{
sw.WriteLine(" public {0} {1}{2}", f.ReturnValue, f.Name.TrimEnd('_'), f.Parameters.ToString());
sw.WriteLine(" {");
// sw.WriteLine(" return Marshal.PtrToStructure(_{0}{1}, new byte[]);", f.Name.TrimStart('g', 'l'), f.Parameters.GetNameString());
sw.WriteLine(" throw new NotImplementedException(\"Wrapper not implemented yet.\");");
sw.WriteLine(" }");
sw.WriteLine();
}
}
}
*/
/*
foreach (Block b in BlockCollection)
{
foreach (Function f in b.Functions)
{
if (f.NeedsWrapper)
{
sw.WriteLine(" // Wrapper for function _{0}", f.Name);
if (f.Name == "glGetString") // Wraps GLubyte* glGetString(GLenum name);
{
sw.WriteLine(" public {0} {1}{2}", "string", f.Name.TrimStart('g', 'l'), f.Parameters.ToString());
sw.WriteLine(" {");
sw.WriteLine(" return Marshal.PtrToStringAnsi(_{0}{1});", f.Name.TrimStart('g', 'l'), f.Parameters.GetNameString());
sw.WriteLine(" }");
sw.WriteLine();
}
else if (f.ReturnValue == "Array") // For the 3 functions that return a GLvoid*.
{
sw.WriteLine(" public {0} {1}{2}", f.ReturnValue, f.Name.TrimStart('g', 'l'), f.Parameters.ToString());
sw.WriteLine(" {");
// sw.WriteLine(" return Marshal.PtrToStructure(_{0}{1}, new byte[]);", f.Name.TrimStart('g', 'l'), f.Parameters.GetNameString());
sw.WriteLine(" throw new NotImplementedException(\"Wrapper not implemented yet.\");");
sw.WriteLine(" }");
sw.WriteLine();
}
else if (f.Parameters.ToString().Contains("out Object[]"))
{
sw.WriteLine(" public {0} {1}{2}", f.ReturnValue, f.Name.TrimStart('g', 'l'), f.Parameters.ToString());
sw.WriteLine(" {");
sw.WriteLine(" throw new NotImplementedException(\"Wrapper not implemented yet.\");");
sw.WriteLine(" }");
sw.WriteLine();
}
else if (f.Parameters.ToString().Contains("Object[]"))
{
sw.WriteLine(" public {0} {1}{2}", f.ReturnValue, f.Name.TrimStart('g', 'l'), f.Parameters.ToString());
sw.WriteLine(" {");
sw.WriteLine(" throw new NotImplementedException(\"Wrapper not implemented yet.\");");
sw.WriteLine(" }");
sw.WriteLine();
}
else if (f.Parameters.ToString().Contains("out Object")) // For those functions that have an Array 'out' parameter:
{
sw.WriteLine(" public {0} {1}{2}", f.ReturnValue, f.Name.TrimStart('g', 'l'), f.Parameters.ToString());
sw.WriteLine(" {");
sw.WriteLine(" throw new NotImplementedException(\"Wrapper not implemented yet.\");");
// HACK: The Array parameter is always the last one (I think)
// sw.WriteLine(" GCHandle h = GCHandle.Alloc({0}, GCHandleType.Pinned);", f.Parameters[f.Parameters.Count-1].Name);
// sw.WriteLine(" try");
// sw.WriteLine(" {");
// sw.WriteLine(" _{0}{1};", f.Name, f.ParameterNamesWithArrayRenamingString);
// sw.WriteLine(" }");
// sw.WriteLine(" finally");
// sw.WriteLine(" {");
// sw.WriteLine(" h.Free();");
// sw.WriteLine(" }");
sw.WriteLine(" }");
sw.WriteLine();
}
else if (f.Parameters.ToString().Contains("Object"))
{
sw.WriteLine(" public {0} {1}{2}", f.ReturnValue, f.Name.TrimStart('g', 'l'), f.Parameters.ToString());
sw.WriteLine(" {");
int i = 0;
StringBuilder sb = new StringBuilder();
sb.Append("(");
foreach (Parameter p in f.Parameters)
{
if (p.Type == "Object")
{
sw.WriteLine(" GCHandle h{0} = GCHandle.Alloc({1}, GCHandleType.Pinned);", i, p.Name);
sb.Append("h" + i + ".AddrOfPinnedObject()" + ", ");
i++;
}
else
{
sb.Append(p.Name + ", ");
}
}
sb.Replace(", ", ")", sb.Length - 2, 2);
sw.WriteLine(" try");
sw.WriteLine(" {");
if (f.ReturnValue == "void")
sw.WriteLine(" _{0}{1};", f.Name.TrimStart('g', 'l'), sb.ToString());
else
sw.WriteLine(" return _{0}{1};", f.Name.TrimStart('g', 'l'), sb.ToString());
sw.WriteLine(" }");
sw.WriteLine(" finally");
sw.WriteLine(" {");
while (i > 0)
{
sw.WriteLine(" h{0}.Free();", --i);
}
sw.WriteLine(" }");
sw.WriteLine(" }");
sw.WriteLine();
}
else
{
sw.WriteLine(" public {0} {1}{2}", f.ReturnValue, f.Name.TrimStart('g', 'l'), f.Parameters.ToString());
sw.WriteLine(" {");
sw.WriteLine(" throw new NotImplementedException(\"Wrapper not implemented yet.\");");
sw.WriteLine(" }");
sw.WriteLine();
}
//sw.WriteLine(" public static extern {0} {1} {2};", f.ReturnValue, f.Name.TrimStart('g', 'l'), f.ParameterString);
}
}
}
*/
#endregion
sw.WriteLine(" #endregion");
sw.WriteLine(" }");
sw.WriteLine("}");
sw.Flush();
sw.Close();
}
#endregion
Function WeakNameLookup(string name, List<Function> function_list)
{
foreach (Function f in FunctionCollection)
{
if (f.Name.Contains(name))
return f;
}
return null;
}
}
}

View file

@ -0,0 +1,33 @@
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("OpenGL binding generator")]
[assembly: AssemblyDescription("Generates OpenGL bindings for C# from the C OpenGL headers")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright © 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0d681958-ca78-4a67-b71c-ff8755488e23")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.7.2.2")]
[assembly: AssemblyFileVersion("0.7.2.2")]

View file

@ -0,0 +1,122 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenTK.OpenGL.Bind.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
internal sealed partial class Bind : global::System.Configuration.ApplicationSettingsBase {
private static Bind defaultInstance = ((Bind)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Bind())));
public static Bind Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("GL")]
public string OutputGLClass {
get {
return ((string)(this["OutputGLClass"]));
}
set {
this["OutputGLClass"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("OpenTK.OpenGL")]
public string OutputNamespace {
get {
return ((string)(this["OutputNamespace"]));
}
set {
this["OutputNamespace"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("..\\..\\Source\\OpenGL\\OpenGL\\Bindings")]
public string OutputPath {
get {
return ((string)(this["OutputPath"]));
}
set {
this["OutputPath"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("..\\..\\Specifications")]
public string InputPath {
get {
return ((string)(this["InputPath"]));
}
set {
this["InputPath"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Platform")]
public string OutputPlatformNamespace {
get {
return ((string)(this["OutputPlatformNamespace"]));
}
set {
this["OutputPlatformNamespace"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Imports")]
public string WriteInternalImportsClass {
get {
return ((string)(this["WriteInternalImportsClass"]));
}
set {
this["WriteInternalImportsClass"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Enums")]
public string OutputEnumsClass {
get {
return ((string)(this["OutputEnumsClass"]));
}
set {
this["OutputEnumsClass"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Context")]
public string OutputContextClass {
get {
return ((string)(this["OutputContextClass"]));
}
set {
this["OutputContextClass"] = value;
}
}
}
}

View file

@ -0,0 +1,28 @@
namespace OpenTK.OpenGL.Bind.Properties {
// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Bind {
public Bind() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
// this.SettingChanging += this.SettingChangingEventHandler;
//
// this.SettingsSaving += this.SettingsSavingEventHandler;
//
}
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}

View file

@ -0,0 +1,30 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="OpenTK.OpenGL.Bind.Properties" GeneratedClassName="Bind">
<Profiles />
<Settings>
<Setting Name="OutputGLClass" Type="System.String" Scope="User">
<Value Profile="(Default)">GL</Value>
</Setting>
<Setting Name="OutputNamespace" Type="System.String" Scope="User">
<Value Profile="(Default)">OpenTK.OpenGL</Value>
</Setting>
<Setting Name="OutputPath" Type="System.String" Scope="User">
<Value Profile="(Default)">..\..\Source\OpenGL\OpenGL\Bindings</Value>
</Setting>
<Setting Name="InputPath" Type="System.String" Scope="User">
<Value Profile="(Default)">..\..\Specifications</Value>
</Setting>
<Setting Name="OutputPlatformNamespace" Type="System.String" Scope="User">
<Value Profile="(Default)">Platform</Value>
</Setting>
<Setting Name="WriteInternalImportsClass" Type="System.String" Scope="User">
<Value Profile="(Default)">Imports</Value>
</Setting>
<Setting Name="OutputEnumsClass" Type="System.String" Scope="User">
<Value Profile="(Default)">Enums</Value>
</Setting>
<Setting Name="OutputContextClass" Type="System.String" Scope="User">
<Value Profile="(Default)">Context</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="OpenTK.OpenGL.Bind.Properties.Bind" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="Bind.Properties.Bind" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="OpenTK.Bind.Properties.Bind" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<OpenTK.OpenGL.Bind.Properties.Bind>
<setting name="OutputGLClass" serializeAs="String">
<value>GL</value>
</setting>
<setting name="OutputNamespace" serializeAs="String">
<value>OpenTK.OpenGL</value>
</setting>
<setting name="OutputPath" serializeAs="String">
<value>..\..\Source\OpenGL\OpenGL\Bindings</value>
</setting>
<setting name="InputPath" serializeAs="String">
<value>..\..\Specifications</value>
</setting>
<setting name="OutputPlatformNamespace" serializeAs="String">
<value>Platform</value>
</setting>
<setting name="WriteInternalImportsClass" serializeAs="String">
<value>Imports</value>
</setting>
<setting name="OutputEnumsClass" serializeAs="String">
<value>Enums</value>
</setting>
<setting name="OutputContextClass" serializeAs="String">
<value>Context</value>
</setting>
</OpenTK.OpenGL.Bind.Properties.Bind>
<Bind.Properties.Bind>
<setting name="OutputGLClass" serializeAs="String">
<value>GL</value>
</setting>
<setting name="OutputNamespace" serializeAs="String">
<value>OpenTK.OpenGL</value>
</setting>
<setting name="OutputPath" serializeAs="String">
<value>..\..\Source\OpenTK\OpenGL\Bindings</value>
</setting>
<setting name="InputPath" serializeAs="String">
<value>..\..\..\Input</value>
</setting>
<setting name="OutputPlatformNamespace" serializeAs="String">
<value>Platform</value>
</setting>
<setting name="WriteInternalImportsClass" serializeAs="String">
<value>Imports</value>
</setting>
<setting name="InputSpecFilesPath" serializeAs="String">
<value>..\..\Specifications</value>
</setting>
<setting name="OutputEnumsClass" serializeAs="String">
<value>Enums</value>
</setting>
<setting name="OutputContextClass" serializeAs="String">
<value>Context</value>
</setting>
</Bind.Properties.Bind>
<OpenTK.Bind.Properties.Bind>
<setting name="OutputGLClass" serializeAs="String">
<value>GL</value>
</setting>
<setting name="OutputNamespace" serializeAs="String">
<value>OpenTK.OpenGL</value>
</setting>
<setting name="OutputPath" serializeAs="String">
<value>..\..\Source\OpenTK\OpenGL\Bindings</value>
</setting>
<setting name="InputPath" serializeAs="String">
<value>..\..\..\Input</value>
</setting>
<setting name="OutputPlatformNamespace" serializeAs="String">
<value>Platform</value>
</setting>
<setting name="WriteInternalImportsClass" serializeAs="String">
<value>Imports</value>
</setting>
<setting name="InputSpecFilesPath" serializeAs="String">
<value>..\..\Specifications</value>
</setting>
<setting name="OutputEnumsClass" serializeAs="String">
<value>Enums</value>
</setting>
<setting name="OutputContextClass" serializeAs="String">
<value>Context</value>
</setting>
</OpenTK.Bind.Properties.Bind>
</userSettings>
</configuration>

View file

@ -0,0 +1,465 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
static class Translation
{
public static char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' };
public static char[] Whitespace = { ' ' };
public static char[] Braces = { '(', ')' };
public static char[] Comma = { ',' };
/// <summary>
/// Searches for a possible translation for the parameter given.
/// </summary>
/// <param name="str">The parameter to be translated.</param>
/// <returns>The translation of the parameter, or the parameter itself if no translation is found.</returns>
public static string Get(string str)
{
foreach (KeyValuePair<string, string> pair in translations)
if (pair.Key == str)
return pair.Value;
return str;
}
static Dictionary<string, string> parameter_names = new Dictionary<string, string>();
static Dictionary<string, string> parameter_types = new Dictionary<string, string>();
static Dictionary<string, string> old_dictionary = new Dictionary<string, string>();
#region Constructor
static Translation()
{
parameter_names.Add("base", "@base");
parameter_names.Add("object", "@object");
parameter_names.Add("string", "@string");
parameter_names.Add("ref", "reference");
parameter_names.Add("params", "parameters");
parameter_names.Add("in", "@in");
parameter_types.Add("Boolean", "bool");
parameter_types.Add("BooleanPointer", "bool[]");
parameter_types.Add("Char", "char");
parameter_types.Add("CharPointer", "string");
parameter_types.Add("CheckedFloat32", "float");
parameter_types.Add("CheckedInt32", "int");
parameter_types.Add("ClampedColorF", "float");
parameter_types.Add("ClampedFloat32", "float");
parameter_types.Add("ClampedFloat64", "double");
parameter_types.Add("ClampedStencilValue", "int");
parameter_types.Add("ColorB", "byte");
parameter_types.Add("ColorS", "short");
parameter_types.Add("ColorI", "int");
parameter_types.Add("ColorUB", "byte");
parameter_types.Add("ColorUS", "ushort");
parameter_types.Add("ColorUI", "uint");
parameter_types.Add("ColorF", "float");
parameter_types.Add("ColorD", "double");
parameter_types.Add("ColorIndexValueD", "double");
parameter_types.Add("ColorIndexValueF", "float");
parameter_types.Add("ColorIndexValueI", "int");
parameter_types.Add("ColorIndexValueS", "short");
parameter_types.Add("ColorIndexValueUB", "byte");
parameter_types.Add("CompressedTextureARB", "void");
parameter_types.Add("ControlPointNV", "void");
parameter_types.Add("CoordF", "float");
parameter_types.Add("CoordD", "double");
parameter_types.Add("CoordI", "int");
parameter_types.Add("CoordS", "short");
parameter_types.Add("FeedbackElement", "float");
parameter_types.Add("FenceNV", "uint");
/////////////////////////////////////
parameter_types.Add("Int8", "byte");
parameter_types.Add("Int16", "short");
parameter_types.Add("Int32", "int");
parameter_types.Add("UInt8", "byte");
parameter_types.Add("UInt16", "ushort");
parameter_types.Add("UInt32", "uint");
parameter_types.Add("Float32", "float");
parameter_types.Add("Float64", "double");
parameter_types.Add("ConstFloat32", "float");
parameter_types.Add("ConstInt32", "double");
parameter_types.Add("ConstUInt32", "uint");
parameter_types.Add("ConstVoid", "object");
parameter_types.Add("ConstVoidPointer", "object");
parameter_types.Add("String", "string");
parameter_types.Add("Void", "object");
parameter_types.Add("VoidPointer", "object");
parameter_types.Add("void", "void");
parameter_types.Add("Float32Pointer", "float");
parameter_types.Add("Float32Double", "double");
///////////////////////////////////////
parameter_types.Add("List", "uint");
parameter_types.Add("SizeI", "int");
parameter_types.Add("LineStipple", "ushort");
parameter_types.Add("WinCoord", "int");
parameter_types.Add("Texture", "uint");
parameter_types.Add("TextureComponentCount", "int");
parameter_types.Add("SelectName", "uint");
parameter_types.Add("MaskedColorIndexValueF", "float");
parameter_types.Add("MaskedColorIndexValueI", "uint");
parameter_types.Add("MaskedStencilValue", "uint");
parameter_types.Add("StencilValue", "int");
parameter_types.Add("DrawElementsType", "uint");
parameter_types.Add("BlendEquationMode", "Enums.BlendEquationModeEXT");
parameter_types.Add("ColorTableTarget", "Enums.ColorTableTargetSGI");
parameter_types.Add("ColorTableParameterPName", "Enums.ColorTableParameterPNameSGI");
parameter_types.Add("ConvolutionTarget", "Enums.ConvolutionTargetEXT");
parameter_types.Add("ConvolutionParameter", "Enums.ConvolutionParameterEXT");
parameter_types.Add("GetColorTableParameterPName", "Enums.GetColorTableParameterPNameSGI");
parameter_types.Add("GetConvolutionParameterPName", "Enums.GetConvolutionParameter"); // May not be correct, but was the closest I could find.
parameter_types.Add("SeparableTarget", "Enums.SeparableTargetEXT");
parameter_types.Add("HistogramTarget", "Enums.HistogramTargetEXT");
parameter_types.Add("GetHistogramParameterPName", "Enums.GetHistogramParameterPNameEXT");
parameter_types.Add("MinmaxTarget", "Enums.MinmaxTargetEXT");
parameter_types.Add("GetMinmaxParameterPName", "Enums.GetMinmaxParameterPNameEXT");
parameter_types.Add("TextureUnit", "uint");
parameter_types.Add("BlendFuncSeparateParameterEXT", "uint");
parameter_types.Add("FogPointerTypeEXT", "uint");
parameter_types.Add("PointParameterNameARB", "Enums.PointParameterNameSGIS");
parameter_types.Add("GLenum", "uint");
parameter_types.Add("VertexBufferTargetARB", "uint");
parameter_types.Add("VertexBufferUsageARB", "uint");
parameter_types.Add("VertexBufferSize", "IntPtr");
parameter_types.Add("VertexBufferOffset", "IntPtr");
parameter_types.Add("VertexBufferPNameARB", "uint");
parameter_types.Add("VertexBufferAccessARB", "uint");
parameter_types.Add("VertexBufferPointerNameARB", "uint");
parameter_types.Add("VertexAttribPropertyARB", "uint");
parameter_types.Add("VertexAttribPointerPropertyARB", "uint");
parameter_types.Add("VertexAttribPointerTypeARB", "uint");
parameter_types.Add("VertexBufferSizeARB", "IntPtr");
parameter_types.Add("VertexBufferOffsetARB", "IntPtr");
parameter_types.Add("DrawBufferModeATI", "Enums.DrawBufferMode");
parameter_types.Add("StencilFaceDirection", "uint");
parameter_types.Add("WeightPointerTypeARB", "uint");
parameter_types.Add("MatrixIndexPointerTypeARB", "uint");
parameter_types.Add("ProgramFormatARB", "uint");
parameter_types.Add("ProgramPropertyARB", "uint");
parameter_types.Add("ProgramTargetARB", "uint");
parameter_types.Add("ProgramStringPropertyARB", "uint");
parameter_types.Add("handleARB", "uint");
parameter_types.Add("charARB", "char"); // Maybe this should be byte?
parameter_types.Add("charPointerARB", "string");
parameter_types.Add("ClampColorTargetARB", "uint");
parameter_types.Add("ClampColorModeARB", "uint");
parameter_types.Add("TextureFilterSGIS", "uint");
parameter_types.Add("PixelTexGenModeSGIX", "uint");
parameter_types.Add("SpriteParameterNameSGIX", "uint");
parameter_types.Add("ImageTransformTargetHP", "uint");
parameter_types.Add("ImageTransformPNameHP", "uint");
parameter_types.Add("HintTargetPGI", "uint");
parameter_types.Add("IndexMaterialParameterEXT", "uint");
parameter_types.Add("IndexFunctionEXT", "uint");
parameter_types.Add("CullParameterEXT", "uint");
parameter_types.Add("FragmentLightParameterSGIX", "uint");
parameter_types.Add("FragmentLightNameSGIX", "uint");
parameter_types.Add("LightTextureModeEXT", "uint");
parameter_types.Add("LightTexturePNameEXT", "uint");
parameter_types.Add("PixelTransformTargetEXT", "uint");
parameter_types.Add("PixelTransformPNameEXT", "uint");
parameter_types.Add("TextureNormalModeEXT", "uint");
parameter_types.Add("TangentPointerTypeEXT", "uint");
parameter_types.Add("BinormalPointerTypeEXT", "uint");
parameter_types.Add("ReplacementCodeTypeSUN", "uint");
parameter_types.Add("ReplacementCodeSUN", "uint");
parameter_types.Add("VertexWeightPointerTypeEXT", "uint");
parameter_types.Add("CombinerParameterNV", "uint");
parameter_types.Add("CombinerMappingNV", "uint");
parameter_types.Add("CombinerPortionNV", "uint");
parameter_types.Add("CombinerRegisterNV", "uint");
parameter_types.Add("CombinerStageNV", "uint");
parameter_types.Add("CombinerVariableNV", "uint");
parameter_types.Add("CombinerScaleNV", "uint");
parameter_types.Add("CombinerBiasNV", "uint");
parameter_types.Add("CombinerComponentUsageNV", "uint");
parameter_types.Add("SecondaryColorPointerTypeIBM", "uint");
parameter_types.Add("FogPointerTypeIBM", "uint");
parameter_types.Add("SamplePatternEXT", "uint");
parameter_types.Add("IglooParameterSGIX", "object");
parameter_types.Add("IglooFunctionSelectSGIX", "uint");
parameter_types.Add("FenceParameterNameNV", "uint");
parameter_types.Add("FenceConditionNV", "uint");
parameter_types.Add("MapTypeNV", "uint");
parameter_types.Add("EvalTargetNV", "uint");
parameter_types.Add("MapParameterNV", "uint");
parameter_types.Add("MapAttribParameterNV", "uint");
parameter_types.Add("EvalMapsModeNV", "uint");
parameter_types.Add("VertexAttribEnumNV", "uint");
parameter_types.Add("ProgramCharacterNV", "uint");
parameter_types.Add("TexBumpParameterATI", "uint");
parameter_types.Add("GetTexBumpParameterATI", "uint");
parameter_types.Add("SwizzleOpATI", "uint");
parameter_types.Add("FragmentOpATI", "uint");
parameter_types.Add("PNTrianglesPNameATI", "uint");
parameter_types.Add("ArrayObjectUsageATI", "uint");
parameter_types.Add("PreserveModeATI", "uint");
parameter_types.Add("ArrayObjectPNameATI", "uint");
parameter_types.Add("ScalarType", "uint");
parameter_types.Add("VertexShaderOpEXT", "uint");
parameter_types.Add("VertexShaderCoordOutEXT", "uint");
parameter_types.Add("VertexShaderWriteMaskEXT", "uint");
parameter_types.Add("ParameterRangeEXT", "uint");
parameter_types.Add("DataTypeEXT", "uint");
parameter_types.Add("VertexShaderStorageTypeEXT", "uint");
parameter_types.Add("VertexShaderTextureUnitParameter", "uint");
parameter_types.Add("VertexShaderParameterEXT", "uint");
parameter_types.Add("VariantCapEXT", "uint");
parameter_types.Add("GetVariantValueEXT", "uint");
parameter_types.Add("VertexStreamATI", "uint");
parameter_types.Add("ElementPointerTypeATI", "uint");
parameter_types.Add("OcclusionQueryParameterNameNV", "uint");
parameter_types.Add("ObjectTypeAPPLE", "uint");
parameter_types.Add("VertexArrayPNameAPPLE", "uint");
parameter_types.Add("Half16NV", "ushort");
parameter_types.Add("PixelDataRangeTargetNV", "uint");
//parameter_types.Add("", "");
//parameter_types.Add("", "");
//parameter_types.Add("", "");
//parameter_types.Add("", "");
//parameter_types.Add("", "");
//parameter_types.Add("", "");
//parameter_types.Add("", "");
//parameter_types.Add("", "");
}
#endregion
#region Old key pairs
static KeyValuePair<string, string>[] translations = new KeyValuePair<string, string>[]
{
// Pointer types.
//new KeyValuePair<string, string>("GLhandleARB*", "IntPtr"),
//new KeyValuePair<string, string>("GLhalfARB*", "IntPtr"),
//new KeyValuePair<string, string>("GLhalfNV*", "IntPtr"),
//new KeyValuePair<string, string>("GLcharARB*", "IntPtr"),
//new KeyValuePair<string, string>("GLenum*", "IntPtr"),
//new KeyValuePair<string, string>("GLboolean*", "IntPtr"),
//new KeyValuePair<string, string>("GLbitfield*", "IntPtr"),
//new KeyValuePair<string, string>("GLvoid*", "IntPtr"),
//new KeyValuePair<string, string>("GLchar*", "IntPtr"),
//new KeyValuePair<string, string>("GLbyte*", "IntPtr"),
//new KeyValuePair<string, string>("GLshort*", "IntPtr"),
//new KeyValuePair<string, string>("GLint*", "IntPtr"),
//new KeyValuePair<string, string>("GLubyte*", "IntPtr"),
//new KeyValuePair<string, string>("GLushort*", "IntPtr"),
//new KeyValuePair<string, string>("GLuint*", "IntPtr"),
//new KeyValuePair<string, string>("GLsizei*", "IntPtr"),
//new KeyValuePair<string, string>("GLfloat*", "IntPtr"),
//new KeyValuePair<string, string>("GLclampf*", "IntPtr"),
//new KeyValuePair<string, string>("GLdouble*", "IntPtr"),
//new KeyValuePair<string, string>("GLclampd*", "IntPtr"),
new KeyValuePair<string, string>("GLvoid*", "Array"),
// ARB and NV types (these should come before normal types to guard against double translation).
new KeyValuePair<string, string>("GLsizeiptrARB", "IntPtr"),
new KeyValuePair<string, string>("GLintptrARB", "IntPtr"),
new KeyValuePair<string, string>("GLhandleARB", "uint"),
new KeyValuePair<string, string>("GLhalfARB", "ushort"),
new KeyValuePair<string, string>("GLhalfNV", "ushort"),
new KeyValuePair<string, string>("GLcharARB", "char"),
// Normal types.
new KeyValuePair<string, string>("GLsizeiptr", "IntPtr"),
new KeyValuePair<string, string>("GLintptr", "IntPtr"),
new KeyValuePair<string, string>("GLenum", "uint"),
new KeyValuePair<string, string>("GLboolean", "bool"),
new KeyValuePair<string, string>("GLbitfield", "uint"),
new KeyValuePair<string, string>("GLvoid", "void"),
new KeyValuePair<string, string>("GLchar", "char"),
new KeyValuePair<string, string>("GLbyte", "sbyte"),
new KeyValuePair<string, string>("GLshort", "short"),
new KeyValuePair<string, string>("GLint", "int"),
new KeyValuePair<string, string>("GLubyte", "byte"),
new KeyValuePair<string, string>("GLushort", "ushort"),
new KeyValuePair<string, string>("GLuint", "uint"),
new KeyValuePair<string, string>("GLsizei", "int"),
new KeyValuePair<string, string>("GLfloat", "float"),
new KeyValuePair<string, string>("GLclampf", "float"),
new KeyValuePair<string, string>("GLdouble", "double"),
new KeyValuePair<string, string>("GLclampd", "double"),
new KeyValuePair<string, string>("void", "void"), // For return parameters.
// Special.
//new KeyValuePair<string, string>("*", "[]"),
new KeyValuePair<string, string>("const", String.Empty),
// Since we cannot marshal nested arrays...
//new KeyValuePair<string, string>("char[][]", "string[]"),
//new KeyValuePair<string, string>("#define", "const uint "),
//new KeyValuePair<string, string>(" *", "[] "),
//new KeyValuePair<string, string>("GLAPI", String.Empty),
//new KeyValuePair<string, string>("APIENTRY", String.Empty),
//new KeyValuePair<string, string>("APIENTRYP", String.Empty),
//new KeyValuePair<string, string>("\n", ""),
//new KeyValuePair<string, string>(" out", " output"),
//new KeyValuePair<string, string>(" ", " "),
};
#endregion
#region Translate function list
public static void Translate(List<Function> function_list, List<Function> wrapper_list)
{
string s;
foreach (Function f in function_list)
{
Function wf = new Function();
wf.ReturnValue = f.ReturnValue;
wf.Name = f.Name;
if (parameter_types.TryGetValue(f.ReturnValue, out s))
f.ReturnValue = s;
else
f.ReturnValue = "Enums." + f.ReturnValue;
// You may not marshal by return type (the return type must be defined).
if (f.ReturnValue == "object")
{
f.ReturnValue = "IntPtr";
wf.ReturnValue = "object";
f.NeedsWrapper = true;
}
foreach (Parameter p in f.Parameters)
{
Parameter wp = new Parameter();
wp.Name = p.Name;
wp.Type = p.Type;
wp.Array = p.Array;
wp.Flow = p.Flow;
wf.Parameters.Add(wp);
if (parameter_names.TryGetValue(p.Name, out s))
{
p.Name = s;
wp.Name = s;
}
if (parameter_types.TryGetValue(p.Type, out s))
{
p.Type = s;
wp.Type = s;
}
else
{
p.Type = "Enums." + p.Type;
wp.Type = p.Type;
}
if (p.Type == "object")
{
p.Array = false;
p.Type = "object";
p.UnmanagedType = System.Runtime.InteropServices.UnmanagedType.AsAny;
//p.Type = "IntPtr";
//wp.Array = false;
//f.NeedsWrapper = true;
}
if (p.Type == "void" && p.Array)
{
p.Array = false;
p.Type = "object";
p.UnmanagedType = System.Runtime.InteropServices.UnmanagedType.AsAny;
//p.Type = "IntPtr";
//wp.Type = "object";
//wp.Array = true;
//f.NeedsWrapper = true;
}
if (p.Array)
{
p.Type = p.Type + "[]";
wp.Type = wp.Type + "[]";
}
//if (p.Flow == Parameter.FlowDirection.Out && p.Type.Contains("string"))
// p.Type.Replace("string", "StringBuilder");
if (p.Type.Contains("[][]"))
{
p.Type = "ref " + p.Type.Replace("[][]", "[]");
wp.Type = "ref " + wp.Type.Replace("[][]", "[]");
}
}
if (f.NeedsWrapper)
{
f.Name = f.Name + "_";
wrapper_list.Add(wf);
}
}
}
#endregion
#region Translate enum hashtable
public static void Translate(System.Collections.Hashtable e_table)
{
foreach (Enum e in e_table.Values)
{
if (Char.IsDigit(e.Name[0]))
e.Name = e.Name.Insert(0, "_");
if (e.Name == "Boolean")
continue;
foreach (Constant c in e.ConstantCollection.Values)
{
if (Char.IsDigit(c.Name[0]))
c.Name = c.Name.Insert(0, "_");
if (c.Value.Contains(".") && Char.IsDigit(c.Value[c.Value.IndexOf('.') + 1]))
c.Value = c.Value.Insert(c.Value.IndexOf('.') + 1, "_");
}
}
}
#endregion
}
}

View file

@ -0,0 +1,4 @@
..\Binaries\Debug\Bind.exe.config
$(SolutionDir)Binaries\Debug\Bind.exe.config
$(SolutionDir)Binaries\Debug\Bind.exe
$(SolutionDir)Binaries\Debug\Bind.pdb

View file

@ -0,0 +1,3 @@
..\..\Binaries\Debug\OpenTK.OpenGL.Bind.exe.config
..\..\Binaries\Debug\OpenTK.OpenGL.Bind.exe
..\..\Binaries\Debug\OpenTK.OpenGL.Bind.pdb

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
using System;
using System.Runtime.InteropServices;
namespace OpenTK.OpenGL
{
public partial class GL
{
#region Wrappers
// Wrapper for function MapBuffer
// Wrapper for function MapBufferARB
// Wrapper for function MapObjectBufferATI
#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

View file

@ -0,0 +1,48 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OpenTK.OpenGL.Platform;
namespace OpenTK.OpenGL
{
public abstract partial class Context : IDisposable
{
public bool CoreLoaded = false;
public bool ExtensionsLoaded = false;
public abstract void SwapBuffers();
public abstract System.Delegate GetAddress(string function_string, Type function_type);
public abstract void MakeCurrent();
public abstract void Load();
public abstract void LoadExtensions();
public abstract void Dispose();
public static Context Create(Control c, int red, int green, int blue, int alpha, int depth, int stencil, bool fullscreen)
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major < 6 ||
Environment.OSVersion.Platform == PlatformID.Win32Windows)
{
return new WindowsContext(c, red, green, blue, alpha, depth, stencil, fullscreen);
}
else if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6)
{
return new WindowsVistaContext(c, red, green, blue, alpha, depth, stencil, fullscreen);
}
else if (Environment.OSVersion.Platform == PlatformID.Unix)
{
return new X11Context(c, red, green, blue, alpha, depth, stencil, fullscreen);
}
else
{
throw new PlatformNotSupportedException("The platform on which you are trying to run this program is not currently supported. Sorry for the inconvenience.");
}
}
}
}

View file

@ -0,0 +1,139 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using OpenTK.OpenGL;
using System.Runtime.InteropServices;
namespace OpenTK.OpenGL.Platform
{
public partial class WindowsContext : OpenTK.OpenGL.Context
{
const string _dll_name = "OPENGL32.DLL";
int _dll_handle;
int _device_context;
int _render_context;
IntPtr _window_handle;
public WindowsContext(Control c, int red, int green, int blue, int alpha, int depth, int stencil, bool fullscreen)
{
bool load_extensions = false;
int error_code = 0;
_window_handle = c.Handle;
// Dynamically load the OpenGL32.dll in order to use the extension loading capabilities of Wgl.
if (_dll_handle == 0)
{
_dll_handle = OpenTK.Platform.Windows.Api.LoadLibrary(_dll_name);
error_code = Marshal.GetLastWin32Error();
if (error_code != 0)
{
Console.WriteLine("LoadLibrary({0}) set error code: {1}. Will not load extensions.", _dll_name, error_code);
}
else
{
Console.WriteLine("Loaded dll: {0}", _dll_name);
load_extensions = true;
}
}
_device_context = OpenTK.Platform.Windows.Api.GetDC(_window_handle.ToInt32());
OpenTK.Platform.Windows.Api.PixelFormatDescriptor pixel_format = new OpenTK.Platform.Windows.Api.PixelFormatDescriptor();
pixel_format.ColorBits = (byte)(red + green + blue);
pixel_format.RedBits = (byte)red;
pixel_format.GreenBits = (byte)green;
pixel_format.BlueBits = (byte)blue;
pixel_format.AlphaBits = (byte)alpha;
pixel_format.DepthBits = (byte)depth;
pixel_format.StencilBits = (byte)stencil;
/*
pixel_format.AccumBits = (byte)(AccumRed + AccumGreen + AccumBlue);
pixel_format.AccumRedBits = (byte)AccumRed;
pixel_format.AccumGreenBits = (byte)AccumGreen;
pixel_format.AccumBlueBits = (byte)AccumBlue;
pixel_format.AccumAlphaBits = (byte)AccumAlpha;
*/
if (depth <= 0)
{
pixel_format.Flags |= OpenTK.Platform.Windows.Api.PixelFormatDescriptorFlags.DEPTH_DONTCARE;
}
/*
if (Stereo)
{
pixel_format.Flags |= OpenTK.Platform.Windows.Api.PixelFormatDescriptorFlags.STEREO;
}
*/
/*
if (DoubleBuffer)
{
pixel_format.Flags |= OpenTK.Platform.Windows.Api.PixelFormatDescriptorFlags.DOUBLEBUFFER;
}
*/
int pixel = OpenTK.Platform.Windows.Api.ChoosePixelFormat(_device_context, pixel_format);
if (pixel == 0)
{
// "The pixel format requested is not supported by the hardware configuration."
throw new Exception("Pixel format not supported.");
}
OpenTK.Platform.Windows.Api.SetPixelFormat(_device_context, pixel, pixel_format);
_render_context = Wgl.CreateContext(_device_context);
MakeCurrent();
Load();
if (load_extensions)
LoadExtensions();
}
public override void SwapBuffers()
{
OpenTK.Platform.Windows.Api.SwapBuffers(_device_context);
}
public override Delegate GetAddress(string function_string, Type function_type)
{
int address = Wgl.GetProcAddress(function_string);
if (address == 0)
return null;
else
return Marshal.GetDelegateForFunctionPointer(new IntPtr(address), function_type);
}
public override void MakeCurrent()
{
Wgl.MakeCurrent(_device_context, _render_context);
}
public override void Dispose()
{
if (_render_context != 0)
Wgl.DeleteContext(_render_context);
if (_device_context != 0)
OpenTK.Platform.Windows.Api.ReleaseDC(_window_handle.ToInt32(), _device_context);
if (_dll_handle != 0)
OpenTK.Platform.Windows.Api.FreeLibrary(_dll_handle);
_render_context = 0;
_device_context = 0;
_dll_handle = 0;
}
}
}

View file

@ -0,0 +1,139 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using OpenTK.OpenGL;
namespace OpenTK.OpenGL.Platform
{
public partial class WindowsVistaContext : OpenTK.OpenGL.Context
{
const string _dll_name = "OPENGL32.DLL";
int _dll_handle;
int _device_context;
int _render_context;
IntPtr _window_handle;
public WindowsVistaContext(Control c, int red, int green, int blue, int alpha, int depth, int stencil, bool fullscreen)
{
bool load_extensions = false;
int error_code = 0;
_window_handle = c.Handle;
// Dynamically load the OpenGL32.dll in order to use the extension loading capabilities of Wgl.
if (_dll_handle == 0)
{
_dll_handle = OpenTK.Platform.Windows.Api.LoadLibrary(_dll_name);
error_code = Marshal.GetLastWin32Error();
if (error_code != 0)
{
Console.WriteLine("LoadLibrary({0}) set error code: {1}. Will not load extensions.", _dll_name, error_code);
}
else
{
Console.WriteLine("Loaded dll: {0}", _dll_name);
load_extensions = true;
}
}
_device_context = OpenTK.Platform.Windows.Api.GetDC(_window_handle.ToInt32());
OpenTK.Platform.Windows.Api.PixelFormatDescriptor pixel_format = new OpenTK.Platform.Windows.Api.PixelFormatDescriptor();
pixel_format.ColorBits = (byte)(red + green + blue);
pixel_format.RedBits = (byte)red;
pixel_format.GreenBits = (byte)green;
pixel_format.BlueBits = (byte)blue;
pixel_format.AlphaBits = (byte)alpha;
pixel_format.DepthBits = (byte)depth;
pixel_format.StencilBits = (byte)stencil;
/*
pixel_format.AccumBits = (byte)(AccumRed + AccumGreen + AccumBlue);
pixel_format.AccumRedBits = (byte)AccumRed;
pixel_format.AccumGreenBits = (byte)AccumGreen;
pixel_format.AccumBlueBits = (byte)AccumBlue;
pixel_format.AccumAlphaBits = (byte)AccumAlpha;
*/
if (depth <= 0)
{
pixel_format.Flags |= OpenTK.Platform.Windows.Api.PixelFormatDescriptorFlags.DEPTH_DONTCARE;
}
/*
if (Stereo)
{
pixel_format.Flags |= OpenTK.Platform.Windows.Api.PixelFormatDescriptorFlags.STEREO;
}
*/
/*
if (DoubleBuffer)
{
pixel_format.Flags |= OpenTK.Platform.Windows.Api.PixelFormatDescriptorFlags.DOUBLEBUFFER;
}
*/
int pixel = OpenTK.Platform.Windows.Api.ChoosePixelFormat(_device_context, pixel_format);
if (pixel == 0)
{
// "The pixel format requested is not supported by the hardware configuration."
throw new Exception("Pixel format not supported.");
}
OpenTK.Platform.Windows.Api.SetPixelFormat(_device_context, pixel, pixel_format);
_render_context = Wgl.CreateContext(_device_context);
MakeCurrent();
Load();
if (load_extensions)
LoadExtensions();
}
public override void SwapBuffers()
{
OpenTK.Platform.Windows.Api.SwapBuffers(_device_context);
}
public override Delegate GetAddress(string function_string, Type function_type)
{
int address = Wgl.GetProcAddress(function_string);
if (address == 0)
return null;
else
return Marshal.GetDelegateForFunctionPointer(new IntPtr(address), function_type);
}
public override void MakeCurrent()
{
Wgl.MakeCurrent(_device_context, _render_context);
}
public override void Dispose()
{
if (_render_context != 0)
Wgl.DeleteContext(_render_context);
if (_device_context != 0)
OpenTK.Platform.Windows.Api.ReleaseDC(_window_handle.ToInt32(), _device_context);
if (_dll_handle != 0)
OpenTK.Platform.Windows.Api.FreeLibrary(_dll_handle);
_render_context = 0;
_device_context = 0;
_dll_handle = 0;
}
}
}

View file

@ -0,0 +1,41 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace OpenTK.OpenGL.Platform
{
public partial class X11Context : OpenTK.OpenGL.Context
{
public X11Context(Control c, int red, int green, int blue, int alpha, int depth, int stencil, bool fullscreen)
{
throw new Exception("The method or operation is not implemented.");
}
public override void SwapBuffers()
{
throw new Exception("The method or operation is not implemented.");
}
public override Delegate GetAddress(string function_string, Type function_type)
{
throw new Exception("The method or operation is not implemented.");
}
public override void MakeCurrent()
{
throw new Exception("The method or operation is not implemented.");
}
const string _dll_name = "opengl.so";
public override void Dispose()
{
throw new Exception("The method or operation is not implemented.");
}
}
}

View file

@ -0,0 +1,68 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OpenTK.OpenGL
{
/// <summary>
/// Provides access to GLU functions.
/// </summary>
public class Glu
{
#region GLU functions
private const string GLUDLLName = "GLU32.DLL";
[DllImport(GLUDLLName, EntryPoint = "gluOrtho2D")]
private static extern IntPtr ErrorString_(int errCode);
[DllImport(GLUDLLName, EntryPoint = "gluGetString")]
private static extern IntPtr GetString_(int errCode);
[DllImport(GLUDLLName, EntryPoint = "gluOrtho2D")]
public static extern void Ortho2D(double left, double right, double bottom, double top);
[DllImport(GLUDLLName, EntryPoint = "gluPerspective")]
public static extern void Perspective(double fovy, double aspect, double zNear, double zFar);
[DllImport(GLUDLLName, EntryPoint = "gluPickMatrix")]
public static extern void PickMatrix(double x, double y, double width, double height, int[] viewport);
[DllImport(GLUDLLName, EntryPoint = "gluLookAt")]
public static extern void LookAt(double eyex, double eyey, double eyez, double centerx, double centery, double centerz, double upx, double upy, double upz);
[DllImport(GLUDLLName, EntryPoint = "gluProject")]
public static extern void Project(double objx, double objy, double objz, double[] modelMatrix, double[] projMatrix, int[] viewport, out double winx, out double winy, out double winz);
[DllImport(GLUDLLName, EntryPoint = "gluUnProject")]
public static extern void UnProject(double winx, double winy, double winz, double[] modelMatrix, double[] projMatrix, int[] viewport, out double objx, out double objy, out double objz);
[DllImport(GLUDLLName, EntryPoint = "ScaleImage")]
public static extern void ScaleImage(int format, int widthin, int heightin, int typein, IntPtr datain, int widthout, int heightout, int typeout, IntPtr dataout);
[DllImport(GLUDLLName, EntryPoint = "gluBuild1DMipmaps")]
public static extern int Build1DMipmaps(int target, int components, int width, int format, int type, IntPtr data);
[DllImport(GLUDLLName, EntryPoint = "gluBuild2DMipmaps")]
public static extern int Build2DMipmaps(int target, int components, int width, int height, int format, int type, IntPtr data);
public static string GetString(int name)
{
IntPtr i = GetString_(name);
return Marshal.PtrToStringAnsi(i);
}
public static string ErrorString(int name)
{
IntPtr i = ErrorString_(name);
return Marshal.PtrToStringAnsi(i);
}
#endregion
}
}

View file

@ -0,0 +1,77 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{836876D1-0C8D-4240-BEE4-859D9D3D46CB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenTK.OpenGL</RootNamespace>
<AssemblyName>OpenTK.OpenGL</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\Binaries\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\Binaries\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll</HintPath>
</Reference>
<Reference Include="System.Data">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="System.Xml">
<HintPath>H:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Glu.cs" />
<Compile Include="Bindings\GLConstants.cs" />
<Compile Include="Bindings\GLFunctions.cs" />
<Compile Include="Bindings\GLWrappers.cs" />
<Compile Include="Bindings\WindowsContextLoad.cs" />
<Compile Include="Bindings\WindowsVistaContextLoad.cs" />
<Compile Include="Bindings\X11ContextLoad.cs" />
<Compile Include="Contexts\Context.cs" />
<Compile Include="Contexts\WindowsContext.cs" />
<Compile Include="Contexts\WindowsVistaContext.cs" />
<Compile Include="Contexts\X11Context.cs" />
<Compile Include="Wgl.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Platform\Windows\OpenTK.Platform.Windows.csproj">
<Project>{FDFA00B6-FA81-4658-86E1-F312EFB42E1C}</Project>
<Name>OpenTK.Platform.Windows</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenGL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenGL")]
[assembly: AssemblyCopyright("Copyright © 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e5ebd2db-1947-40a5-9fd7-2a2159b85bff")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.3.1.0")]
[assembly: AssemblyFileVersion("0.3.1.0")]

246
Source/OpenGL/OpenGL/Wgl.cs Normal file
View file

@ -0,0 +1,246 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OpenTK.OpenGL
{
/// <summary>
/// Provides access to WGL functions.
/// </summary>
public class Wgl
{
const string _dll_name = "OPENGL32.DLL";
/// <summary>
/// Contains all WGL constants.
/// </summary>
public class Constant
{
#region WGL constants.
public const int WGLEXT_VERSION = 4;
public const int FRONT_COLOR_BUFFER_BIT_ARB = 0x00000001;
public const int BACK_COLOR_BUFFER_BIT_ARB = 0x00000002;
public const int DEPTH_BUFFER_BIT_ARB = 0x00000004;
public const int STENCIL_BUFFER_BIT_ARB = 0x00000008;
public const int SAMPLE_BUFFERS_ARB = 0x2041;
public const int SAMPLES_ARB = 0x2042;
public const int NUMBER_PIXEL_FORMATS_ARB = 0x2000;
public const int DRAW_TO_WINDOW_ARB = 0x2001;
public const int DRAW_TO_BITMAP_ARB = 0x2002;
public const int ACCELERATION_ARB = 0x2003;
public const int NEED_PALETTE_ARB = 0x2004;
public const int NEED_SYSTEM_PALETTE_ARB = 0x2005;
public const int SWAP_LAYER_BUFFERS_ARB = 0x2006;
public const int SWAP_METHOD_ARB = 0x2007;
public const int NUMBER_OVERLAYS_ARB = 0x2008;
public const int NUMBER_UNDERLAYS_ARB = 0x2009;
public const int TRANSPARENT_ARB = 0x200A;
public const int TRANSPARENT_RED_VALUE_ARB = 0x2037;
public const int TRANSPARENT_GREEN_VALUE_ARB = 0x2038;
public const int TRANSPARENT_BLUE_VALUE_ARB = 0x2039;
public const int TRANSPARENT_ALPHA_VALUE_ARB = 0x203A;
public const int TRANSPARENT_INDEX_VALUE_ARB = 0x203B;
public const int SHARE_DEPTH_ARB = 0x200C;
public const int SHARE_STENCIL_ARB = 0x200D;
public const int SHARE_ACCUM_ARB = 0x200E;
public const int SUPPORT_GDI_ARB = 0x200F;
public const int SUPPORT_OPENGL_ARB = 0x2010;
public const int DOUBLE_BUFFER_ARB = 0x2011;
public const int STEREO_ARB = 0x2012;
public const int PIXEL_TYPE_ARB = 0x2013;
public const int COLOR_BITS_ARB = 0x2014;
public const int RED_BITS_ARB = 0x2015;
public const int RED_SHIFT_ARB = 0x2016;
public const int GREEN_BITS_ARB = 0x2017;
public const int GREEN_SHIFT_ARB = 0x2018;
public const int BLUE_BITS_ARB = 0x2019;
public const int BLUE_SHIFT_ARB = 0x201A;
public const int ALPHA_BITS_ARB = 0x201B;
public const int ALPHA_SHIFT_ARB = 0x201C;
public const int ACCUM_BITS_ARB = 0x201D;
public const int ACCUM_RED_BITS_ARB = 0x201E;
public const int ACCUM_GREEN_BITS_ARB = 0x201F;
public const int ACCUM_BLUE_BITS_ARB = 0x2020;
public const int ACCUM_ALPHA_BITS_ARB = 0x2021;
public const int DEPTH_BITS_ARB = 0x2022;
public const int STENCIL_BITS_ARB = 0x2023;
public const int AUX_BUFFERS_ARB = 0x2024;
public const int NO_ACCELERATION_ARB = 0x2025;
public const int GENERIC_ACCELERATION_ARB = 0x2026;
public const int FULL_ACCELERATION_ARB = 0x2027;
public const int SWAP_EXCHANGE_ARB = 0x2028;
public const int SWAP_COPY_ARB = 0x2029;
public const int SWAP_UNDEFINED_ARB = 0x202A;
public const int TYPE_RGBA_ARB = 0x202B;
public const int TYPE_COLORINDEX_ARB = 0x202C;
public const int ERROR_INVALID_PIXEL_TYPE_ARB = 0x2043;
public const int ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = 0x2054;
public const int DRAW_TO_PBUFFER_ARB = 0x202D;
public const int MAX_PBUFFER_PIXELS_ARB = 0x202E;
public const int MAX_PBUFFER_WIDTH_ARB = 0x202F;
public const int MAX_PBUFFER_HEIGHT_ARB = 0x2030;
public const int PBUFFER_LARGEST_ARB = 0x2033;
public const int PBUFFER_WIDTH_ARB = 0x2034;
public const int PBUFFER_HEIGHT_ARB = 0x2035;
public const int PBUFFER_LOST_ARB = 0x2036;
public const int BIND_TO_TEXTURE_RGB_ARB = 0x2070;
public const int BIND_TO_TEXTURE_RGBA_ARB = 0x2071;
public const int TEXTURE_FORMAT_ARB = 0x2072;
public const int TEXTURE_TARGET_ARB = 0x2073;
public const int MIPMAP_TEXTURE_ARB = 0x2074;
public const int TEXTURE_RGB_ARB = 0x2075;
public const int TEXTURE_RGBA_ARB = 0x2076;
public const int NO_TEXTURE_ARB = 0x2077;
public const int TEXTURE_CUBE_MAP_ARB = 0x2078;
public const int TEXTURE_1D_ARB = 0x2079;
public const int TEXTURE_2D_ARB = 0x207A;
public const int MIPMAP_LEVEL_ARB = 0x207B;
public const int CUBE_MAP_FACE_ARB = 0x207C;
public const int TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 0x207D;
public const int TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 0x207E;
public const int TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 0x207F;
public const int TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 0x2080;
public const int TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 0x2081;
public const int TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 0x2082;
public const int FRONT_LEFT_ARB = 0x2083;
public const int FRONT_RIGHT_ARB = 0x2084;
public const int BACK_LEFT_ARB = 0x2085;
public const int BACK_RIGHT_ARB = 0x2086;
public const int AUX0_ARB = 0x2087;
public const int AUX1_ARB = 0x2088;
public const int AUX2_ARB = 0x2089;
public const int AUX3_ARB = 0x208A;
public const int AUX4_ARB = 0x208B;
public const int AUX5_ARB = 0x208C;
public const int AUX6_ARB = 0x208D;
public const int AUX7_ARB = 0x208E;
public const int AUX8_ARB = 0x208F;
public const int AUX9_ARB = 0x2090;
public const int ERROR_INVALID_PIXEL_TYPE_EXT = 0x2043;
public const int NUMBER_PIXEL_FORMATS_EXT = 0x2000;
public const int DRAW_TO_WINDOW_EXT = 0x2001;
public const int DRAW_TO_BITMAP_EXT = 0x2002;
public const int ACCELERATION_EXT = 0x2003;
public const int NEED_PALETTE_EXT = 0x2004;
public const int NEED_SYSTEM_PALETTE_EXT = 0x2005;
public const int SWAP_LAYER_BUFFERS_EXT = 0x2006;
public const int SWAP_METHOD_EXT = 0x2007;
public const int NUMBER_OVERLAYS_EXT = 0x2008;
public const int NUMBER_UNDERLAYS_EXT = 0x2009;
public const int TRANSPARENT_EXT = 0x200A;
public const int TRANSPARENT_VALUE_EXT = 0x200B;
public const int SHARE_DEPTH_EXT = 0x200C;
public const int SHARE_STENCIL_EXT = 0x200D;
public const int SHARE_ACCUM_EXT = 0x200E;
public const int SUPPORT_GDI_EXT = 0x200F;
public const int SUPPORT_OPENGL_EXT = 0x2010;
public const int DOUBLE_BUFFER_EXT = 0x2011;
public const int STEREO_EXT = 0x2012;
public const int PIXEL_TYPE_EXT = 0x2013;
public const int COLOR_BITS_EXT = 0x2014;
public const int RED_BITS_EXT = 0x2015;
public const int RED_SHIFT_EXT = 0x2016;
public const int GREEN_BITS_EXT = 0x2017;
public const int GREEN_SHIFT_EXT = 0x2018;
public const int BLUE_BITS_EXT = 0x2019;
public const int BLUE_SHIFT_EXT = 0x201A;
public const int ALPHA_BITS_EXT = 0x201B;
public const int ALPHA_SHIFT_EXT = 0x201C;
public const int ACCUM_BITS_EXT = 0x201D;
public const int ACCUM_RED_BITS_EXT = 0x201E;
public const int ACCUM_GREEN_BITS_EXT = 0x201F;
public const int ACCUM_BLUE_BITS_EXT = 0x2020;
public const int ACCUM_ALPHA_BITS_EXT = 0x2021;
public const int DEPTH_BITS_EXT = 0x2022;
public const int STENCIL_BITS_EXT = 0x2023;
public const int AUX_BUFFERS_EXT = 0x2024;
public const int NO_ACCELERATION_EXT = 0x2025;
public const int GENERIC_ACCELERATION_EXT = 0x2026;
public const int FULL_ACCELERATION_EXT = 0x2027;
public const int SWAP_EXCHANGE_EXT = 0x2028;
public const int SWAP_COPY_EXT = 0x2029;
public const int SWAP_UNDEFINED_EXT = 0x202A;
public const int TYPE_RGBA_EXT = 0x202B;
public const int TYPE_COLORINDEX_EXT = 0x202C;
public const int DRAW_TO_PBUFFER_EXT = 0x202D;
public const int MAX_PBUFFER_PIXELS_EXT = 0x202E;
public const int MAX_PBUFFER_WIDTH_EXT = 0x202F;
public const int MAX_PBUFFER_HEIGHT_EXT = 0x2030;
public const int OPTIMAL_PBUFFER_WIDTH_EXT = 0x2031;
public const int OPTIMAL_PBUFFER_HEIGHT_EXT = 0x2032;
public const int PBUFFER_LARGEST_EXT = 0x2033;
public const int PBUFFER_WIDTH_EXT = 0x2034;
public const int PBUFFER_HEIGHT_EXT = 0x2035;
public const int DEPTH_FLOAT_EXT = 0x2040;
public const int SAMPLE_BUFFERS_3DFX = 0x2060;
public const int SAMPLES_3DFX = 0x2061;
public const int SAMPLE_BUFFERS_EXT = 0x2041;
public const int SAMPLES_EXT = 0x2042;
public const int DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = 0x2051;
public const int DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = 0x2052;
public const int DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = 0x2053;
public const int GAMMA_TABLE_SIZE_I3D = 0x204E;
public const int GAMMA_EXCLUDE_DESKTOP_I3D = 0x204F;
public const int GENLOCK_SOURCE_MULTIVIEW_I3D = 0x2044;
public const int GENLOCK_SOURCE_EXTENAL_SYNC_I3D = 0x2045;
public const int GENLOCK_SOURCE_EXTENAL_FIELD_I3D = 0x2046;
public const int GENLOCK_SOURCE_EXTENAL_TTL_I3D = 0x2047;
public const int GENLOCK_SOURCE_DIGITAL_SYNC_I3D = 0x2048;
public const int GENLOCK_SOURCE_DIGITAL_FIELD_I3D = 0x2049;
public const int GENLOCK_SOURCE_EDGE_FALLING_I3D = 0x204A;
public const int GENLOCK_SOURCE_EDGE_RISING_I3D = 0x204B;
public const int GENLOCK_SOURCE_EDGE_BOTH_I3D = 0x204C;
public const int IMAGE_BUFFER_MIN_ACCESS_I3D = 0x00000001;
public const int IMAGE_BUFFER_LOCK_I3D = 0x00000002;
public const int BIND_TO_TEXTURE_DEPTH_NV = 0x20A3;
public const int BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 0x20A4;
public const int DEPTH_TEXTURE_FORMAT_NV = 0x20A5;
public const int TEXTURE_DEPTH_COMPONENT_NV = 0x20A6;
public const int DEPTH_COMPONENT_NV = 0x20A7;
public const int BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 0x20A0;
public const int BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 0x20A1;
public const int TEXTURE_RECTANGLE_NV = 0x20A2;
public const int FLOAT_COMPONENTS_NV = 0x20B0;
public const int TEXTURE_FLOAT_R_NV = 0x20B5;
public const int TEXTURE_FLOAT_RG_NV = 0x20B6;
public const int TEXTURE_FLOAT_RGB_NV = 0x20B7;
public const int TEXTURE_FLOAT_RGBA_NV = 0x20B8;
#endregion
}
#region WGL functions.
[DllImport(_dll_name)]
public static extern int GetProcAddress(int hwnd);
[DllImport(_dll_name, EntryPoint = "wglCreateContext")]
public static extern int CreateContext(int dc);
[DllImport(_dll_name, EntryPoint = "wglMakeCurrent")]
public static extern int MakeCurrent(int dc, int rc);
[DllImport(_dll_name, EntryPoint = "wglDeleteContext")]
public static extern int DeleteContext(int rc);
[DllImport(_dll_name, EntryPoint = "wglGetCurrentContext")]
public static extern int GetCurrentContext();
[DllImport(_dll_name, EntryPoint = "wglGetCurrentDC")]
public static extern int GetCurrentDC();
[DllImport(_dll_name, EntryPoint = "wglShareLists")]
public static extern int ShareLists(int r1, int r2);
[DllImport(_dll_name, EntryPoint = "wglGetProcAddress")]
public static extern int GetProcAddress(string funcname);
#endregion
}
}

Binary file not shown.

View file

@ -0,0 +1,6 @@
bin\Release\OpenGL.dll
bin\Release\OpenGL.pdb
bin\Debug\OpenGL.dll
bin\Debug\OpenGL.pdb
..\Binaries\Debug\OpenGL.dll
..\Binaries\Debug\OpenGL.pdb

View file

@ -0,0 +1,5 @@
obj\Debug\OpenGL.dll
obj\Debug\OpenGL.pdb
..\..\Binaries\Debug\OpenGL.dll
..\..\Binaries\Debug\OpenGL.pdb
obj\Debug\ResolveAssemblyReference.cache

View file

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

View file

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

View file

@ -0,0 +1,558 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
using System;
using System.Runtime.InteropServices;
using System.Text;
//using System.Windows.Forms;
/* TODO: Update the description of TimeBeginPeriod and other native methods. Update Timer. */
namespace OpenTK.Platform.Windows
{
/// <summary>
/// For internal use by OpenTK only!
/// Exposes useful native WINAPI methods and structures.
/// </summary>
public static class Api
{
#region Constants
public struct Constants
{
// Keyboard events (found in WinUSER.h)
public const int WM_KEYDOWN = 0x0100;
public const int WM_KEYUP = 0x101;
public const int WM_SYSKEYDOWN = 0x0104;
public const int WM_SYSKEYUP = 0x0105;
public const int WM_COMMAND = 0x0111;
public const int WM_SYSCOMMAND = 0x0112;
// Pixel types (found in WinGDI.h)
public const byte PFD_TYPE_RGBA = 0;
public const byte PFD_TYPE_COLORINDEX = 1;
// Layer types (found in WinGDI.h)
public const sbyte PFD_MAIN_PLANE = 0;
public const sbyte PFD_OVERLAY_PLANE = 1;
public const sbyte PFD_UNDERLAY_PLANE = -1;
}
#endregion
#region WINAPI methods
#region PeekMessage
/// <summary>
/// Low-level WINAPI function that checks the next message in the queue.
/// </summary>
/// <param name="msg">The pending message (if any) is stored here.</param>
/// <param name="hWnd">Not used</param>
/// <param name="messageFilterMin">Not used</param>
/// <param name="messageFilterMax">Not used</param>
/// <param name="flags">Not used</param>
/// <returns>True if there is a message pending.</returns>
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern bool PeekMessage(out System.Windows.Forms.Message msg, IntPtr hWnd, uint messageFilterMin,
uint messageFilterMax, uint flags);
#endregion
#region GetMessage
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern bool GetMessage(out System.Windows.Forms.Message msg, IntPtr hWnd, uint messageFilterMin,
uint messageFilterMax);
#endregion
#region TimeBeginPeriod
/// <summary>
/// Sets the timing resolution of the GetTime (?) method.
/// </summary>
/// <param name="period">Timing resolution in msec (?)</param>
/// <returns>(?)</returns>
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("winmm.dll")]
public static extern IntPtr TimeBeginPeriod(uint period);
#endregion
#region QueryPerformanceFrequency
/// <summary>
///
/// </summary>
/// <param name="PerformanceFrequency"></param>
/// <returns></returns>
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("kernel32.dll")]
public static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency);
#endregion
#region QueryPerformanceCounter
/// <summary>
///
/// </summary>
/// <param name="PerformanceCount"></param>
/// <returns></returns>
[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("kernel32.dll")]
public static extern bool QueryPerformanceCounter(ref long PerformanceCount);
#endregion
#region GetDC
/// <summary>
///
/// </summary>
/// <param name="hwnd"></param>
/// <returns></returns>
[DllImport("user32.dll")]
public static extern int GetDC(int hwnd);
#endregion
#region ReleaseDC
/// <summary>
///
/// </summary>
/// <param name="hwnd"></param>
/// <param name="hDC"></param>
/// <returns></returns>
[DllImport("user32.dll")]
public static extern int ReleaseDC(int hwnd, int hDC);
#endregion
#region ChoosePixelFormat
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="pfd"></param>
/// <returns></returns>
[DllImport("gdi32.dll")]
public static extern int ChoosePixelFormat(int dc, [In, MarshalAs(UnmanagedType.LPStruct)]PixelFormatDescriptor pfd);
#endregion
#region SetPixelFormat
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
/// <param name="format"></param>
/// <param name="pfd"></param>
/// <returns></returns>
[DllImport("gdi32.dll")]
public static extern bool SetPixelFormat(int dc, int format, [In, MarshalAs(UnmanagedType.LPStruct)]PixelFormatDescriptor pfd);
#endregion
#region SetWindowPos
// WINUSERAPI BOOL WINAPI SetWindowPos(__in HWND hWnd, __in_opt HWND hWndInsertAfter,
// __in int X, __in int Y, __in int cx, __in int cy, __in UINT uFlags);
[DllImport("user32.dll")]
public static extern bool SetWindowPos(int handle, WindowPlacementOptions placement, int x, int y, int cx, int cy, SetWindowPosFlags flags);
#endregion
#region SwapBuffers
/// <summary>
///
/// </summary>
/// <param name="dc"></param>
[DllImport("gdi32.dll")]
public static extern void SwapBuffers(int dc);
#endregion
#region GetProcAddress
/// <summary>
///
/// </summary>
/// <param name="handle"></param>
/// <param name="funcname"></param>
/// <returns></returns>
[DllImport("kernel32.dll")]
public static extern int GetProcAddress(int handle, String funcname);
#endregion
#region LoadLibrary
/// <summary>
///
/// </summary>
/// <param name="funcname"></param>
/// <returns></returns>
[DllImport("kernel32.dll", SetLastError = true)]
public static extern int LoadLibrary(string funcname);
#endregion
#region FreeLibrary
/// <summary>
///
/// </summary>
/// <param name="handle"></param>
/// <returns></returns>
[DllImport("kernel32.dll")]
public static extern int FreeLibrary(int handle);
#endregion
#region CreateWindowEx
[DllImport("user32.dll", SetLastError = true)]
public static extern int CreateWindowEx(
[In]ExtendedWindowStyle ExStyle,
StringBuilder ClassName,
[In]string WindowName,
[In]WindowStyle Style,
[In]int X, int Y,
[In]int Width, int Height,
[In]IntPtr HandleToParentWindow,
[In]IntPtr Menu,
[In]IntPtr Instance,
[In]IntPtr Param);
/*
[DllImport("user32.dll", SetLastError = true)]
public static extern int CreateWindowEx(
[In]ExtendedWindowStyle ExStyle,
[In]IntPtr ClassName,
[In]IntPtr WindowName,
[In]WindowStyle Style,
[In]int X, [In]int Y,
[In]int Width, [In]int Height,
[In]IntPtr HandleToParentWindow,
[In]IntPtr Menu,
[In]IntPtr Instance,
[In]IntPtr Param);
*/
[DllImport("user32.dll", SetLastError = true)]
public static extern int CreateWindowEx(
ExtendedWindowStyle ExStyle,
IntPtr ClassName,
IntPtr WindowName,
WindowStyle Style,
int X, int Y,
int Width, int Height,
IntPtr HandleToParentWindow,
IntPtr Menu,
IntPtr Instance,
IntPtr Param);
public enum WindowStyle : uint
{
Overlapped = 0x00000000,
Popup = 0x80000000,
Child = 0x40000000,
Minimize = 0x20000000,
Visible = 0x10000000,
Disabled = 0x08000000,
ClipSiblings = 0x04000000,
ClipChildren = 0x02000000,
Maximize = 0x01000000,
Caption = 0x00C00000, // Border | DialogFrame
Border = 0x00800000,
DialogFrame = 0x00400000,
VScroll = 0x00200000,
HScreen = 0x00100000,
SystemMenu = 0x00080000,
ThickFrame = 0x00040000,
Group = 0x00020000,
TabStop = 0x00010000,
MinimizeBox = 0x00020000,
MaximizeBox = 0x00010000,
Tiled = Overlapped,
Iconic = Minimize,
SizeBox = ThickFrame,
TiledWindow = OverlappedWindow,
// Common window styles:
OverlappedWindow = Overlapped | Caption | SystemMenu | ThickFrame | MinimizeBox | MaximizeBox,
PopupWindow = Popup | Border | SystemMenu,
ChildWindow = Child
}
public enum ExtendedWindowStyle : uint
{
DialogModalFrame = 0x00000001,
NoParentNotify = 0x00000004,
Topmost = 0x00000008,
AcceptFiles = 0x00000010,
Transparent = 0x00000020,
// #if(WINVER >= 0x0400)
MdiChild = 0x00000040,
ToolWindow = 0x00000080,
WindowEdge = 0x00000100,
ClientEdge = 0x00000200,
ContextHelp = 0x00000400,
// #endif
// #if(WINVER >= 0x0400)
Right = 0x00001000,
Left = 0x00000000,
RightToLeftReading = 0x00002000,
LeftToRightReading = 0x00000000,
LeftScrollbar = 0x00004000,
RightScrollbar = 0x00000000,
ControlParent = 0x00010000,
StaticEdge = 0x00020000,
ApplicationWindow = 0x00040000,
OverlappedWindow = WindowEdge | ClientEdge,
PaletteWindow = WindowEdge | ToolWindow | Topmost,
// #endif
// #if(_WIN32_WINNT >= 0x0500)
Layered = 0x00080000,
// #endif
// #if(WINVER >= 0x0500)
NoInheritLayout = 0x00100000, // Disable inheritence of mirroring by children
RightToLeftLayout = 0x00400000, // Right to left mirroring
// #endif /* WINVER >= 0x0500 */
// #if(_WIN32_WINNT >= 0x0501)
Composited = 0x02000000,
// #endif /* _WIN32_WINNT >= 0x0501 */
// #if(_WIN32_WINNT >= 0x0500)
NoActivate = 0x08000000
// #endif /* _WIN32_WINNT >= 0x0500 */
}
#endregion
#region GetModuleHandle
[DllImport("kernel32.dll")]
public static extern IntPtr GetModuleHandle([MarshalAs(UnmanagedType.LPTStr)]string module_name);
#endregion
#region RegisterClass
[DllImport("user32.dll", SetLastError = true)]
public static extern short RegisterClass(WindowClass window_class);
#endregion
// *********** Never use GetLastError! ************
//#region GetLastError
//[DllImport("kernel32.dll")]
//public static extern int GetLastError();
//#endregion
//#region SetLastError
//[DllImport("kernel32.dll")]
//public static extern void SetLastError(int error_code);
//#endregion
//#region FormatMessage
//#endregion
// ************************************************
#endregion
#region WINAPI structs
#region PixelFormatDescriptor
/// <summary>
/// Describes a pixel format. It is used when interfacing with the WINAPI to create a new Context.
/// Found in WinGDI.h
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public class PixelFormatDescriptor
{
short Size = 40; // No need for the user to set the size, since it is predefined.
public short Version = 1;
public PixelFormatDescriptorFlags Flags =
//PixelFormatDescriptorFlags.DOUBLEBUFFER |
PixelFormatDescriptorFlags.DRAW_TO_WINDOW |
PixelFormatDescriptorFlags.SUPPORT_OPENGL;
public byte PixelType = Constants.PFD_TYPE_RGBA;
public byte ColorBits = 0;
public byte RedBits = 0;
public byte RedShift = 0;
public byte GreenBits = 0;
public byte GreenShift = 0;
public byte BlueBits = 0;
public byte BlueShift = 0;
public byte AlphaBits = 8;
public byte AlphaShift = 0;
public byte AccumBits = 0;
public byte AccumRedBits = 0;
public byte AccumGreenBits = 0;
public byte AccumBlueBits = 0;
public byte AccumAlphaBits = 0;
public byte DepthBits = 0;
public byte StencilBits = 0;
public byte AuxBuffers = 0;
public sbyte LayerType = Constants.PFD_MAIN_PLANE;
byte Reserved = 0;
public uint LayerMask = 0;
public uint VisibleMask = 0;
public uint DamageMask = 0;
}
[Flags]
public enum PixelFormatDescriptorFlags : uint
{
// PixelFormatDescriptor flags
DOUBLEBUFFER,
STEREO,
DRAW_TO_WINDOW,
DRAW_TO_BITMAP,
SUPPORT_GDI,
SUPPORT_OPENGL,
GENERIC_FORMAT,
NEED_PALETTE,
NEED_SYSTEM_PALETTE,
SWAP_EXCHANGE,
SWAP_COPY,
SWAP_LAYER_BUFFERS,
GENERIC_ACCELERATED,
SUPPORT_DIRECTDRAW,
// PixelFormatDescriptor flags for use in ChoosePixelFormat only
DEPTH_DONTCARE = 0x20000000,
DOUBLEBUFFER_DONTCARE = 0x40000000,
STEREO_DONTCARE = 0x80000000
}
#endregion
#region SetWindowPosFlags
[Flags]
public enum SetWindowPosFlags
{
// SetWindowPos Flags
NOSIZE,
NOMOVE,
NOZORDER,
NOREDRAW,
NOACTIVATE,
FRAMECHANGED, // The frame changed: send WM_NCCALCSIZE
SHOWWINDOW,
HIDEWINDOW,
NOCOPYBITS,
NOOWNERZORDER, // Don't do owner Z ordering
NOSENDCHANGING, // Don't send WM_WINDOWPOSCHANGING
DRAWFRAME = FRAMECHANGED,
NOREPOSITION = NOOWNERZORDER
//#if WINVER >= 0x0400
//public const int SWP_DEFERERASE = 0x2000;
//public const int SWP_ASYNCWINDOWPOS = 0x4000;
//#endif
}
#endregion
#region WindowPlacementOptions
public enum WindowPlacementOptions
{
TOP = 0,
BOTTOM = 1,
TOPMOST = -1,
NOTOPMOST = -2
}
#endregion
#region WindowClass
[StructLayout(LayoutKind.Sequential)]
public class WindowClass
{
public WindowClassStyle style = WindowClassStyle.VRedraw | WindowClassStyle.HRedraw | WindowClassStyle.OwnDC;
[MarshalAs(UnmanagedType.FunctionPtr)]
public WindowProcedureEventHandler WindowProcedure;
public int ClassExtraBytes;
public int WindowExtraBytes;
//[MarshalAs(UnmanagedType.
public IntPtr Instance;
public IntPtr Icon;
public IntPtr Cursor;
public IntPtr BackgroundBrush;
//[MarshalAs(UnmanagedType.LPStr)]
public IntPtr MenuName;
//[MarshalAs(UnmanagedType.LPStr)]
public IntPtr ClassName;
}
#endregion
#region Class styles
public enum WindowClassStyle
{
VRedraw = 0x0001,
HRedraw = 0x0002,
DoubleClicks = 0x0008,
OwnDC = 0x0020,
ClassDC = 0x0040,
ParentDC = 0x0080,
NoClose = 0x0200,
SaveBits = 0x0800,
ByteAlignClient = 0x1000,
ByteAlignWindow = 0x2000,
GlobalClass = 0x4000,
Ime = 0x00010000,
// #if(_WIN32_WINNT >= 0x0501)
DropShadow = 0x00020000
// #endif /* _WIN32_WINNT >= 0x0501 */
}
#endregion
#endregion
[UnmanagedFunctionPointerAttribute(CallingConvention.Winapi)]
public delegate void WindowProcedureEventHandler(object sender, WindowProcedureEventArgs e);
public class WindowProcedureEventArgs : EventArgs
{
public System.Windows.Forms.Message Msg;
}
}
}

View file

@ -0,0 +1,2 @@
..\..\..\..\..\Binaries\Debug\Libraries\OpenTK.Platform.Windows.dll
..\..\..\..\..\Binaries\Debug\Libraries\OpenTK.Platform.Windows.pdb

289
Specifications/TypeMap.txt Normal file
View file

@ -0,0 +1,289 @@
#AccumOp,*,*, GLenum,*,*
#AlphaFunction,*,*, GLenum,*,*
#AttribMask,*,*, GLbitfield,*,*
#BeginMode,*,*, GLenum,*,*
#BinormalPointerTypeEXT,*,*, GLenum,*,*
!BlendEquationMode,*,*, GLenum,*,*
#BlendEquationModeEXT,*,*, GLenum,*,*
!BlendFuncSeparateParameterEXT,*,*, GLenum,*,*
#BlendingFactorDest,*,*, GLenum,*,*
#BlendingFactorSrc,*,*, GLenum,*,*
#Boolean,*,*, GLboolean,*,*
#BooleanPointer,*,*, GLboolean*,*,*
#Char,*,*, GLchar,*,*
#CharPointer,*,*, GLchar*,*,*
#CheckedFloat32,*,*, GLfloat,*,*
#CheckedInt32,*,*, GLint,*,*
!ClampColorTargetARB,*,*, GLenum,*,*
!ClampColorModeARB,*,*, GLenum,*,*
#ClampedColorF,*,*, GLclampf,*,*
#ClampedFloat32,*,*, GLclampf,*,*
#ClampedFloat64,*,*, GLclampd,*,*
#ClampedStencilValue,*,*, GLint,*,*
#ClearBufferMask,*,*, GLbitfield,*,*
#ClientAttribMask,*,*, GLbitfield,*,*
#ClipPlaneName,*,*, GLenum,*,*
#ColorB,*,*, GLbyte,*,*
#ColorD,*,*, GLdouble,*,*
#ColorF,*,*, GLfloat,*,*
#ColorI,*,*, GLint,*,*
#ColorIndexValueD,*,*, GLdouble,*,*
#ColorIndexValueF,*,*, GLfloat,*,*
#ColorIndexValueI,*,*, GLint,*,*
#ColorIndexValueS,*,*, GLshort,*,*
#ColorIndexValueUB,*,*, GLubyte,*,*
#ColorMaterialParameter,*,*, GLenum,*,*
#ColorPointerType,*,*, GLenum,*,*
#ColorS,*,*, GLshort,*,*
!ColorTableParameterPName,*,*, GLenum,*,*
#ColorTableParameterPNameSGI,*,*, GLenum,*,*
!ColorTableTarget,*,*, GLenum,*,*
#ColorTableTargetSGI,*,*, GLenum,*,*
#ColorUB,*,*, GLubyte,*,*
#ColorUI,*,*, GLuint,*,*
#ColorUS,*,*, GLushort,*,*
#CombinerBiasNV,*,*, GLenum,*,*
#CombinerComponentUsageNV,*,*, GLenum,*,*
#CombinerMappingNV,*,*, GLenum,*,*
#CombinerParameterNV,*,*, GLenum,*,*
#CombinerPortionNV,*,*, GLenum,*,*
#CombinerRegisterNV,*,*, GLenum,*,*
#CombinerScaleNV,*,*, GLenum,*,*
#CombinerStageNV,*,*, GLenum,*,*
#CombinerVariableNV,*,*, GLenum,*,*
#CompressedTextureARB,*,*, GLvoid,*,*
#ControlPointNV,*,*, GLvoid,*,*
#ControlPointTypeNV,*,*, GLenum,*,*
!ConvolutionParameter,*,*, GLenum,*,*
#ConvolutionParameterEXT,*,*, GLenum,*,*
!ConvolutionTarget,*,*, GLenum,*,*
#ConvolutionTargetEXT,*,*, GLenum,*,*
#CoordD,*,*, GLdouble,*,*
#CoordF,*,*, GLfloat,*,*
#CoordI,*,*, GLint,*,*
#CoordS,*,*, GLshort,*,*
#CullFaceMode,*,*, GLenum,*,*
!CullParameterEXT,*,*, GLenum,*,*
#DepthFunction,*,*, GLenum,*,*
#DrawBufferMode,*,*, GLenum,*,*
!DrawElementsType,*,*, GLenum,*,*
#ElementPointerTypeATI,*,*, GLenum,*,*
#EnableCap,*,*, GLenum,*,*
#ErrorCode,*,*, GLenum,*,*
#EvalMapsModeNV,*,*, GLenum,*,*
#EvalTargetNV,*,*, GLenum,*,*
#FeedbackElement,*,*, GLfloat,*,*
#FeedbackType,*,*, GLenum,*,*
#FenceNV,*,*, GLuint,*,*
#FenceConditionNV,*,*, GLenum,*,*
#FenceParameterNameNV,*,*, GLenum,*,*
#FfdMaskSGIX,*,*, GLbitfield,*,*
#FfdTargetSGIX,*,*, GLenum,*,*
#Float32,*,*, GLfloat,*,*
#Float32Pointer,*,*, GLfloat*,*,*
#Float64,*,*, GLdouble,*,*
#Float64Pointer,*,*, GLdouble*,*,*
#FogParameter,*,*, GLenum,*,*
!FogPointerTypeEXT,*,*, GLenum,*,*
!FogPointerTypeIBM,*,*, GLenum,*,*
#FragmentLightModelParameterSGIX,*,*,GLenum,*,*
#FragmentLightNameSGIX,*,*, GLenum,*,*
#FragmentLightParameterSGIX,*,*, GLenum,*,*
#FrontFaceDirection,*,*, GLenum,*,*
FunctionPointer,*,*, _GLfuncptr,*,*
#GetColorTableParameterPName,*,*, GLenum,*,*
#GetColorTableParameterPNameSGI,*,*, GLenum,*,*
!GetConvolutionParameterPName,*,*, GLenum,*,*
!GetHistogramParameterPName,*,*, GLenum,*,*
#GetHistogramParameterPNameEXT,*,*, GLenum,*,*
#GetMapQuery,*,*, GLenum,*,*
!GetMinmaxParameterPName,*,*, GLenum,*,*
#GetMinmaxParameterPNameEXT,*,*, GLenum,*,*
#GetPName,*,*, GLenum,*,*
#GetPointervPName,*,*, GLenum,*,*
#GetTextureParameter,*,*, GLenum,*,*
#HintMode,*,*, GLenum,*,*
#HintTarget,*,*, GLenum,*,*
!HintTargetPGI,*,*, GLenum,*,*
!HistogramTarget,*,*, GLenum,*,*
#HistogramTargetEXT,*,*, GLenum,*,*
#IglooFunctionSelectSGIX,*,*, GLenum,*,*
IglooParameterSGIX,*,*, GLvoid,*,*
!ImageTransformPNameHP,*,*, GLenum,*,*
!ImageTransformTargetHP,*,*, GLenum,*,*
!IndexFunctionEXT,*,*, GLenum,*,*
!IndexMaterialParameterEXT,*,*, GLenum,*,*
#IndexPointerType,*,*, GLenum,*,*
#Int16,*,*, GLshort,*,*
#Int32,*,*, GLint,*,*
#Int8,*,*, GLbyte,*,*
#InterleavedArrayFormat,*,*, GLenum,*,*
#LightEnvParameterSGIX,*,*, GLenum,*,*
#LightModelParameter,*,*, GLenum,*,*
#LightName,*,*, GLenum,*,*
#LightParameter,*,*, GLenum,*,*
#LightTextureModeEXT,*,*, GLenum,*,*
#LightTexturePNameEXT,*,*, GLenum,*,*
#LineStipple,*,*, GLushort,*,*
#List,*,*, GLuint,*,*
#ListMode,*,*, GLenum,*,*
#ListNameType,*,*, GLenum,*,*
#ListParameterName,*,*, GLenum,*,*
#LogicOp,*,*, GLenum,*,*
#MapAttribParameterNV,*,*, GLenum,*,*
#MapParameterNV,*,*, GLenum,*,*
#MapTarget,*,*, GLenum,*,*
#MapTargetNV,*,*, GLenum,*,*
#MapTypeNV,*,*, GLenum,*,*
#MaskedColorIndexValueF,*,*, GLfloat,*,*
#MaskedColorIndexValueI,*,*, GLuint,*,*
#MaskedStencilValue,*,*, GLuint,*,*
#MaterialFace,*,*, GLenum,*,*
#MaterialParameter,*,*, GLenum,*,*
!MatrixIndexPointerTypeARB,*,*, GLenum,*,*
#MatrixMode,*,*, GLenum,*,*
#MatrixTransformNV,*,*, GLenum,*,*
#MeshMode1,*,*, GLenum,*,*
#MeshMode2,*,*, GLenum,*,*
!MinmaxTarget,*,*, GLenum,*,*
#MinmaxTargetEXT,*,*, GLenum,*,*
#NormalPointerType,*,*, GLenum,*,*
#NurbsCallback,*,*, GLenum,*,*
NurbsObj,*,*, GLUnurbs*,*,*
#NurbsProperty,*,*, GLenum,*,*
#NurbsTrim,*,*, GLenum,*,*
#OcclusionQueryParameterNameNV,*,*, GLenum,*,*
#PixelCopyType,*,*, GLenum,*,*
#PixelFormat,*,*, GLenum,*,*
#PixelInternalFormat,*,*, GLenum,*,*
#PixelMap,*,*, GLenum,*,*
#PixelStoreParameter,*,*, GLenum,*,*
#PixelTexGenModeSGIX,*,*, GLenum,*,*
#PixelTexGenParameterNameSGIS,*,*, GLenum,*,*
#PixelTransferParameter,*,*, GLenum,*,*
#PixelTransformPNameEXT,*,*, GLenum,*,*
#PixelTransformTargetEXT,*,*, GLenum,*,*
#PixelType,*,*, GLenum,*,*
!PointParameterNameARB,*,*, GLenum,*,*
#PolygonMode,*,*, GLenum,*,*
ProgramNV,*,*, GLuint,*,*
ProgramCharacterNV,*,*, GLubyte,*,*
#ProgramParameterNV,*,*, GLenum,*,*
#QuadricCallback,*,*, GLenum,*,*
#QuadricDrawStyle,*,*, GLenum,*,*
#QuadricNormal,*,*, GLenum,*,*
QuadricObj,*,*, GLUquadric*,*,*
#QuadricOrientation,*,*, GLenum,*,*
#ReadBufferMode,*,*, GLenum,*,*
#RenderingMode,*,*, GLenum,*,*
ReplacementCodeSUN,*,*, GLuint,*,*
#ReplacementCodeTypeSUN,*,*, GLenum,*,*
#SamplePassARB,*,*, GLenum,*,*
#SamplePatternEXT,*,*, GLenum,*,*
#SamplePatternSGIS,*,*, GLenum,*,*
#SecondaryColorPointerTypeIBM,*,*, GLenum,*,*
#SelectName,*,*, GLuint,*,*
!SeparableTarget,*,*, GLenum,*,*
#SeparableTargetEXT,*,*, GLenum,*,*
#ShadingModel,*,*, GLenum,*,*
#SizeI,*,*, GLsizei,*,*
#SpriteParameterNameSGIX,*,*, GLenum,*,*
#StencilFunction,*,*, GLenum,*,*
!StencilFaceDirection,*,*, GLenum,*,*
#StencilOp,*,*, GLenum,*,*
#StencilValue,*,*, GLint,*,*
#String,*,*, GLstring,*,*
#StringName,*,*, GLenum,*,*
#TangentPointerTypeEXT,*,*, GLenum,*,*
#TessCallback,*,*, GLenum,*,*
#TessContour,*,*, GLenum,*,*
#TessProperty,*,*, GLenum,*,*
TesselatorObj,*,*, GLUtesselator*,*,*
#TexCoordPointerType,*,*, GLenum,*,*
#Texture,*,*, GLuint,*,*
#TextureComponentCount,*,*, GLint,*,*
#TextureCoordName,*,*, GLenum,*,*
#TextureEnvParameter,*,*, GLenum,*,*
#TextureEnvTarget,*,*, GLenum,*,*
!TextureFilterSGIS,*,*, GLenum,*,*
#TextureGenParameter,*,*, GLenum,*,*
#TextureNormalModeEXT,*,*, GLenum,*,*
#TextureParameterName,*,*, GLenum,*,*
#TextureTarget,*,*, GLenum,*,*
!TextureUnit,*,*, GLenum,*,*
#UInt16,*,*, GLushort,*,*
#UInt32,*,*, GLuint,*,*
#UInt8,*,*, GLubyte,*,*
#VertexAttribEnumNV,*,*, GLenum,*,*
#VertexAttribPointerTypeNV,*,*, GLenum,*,*
#VertexPointerType,*,*, GLenum,*,*
#VertexWeightPointerTypeEXT,*,*, GLenum,*,*
#Void,*,*, GLvoid,*,*
VoidPointer,*,*, GLvoid*,*,*
#ConstVoidPointer,*,*, GLvoid* const,*,*
!WeightPointerTypeARB,*,*, GLenum,*,*
#WinCoord,*,*, GLint,*,*
#void,*,*, *,*,*
#ArrayObjectPNameATI,*,*, GLenum,*,*
#ArrayObjectUsageATI,*,*, GLenum,*,*,
ConstFloat32,*,*, GLfloat,*,*
ConstInt32,*,*, GLint,*,*
ConstUInt32,*,*, GLuint,*,*
ConstVoid,*,*, GLvoid,*,*
#DataTypeEXT,*,*, GLenum,*,*
#FragmentOpATI,*,*, GLenum,*,*
#GetTexBumpParameterATI,*,*, GLenum,*,*
#GetVariantValueEXT,*,*, GLenum,*,*
#ParameterRangeEXT,*,*, GLenum,*,*
#PreserveModeATI,*,*, GLenum,*,*
!ProgramFormatARB,*,*, GLenum,*,*
!ProgramTargetARB,*,*, GLenum,*,*
!ProgramPropertyARB,*,*, GLenum,*,*
!ProgramStringPropertyARB,*,*, GLenum,*,*
#ScalarType,*,*, GLenum,*,*
#SwizzleOpATI,*,*, GLenum,*,*
#TexBumpParameterATI,*,*, GLenum,*,*
#VariantCapEXT,*,*, GLenum,*,*
!VertexAttribPointerPropertyARB,*,*, GLenum,*,*
!VertexAttribPointerTypeARB,*,*, GLenum,*,*
!VertexAttribPropertyARB,*,*, GLenum,*,*
#VertexShaderCoordOutEXT,*,*, GLenum,*,*
#VertexShaderOpEXT,*,*, GLenum,*,*
#VertexShaderParameterEXT,*,*, GLenum,*,*
#VertexShaderStorageTypeEXT,*,*, GLenum,*,*
#VertexShaderTextureUnitParameter,*,*, GLenum,*,*
#VertexShaderWriteMaskEXT,*,*, GLenum,*,*
#VertexStreamATI,*,*, GLenum,*,*
#PNTrianglesPNameATI,*,*, GLenum,*,*
# ARB_vertex_buffer_object types and core equivalents for new types
VertexBufferOffset,*,*, GLintptr,*,*
#VertexBufferSize,*,*, GLsizeiptr,*,*
!VertexBufferAccessARB,*,*, GLenum,*,*
#VertexBufferOffsetARB,*,*, GLintptrARB,*,*
!VertexBufferPNameARB,*,*, GLenum,*,*
!VertexBufferPointerNameARB,*,*, GLenum,*,*
VertexBufferSizeARB,*,*, GLsizeiptrARB,*,*
!VertexBufferTargetARB,*,*, GLenum,*,*
!VertexBufferUsageARB,*,*, GLenum,*,*
# APPLE_fence
#ObjectTypeAPPLE,*,*, GLenum,*,*
# APPLE_vertex_array_range
#VertexArrayPNameAPPLE,*,*, GLenum,*,*
# ATI_draw_buffers
!DrawBufferModeATI,*,*, GLenum,*,*
# NV_half
#Half16NV,*,*, GLhalfNV,*,*
# NV_pixel_data_range
#PixelDataRangeTargetNV,*,*, GLenum,*,*
# Generic types for as-yet-unspecified enums
!GLenum,*,*, GLenum,*,*
#handleARB,*,*, GLhandleARB,*,*
#charARB,*,*, GLcharARB,*,*
#charPointerARB,*,*, GLcharARB*,*,*

5499
Specifications/enum.spec Normal file

File diff suppressed because it is too large Load diff

4009
Specifications/enumext.spec Normal file

File diff suppressed because it is too large Load diff

20282
Specifications/gl.spec Normal file

File diff suppressed because it is too large Load diff

9
license.txt Normal file
View file

@ -0,0 +1,9 @@
The MIT License
Copyright (c) 2006 Stephen Apostolopoulos
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.