made a copy

This commit is contained in:
the_fiddler 2007-05-04 11:32:21 +00:00
commit f5c4e92e7d
104 changed files with 80801 additions and 0 deletions

4
Build/Build-Mono.bat Normal file
View file

@ -0,0 +1,4 @@
cd..
Build\Prebuild.exe /target nant /file Prebuild.xml
NAnt.exe -t:mono-2.0
Build\PostBuild.bat

4
Build/Build-Net.bat Normal file
View file

@ -0,0 +1,4 @@
cd..
Build\Prebuild.exe /target nant /file Prebuild.xml
NAnt.exe -t:net-2.0
Build\PostBuild.bat

4
Build/Clean.bat Normal file
View file

@ -0,0 +1,4 @@
cd ..
Build\Prebuild /clean /yes /removedir obj /file Prebuild.xml
rd Binaries /S /Q
pause

2
Build/Help.bat Normal file
View file

@ -0,0 +1,2 @@
cd ..
Build\Prebuild /usage /pause

2
Build/MonoDevelop.sh Normal file
View file

@ -0,0 +1,2 @@
#!/bin/sh
./prebuild /target monodev /file ../Prebuild.xml /pause

20
Build/PostBuild.bat Normal file
View file

@ -0,0 +1,20 @@
rem Copying files to output directory
xcopy Source\OpenGL\Bind\bin\Release\*.exe Binaries\Release\Exe\*.* /Q /Y
xcopy Source\OpenGL\OpenGL\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y
xcopy Source\OpenGL\OpenGL\*.config Binaries\Release\Libraries\*.* /Q /Y
xcopy Source\Platform\Windows\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y
xcopy Source\Platform\X11\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y
xcopy Source\Framework\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y
xcopy Source\Examples\OpenGL\Basic\Lesson01\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y
xcopy Source\Examples\OpenGL\Basic\DisplayLists\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y
xcopy Source\Examples\OpenGL\Basic\NoFramework\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y
xcopy Source\Examples\OpenGL\Basic\QueryDisplayModes\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y
xcopy Source\Examples\OpenGL\GLSL\Lesson01\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y
xcopy Binaries\Release\Libraries\*.* Binaries\Release\Examples\*.* /Q /Y
pause

BIN
Build/Prebuild.exe Normal file

Binary file not shown.

5
Build/PrepareRelease.bat Normal file
View file

@ -0,0 +1,5 @@
cd..
dir /s /b /ad | find ".svn" > del.txt
for /F "delims='" %%f in (del.txt) do rmdir /q /s "%%f"
del del.txt
cd Build

4
Build/SharpDevelop2.bat Normal file
View file

@ -0,0 +1,4 @@
@rem Generates a combine (.cmbx) and a set of project files (.prjx)
@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
cd ..
Build\Prebuild /target sharpdev2 /file Prebuild.xml /pause

4
Build/VS2005.bat Normal file
View file

@ -0,0 +1,4 @@
@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
@rem for Microsoft Visual Studio .NET 2005
cd ..
Build\Prebuild.exe /target vs2005 /file Prebuild.xml /pause

2
Build/nant.bat Normal file
View file

@ -0,0 +1,2 @@
cd ..
Build\Prebuild /target nant /file Prebuild.xml

2
Build/nant.sh Normal file
View file

@ -0,0 +1,2 @@
#!/bin/sh
./prebuild /target nant /file ../Prebuild.xml /pause

79
Changelog.txt Normal file
View file

@ -0,0 +1,79 @@
OpenTK 0.3.5 -> 0.3.6
+ OpenTK.OpenGL.Bind
+ Synced with Tao.GlBindGen codebase.
+ Uses CodeDOM internally for code generation.
+ Updated to latest specs (which include shader model 4).
+ OpenTK.OpenGL (Low level)
+ All OpenGL extensions are now generated (up to shader model 4).
+ Decorated imports and delegates with the SuppressUnmanagedCodeSecurity attribute. Major speed improvements in CPU-bound applications.
+ More robust and faster static initialisation for the GL class.
+ Updated GLHelper.cs, with methods to obtain or reload OpenGL entry points, as well as query for supported extensions.
+ Got rid of "object" overloads for typed arrays.
+ All known bugs are now fixed.
+ OpenTK.OpenGL (High level)
+ Added the DisplayList class.
+ OpenTK.Examples.OpenGL
+ Added the Basic.DisplayLists example.
OpenTK 0.3.4 -> 0.3.5
+ Thanks to Erik Ylvisaker's hard work, OpenTK now works under both Windows and X11.
+ The GLContext class now contains all needed code for mode switching.
+ The Framework class structure has been updated. Less code is duplicated between GLContext and Framework now.
+ Three new examples have been added: OpenGL.Basic.Lesson01 (equivalent to OpenGL.GLSL.Lesson01 without the shaders), OpenGL.Basic.QueryDisplayModes which shows a list of all available display modes, and OpenGL.Basic.NoFramework which shows how to use OpenGL Contexts directly (without relying on the framework).
+ New bindings for X and the XF86 extension.
+ New build system based on Prebuild and NAnt (similar to the one used in Tao or Mono.XNA).
+ Updates to the OpenTK.OpenGL.DisplayMode and ColorDepth classes.
+ More XML documentation blocks added to functions and classes.
+ Major update to OpenTK.OpenGL.Bind (see that changelog for more info).
+ Revamped GL class (it is self contained now).
+ Revamped GLContext class (it is no longer bound to the GL class initialisation).
+ Cleaner code, new functions, comments and many new wrappers.
+ Updated the spec files for opengl 2.1.
+ Added the new 64 bit types to the typemaps (gl.tm and csharp.tm)
+ The bugs in the specs are still there:
+ SGIX_icc_texture is still commented out, while enums use it.
+ LightProperty is still used by constants (the correct enum is LightParameter).
+ I think I should contact someone at the Khronos group about these. For the time being I worked around them, by adding a special case for LightProperty in the translator, and adding the SGIX enum to the missing parameters.
+ See also: http://www.haskell.org/HOpenGL/spec_bugs.html (lots of useful information on that site).
+ Directory structure updates.
+ Now every project has its own documentation.
+ The spec files for OpenGL now reside in the Source/OpenTK/OpenGL directory.
+ Minor updates to the wgl bindings (int -> IntPtr).
+ Tested the binding generator with the glx specs (the reader and the enum writer work ok, the trnaslator and the other writers will need updating).
+ Renamed the GLForm to Framework.
+ The Framework now resides in its own project directory.
OpenTK 0.3.3 -> 0.3.4
+ Corrected the crash error in Release mode (it was caused by trying to Marshal the System.Windows.Forms.Message struct to PeekMessage - adding my own Message struct corrected the issue).
+ Corrected the call to glShaderSource GLSL.Lesson01. Now the correct number is passed to the count parameter, while the null parameter was changed to IntPtr.Zero (Mono now no longers fails in this call).
+ Updated the GLSL.Lesson01 example to use GetShaderInfoLog on compilation failure.
+ OpenTK.OpenGL.Bind 0.7.5.1 -> 0.7.5.2 (see Bind changelog for more information)
+ Full Mono support under windows.
OpenTK 0.3.2 -> 0.3.3
+ OpenTK.OpenGL.Bind 0.7.5 -> 0.7.5.1 (see Bind changelog for more information)
+ Added the GLForm class which sets the base for cross-platform screen, context and keyboard handling.
+ Can now change between fullscreen and windowed modes.
+ Temporarily removed all examples except for GLSL.Lesson01, which has been updated to use the new GLForm class.
OpenTK 0.3.1 -> 0.3.2
+ OpenTK.OpenGL.Glu: Eliminated the temporary IntPtr variable in the GetString and ErrorString functions.
+ Specifications.cs_types.txt: Changed types in order to be CLS compliant.
+ OpenTK.OpenGL.Bind 0.7.4 -> 0.7.5
+ Added the GLSL.Lesson01 example.
OpenTK 0.3.0 -> 0.3.1
+ Updated the binding generator to version 0.7.4, based on the work done for Tao.
+ Updated the Context load functions. Now Context loads all functions are extensions, and the derived classes override this behavior as needed.
+ Changed the uint array used in the DisplayLists example to an int array.
+ Added the changelog! :)

5
Instructions.txt Normal file
View file

@ -0,0 +1,5 @@
This is a source distribution. There are two ways to build a release:
1) Install nant from (http://nant.sourceforge.net/) and execute Build-Mono.bat or Build-Net.bat (Windows) or build.sh (Unix).
2) Execute VS2005.bat or SharpDevelop2.bat (Windows) or MonoDevelop.sh (Unix) to create project files that can be opened and built with the corresponding IDE.

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.

295
Prebuild.xml Normal file
View file

@ -0,0 +1,295 @@
<?xml version="1.0" encoding="utf-8" ?>
<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd">
<Solution name="OpenTK">
<Configuration name="Debug">
<Options>
<CompilerDefines>DEBUG;TRACE;</CompilerDefines>
<OptimizeCode>false</OptimizeCode>
<OutputPath>..\..\Binaries\Debug\Libraries</OutputPath>
<DebugInformation>true</DebugInformation>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<CompilerDefines>TRACE;</CompilerDefines>
<OptimizeCode>true</OptimizeCode>
<OutputPath>..\..\Binaries\Release\Libraries</OutputPath>
<DebugInformation>false</DebugInformation>
</Options>
</Configuration>
<Files>
<File>.\Todo.txt</File>
<File>.\Release.txt</File>
<File>.\Changelog.txt</File>
<File>.\License.txt</File>
<File>.\Instructions.txt</File>
</Files>
<Project name="OpenTK.Platform.Windows" path=".\Source\Platform\Windows" language="C#" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\Binaries\Debug\Libraries</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\Binaries\Release\Libraries</OutputPath>
</Options>
</Configuration>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.Platform.X11" path=".\Source\Platform\X11" language="C#" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\Binaries\Debug\Libraries</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\Binaries\Release\Libraries</OutputPath>
</Options>
</Configuration>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.OpenGL.Bind" path=".\Source\OpenGL\Bind" language="C#" type="Exe">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\Binaries\Debug\Exe</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\Binaries\Release\Exe</OutputPath>
</Options>
</Configuration>
<Reference name="System"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.OpenGL" path=".\Source\OpenGL\OpenGL" language="C#" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\Binaries\Debug\Exe</OutputPath>
<AllowUnsafe>true</AllowUnsafe>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\Binaries\Release\Exe</OutputPath>
<AllowUnsafe>true</AllowUnsafe>
</Options>
</Configuration>
<Reference name="OpenTK.Platform.Windows"/>
<Reference name="OpenTK.Platform.X11"/>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.Framework" path=".\Source\Framework\" language="C#" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\Binaries\Debug\Libraries</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\Binaries\Release\Libraries</OutputPath>
</Options>
</Configuration>
<Reference name="OpenTK.Platform.Windows"/>
<Reference name="OpenTK.Platform.X11"/>
<Reference name="OpenTK.OpenGL"/>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.Examples.OpenGL.Basic.001-Cube" path=".\Source\Examples\OpenGL\Basic\001 - Cube" language="C#" type="WinExe">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Debug\Examples</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Release\Examples</OutputPath>
</Options>
</Configuration>
<Reference name="OpenTK.Framework"/>
<Reference name="OpenTK.OpenGL"/>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.Examples.OpenGL.Basic.DisplayLists" path=".\Source\Examples\OpenGL\Basic\DisplayLists" language="C#" type="WinExe">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Debug\Examples</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Release\Examples</OutputPath>
</Options>
</Configuration>
<Reference name="OpenTK.Framework"/>
<Reference name="OpenTK.OpenGL"/>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.Examples.OpenGL.Basic.NoFramework" path=".\Source\Examples\OpenGL\Basic\NoFramework" language="C#" type="WinExe">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Debug\Examples</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Release\Examples</OutputPath>
</Options>
</Configuration>
<Reference name="OpenTK.Framework"/>
<Reference name="OpenTK.OpenGL"/>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.Examples.OpenGL.Basic.QueryDisplayModes" path=".\Source\Examples\OpenGL\Basic\QueryDisplayModes" language="C#" type="WinExe">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Debug\Examples</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Release\Examples</OutputPath>
</Options>
</Configuration>
<Reference name="OpenTK.Framework"/>
<Reference name="OpenTK.OpenGL"/>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.Examples.OpenGL.GLSL.Lesson01" path=".\Source\Examples\OpenGL\GLSL\Lesson01" language="C#" type="WinExe">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Debug\Examples</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Release\Examples</OutputPath>
</Options>
</Configuration>
<Reference name="OpenTK.Framework"/>
<Reference name="OpenTK.OpenGL"/>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
</Solution>
</Prebuild>

47
Release.txt Normal file
View file

@ -0,0 +1,47 @@
================================================================================
OpenTK 0.3.6 WIP alpha Release notes
IMPORTANT: This release is intended for testing and experimentation only. Use at your own risk!
--------------------------------------------------------------------------------
Highlights:
* Supports the latest OpenGL extensions according to the released specs.
* Implements preliminary high-level support for display lists (DisplayList class)
* New example: OpenTK.Basic.DisplayLists
--------------------------------------------------------------------------------
For support, bug reports, feature requests and flames, please visit the OpenTK site: http://opentk.sourceforge.net/
The latest version is always available at http://sourceforge.net/projects/opentk
For the bleeding edge code, checkout https://svn.sourceforge.net/svnroot/opentk
================================================================================
The version number for this release is:
0. 3. 6. 2
(major) (minor) (release) (revision)
The odd minor version number denotes that this is a WIP (Work In Progress). This means that the source and the public API (APplication Interface) may change rapidly from release to release.
This is an alpha release. This means it is not feature complete - more features are planned or are in currently in development. When all planned features are ready for testing, this package will move to the beta phase, were the focus will change to testing and bug-fixing.
Missing features include more fine-grained window and context management, High-level OpenGL bindings and several other things. Also expect the naming scheme to change over the next few versions.
================================================================================
This package contains the source for:
OpenTK.OpenGL (0.3.6.2)
OpenTK.OpenGL.Bind (0.9.0.3)
OpenTK.Framework (0.3.3.1)
OpenTK.Platform.Windows (0.1.1.0)
OpenTK.Platform.X11 (0.1.1.0)
OpenTK.OpenGL.Examples.Basic (Lesson01, DisplayLists, NoFramework, QueryDisplayModes)
OpenTK.OpenGL.Examples.GLSL (Lesson01)
================================================================================

View file

@ -0,0 +1,170 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Erik Ylvisaker and Stephen Apostolopoulos.
*/
#endregion
#region --- Using Directives ---
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using OpenTK.OpenGL;
using Enums = OpenTK.OpenGL.Enums;
#endregion
namespace Lesson01
{
public class Cube : OpenTK.Framework
{
static float angle;
#region Entry point
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
new Cube().Run();
}
#endregion
#region Load event handler
protected override void OnLoad(object sender, EventArgs e)
{
base.OnLoad(sender, 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);
GL.Enable(Enums.EnableCap.DEPTH_TEST);
OnResize(this, e);
}
#endregion
#region Resize event handler
protected override void OnResize(object sender, EventArgs e)
{
base.OnResize(sender, e);
// if (this.Context == null)
// return;
if (ClientSize.Height == 0)
ClientSize = new System.Drawing.Size(ClientSize.Width, 1);
GL.Viewport(0, 0, ClientSize.Width, ClientSize.Height);
double ratio = 0.0;
ratio = ClientSize.Width / (double)ClientSize.Height;
//if (ClientSize.Width > ClientSize.Height)
// ratio = ClientSize.Width / (double)ClientSize.Height;
//else
// ratio = ClientSize.Height / (double)ClientSize.Width;
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, ratio, 1.0, 64.0);
}
#endregion
#region Paint event handler
protected override void OnPaint()
{
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
Glu.LookAt(
0.0, 5.0, 5.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0
);
GL.Rotatef(angle, 0.0f, 1.0f, 0.0f);
angle += 0.5f;
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT | Enums.ClearBufferMask.DEPTH_BUFFER_BIT);
DrawCube();
ActiveContext.SwapBuffers();
}
#endregion
#region KeyDown event handler
protected override void OnKeyDown(object sender, KeyEventArgs e)
{
base.OnKeyDown(sender, e);
switch (e.KeyData)
{
case Keys.Escape:
Application.Exit();
break;
case Keys.F1:
this.SetResolution(this.Width, this.Height, this.ColorDepth, !this.IsFullscreen);
break;
}
}
#endregion
#region DrawCube
public void DrawCube()
{
GL.Begin(Enums.BeginMode.QUADS);
GL.Color3f(1, 0, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Color3f(1, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Color3f(1, 0, 1);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Color3f(0, 0, 1);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 1);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.End();
}
#endregion
}
}

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("001 - Cube")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("001 - Cube")]
[assembly: AssemblyCopyright("Copyright © 2006, 2007")]
[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("462dc50a-1799-43d2-8e28-af3c0a13f788")]
// 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 Lesson02.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("Lesson02.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 Lesson02.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,169 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
#region --- Using Directives ---
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;
using Enums = OpenTK.OpenGL.Enums;
#endregion --- Using Directives ---
namespace OpenTK.Examples.OpenGL.Basic.DisplayLists
{
public partial class DisplayLists : Framework
{
#region --- Variables ---
List<DisplayList> lists = new List<DisplayList>();
#endregion --- Variables ---
#region --- Methods ---
[STAThread]
public static void Main()
{
new DisplayLists().Run();
}
#endregion --- Methods ---
#region --- Event Handlers ---
#region OnLoad
protected override void OnLoad(object sender, EventArgs e)
{
base.OnLoad(sender, e);
Text =
"DisplayLists example (" +
GL.GetString(Enums.StringName.RENDERER) + " " +
GL.GetString(Enums.StringName.VERSION)
+ ")";
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
GL.Enable(Enums.EnableCap.DEPTH_TEST);
// Build some display lists.
float c = 0;
const int numDisplayLists = 9;
for (int i = numDisplayLists; i > 0; i--)
{
DisplayList d = new DisplayList();
d.Begin();
GL.Color3d(
1.0,
c,
1 - c
);
GL.Begin(Enums.BeginMode.QUADS);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f( 1.0f, -1.0f, 1.0f);
GL.Vertex3f( 1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.End();
d.End();
lists.Add(d);
c += 1 / (float)numDisplayLists;
}
OnResize(this, null);
}
#endregion
#region OnResize
protected override void OnResize(object sender, EventArgs e)
{
base.OnResize(sender, e);
if (ClientSize.Height == 0)
ClientSize = new System.Drawing.Size(ClientSize.Width, 1);
GL.Viewport(0, 0, ClientSize.Width, ClientSize.Height);
double ratio = 0.0;
ratio = ClientSize.Width / (double)ClientSize.Height;
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, ratio, 1.0, 64.0);
Glu.LookAt(
0.0, 0.0, 16.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0
);
}
#endregion
#region OnPaint
protected override void OnPaint()
{
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT | Enums.ClearBufferMask.DEPTH_BUFFER_BIT);
double angle = 0.0;
foreach (DisplayList d in lists)
{
GL.LoadIdentity();
GL.Rotated(angle, 0.0, 0.0, 1.0);
GL.Translated(5.0, 0.0, 0.0);
d.Render();
angle += 360 / lists.Count;
}
ActiveContext.SwapBuffers();
}
#endregion
#region OnKeyDown
protected override void OnKeyDown(object sender, KeyEventArgs e)
{
base.OnKeyDown(sender, e);
switch (e.KeyData)
{
case Keys.Escape:
Application.Exit();
break;
case Keys.F1:
this.SetResolution(this.Width, this.Height, this.ColorDepth, !this.IsFullscreen);
break;
}
}
#endregion
#endregion --- Event Handlers ---
}
}

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("NoFramework")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoFramework")]
[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("f54e9ba9-854c-4baf-ae19-a1bbbfe6fbf3")]
// 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,71 @@
//------------------------------------------------------------------------------
// <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 NoFramework.Properties
{
/// <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 ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NoFramework.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,30 @@
//------------------------------------------------------------------------------
// <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 NoFramework.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,183 @@
namespace NoFramework
{
partial class QueryModesForm
{
/// <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.panel1 = new System.Windows.Forms.Panel();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel2 = new System.Windows.Forms.Panel();
this.create1 = new System.Windows.Forms.Button();
this.dispose1 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.create2 = new System.Windows.Forms.Button();
this.dispose2 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Location = new System.Drawing.Point(12, 12);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(283, 131);
this.panel1.TabIndex = 0;
//
// timer1
//
this.timer1.Interval = 40;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// 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, 149);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(283, 130);
this.panel2.TabIndex = 0;
//
// create1
//
this.create1.Location = new System.Drawing.Point(6, 19);
this.create1.Name = "create1";
this.create1.Size = new System.Drawing.Size(63, 23);
this.create1.TabIndex = 0;
this.create1.Text = "Create";
this.create1.UseVisualStyleBackColor = true;
this.create1.Click += new System.EventHandler(this.create1_Click);
//
// dispose1
//
this.dispose1.Enabled = false;
this.dispose1.Location = new System.Drawing.Point(6, 48);
this.dispose1.Name = "dispose1";
this.dispose1.Size = new System.Drawing.Size(63, 23);
this.dispose1.TabIndex = 0;
this.dispose1.Text = "Dispose";
this.dispose1.UseVisualStyleBackColor = true;
this.dispose1.Click += new System.EventHandler(this.dispose1_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.create1);
this.groupBox1.Controls.Add(this.dispose1);
this.groupBox1.Location = new System.Drawing.Point(301, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(75, 77);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Context";
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.create2);
this.groupBox2.Controls.Add(this.dispose2);
this.groupBox2.Location = new System.Drawing.Point(301, 149);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(75, 77);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Context";
//
// create2
//
this.create2.Location = new System.Drawing.Point(6, 19);
this.create2.Name = "create2";
this.create2.Size = new System.Drawing.Size(63, 23);
this.create2.TabIndex = 0;
this.create2.Text = "Create";
this.create2.UseVisualStyleBackColor = true;
this.create2.Click += new System.EventHandler(this.create2_Click);
//
// dispose2
//
this.dispose2.Enabled = false;
this.dispose2.Location = new System.Drawing.Point(6, 48);
this.dispose2.Name = "dispose2";
this.dispose2.Size = new System.Drawing.Size(63, 23);
this.dispose2.TabIndex = 0;
this.dispose2.Text = "Dispose";
this.dispose2.UseVisualStyleBackColor = true;
this.dispose2.Click += new System.EventHandler(this.dispose2_Click);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 287);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(210, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Press F1 to toggle FullScreen / Windowed.";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(388, 310);
this.Controls.Add(this.label1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.KeyPreview = true;
this.Name = "Form1";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
this.Text = "Form1";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button create1;
private System.Windows.Forms.Button dispose1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button create2;
private System.Windows.Forms.Button dispose2;
private System.Windows.Forms.Label label1;
}
}

View file

@ -0,0 +1,279 @@
#region --- Using Directives ---
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenTK.OpenGL;
using Enums = OpenTK.OpenGL.Enums;
#endregion
namespace NoFramework
{
public partial class QueryModesForm : Form
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new QueryModesForm());
}
GLContext context1, context2;
public QueryModesForm()
{
InitializeComponent();
timer1.Enabled = true;
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
if (context1 != null)
context1.Dispose();
if (context2 != null)
context2.Dispose();
}
static float angle;
#region Load event handler
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
OnResize(e);
}
#endregion
int count;
private void timer1_Tick(object sender, EventArgs e)
{
PaintGLScene();
count++;
if (count == 20)
create1_Click(null, EventArgs.Empty);
if (context1 == null)
return;
//if (count == 60)
// ToggleFullScreen();
if (context1.IsFullscreen)
{
this.Location = new Point(this.Location.X + (int)(Math.Sin(count / (5 * Math.PI)) * 3),
this.Location.Y);
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
PaintGLScene();
}
private void PaintGLScene()
{
RenderToContext(context1, 0);
RenderToContext(context2, 45);
}
private void RenderToContext(GLContext context, float angle_add)
{
if (context == null)
return;
context.MakeCurrent();
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
GL.Enable(Enums.EnableCap.DEPTH_TEST);
GL.Viewport(0, 0, context.Width, context.Height);
double ratio = 0.0;
ratio = context.Width / (double)context.Height;
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, context.AspectRatio, 1.0, 64.0);
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
Glu.LookAt(
0.0, 5.0, 5.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0
);
GL.Rotatef(angle + angle_add, 0.0f, 1.0f, 0.0f);
angle += 0.5f;
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT | Enums.ClearBufferMask.DEPTH_BUFFER_BIT);
DrawCube();
if (context == null)
{
Console.WriteLine("Context is null! Press any key to crash.");
Console.ReadKey();
}
context.SwapBuffers();
}
#region KeyDown event handler
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
switch (e.KeyData)
{
case Keys.Escape:
Application.Exit();
break;
case Keys.F1:
//this.SetResolution(this.Width, this.Height, this.ColorDepth, !this.Fullscreen);
break;
}
}
#endregion
#region DrawCube
public void DrawCube()
{
GL.Begin(Enums.BeginMode.QUADS);
GL.Color3f(1, 0, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Color3f(1, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Color3f(1, 0, 1);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Color3f(0, 0, 1);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 1);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.End();
}
#endregion
private void create1_Click(object sender, EventArgs e)
{
context1 = GLContext.Create(panel1, new OpenTK.OpenGL.ColorDepth(8, 8, 8, 8), 8, 0);
create1.Enabled = false;
dispose1.Enabled = true;
Text =
GL.GetString(Enums.StringName.VENDOR) + " " +
GL.GetString(Enums.StringName.RENDERER) + " " +
GL.GetString(Enums.StringName.VERSION);
}
private void create2_Click(object sender, EventArgs e)
{
context2 = GLContext.Create(panel2, new OpenTK.OpenGL.ColorDepth(8, 8, 8, 8), 8, 0);
create2.Enabled = false;
dispose2.Enabled = true;
}
private void dispose1_Click(object sender, EventArgs e)
{
context1.Dispose();
context1 = null;
panel1.Invalidate();
create1.Enabled = true;
dispose1.Enabled = false;
}
private void dispose2_Click(object sender, EventArgs e)
{
context2.Dispose();
context2 = null;
panel2.Invalidate();
create2.Enabled = true;
dispose2.Enabled = false;
}
private void Form1_Load(object sender, EventArgs e)
{
this.BringToFront();
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (context1 == null)
return;
if (e.KeyCode == Keys.F1)
{
ToggleFullScreen();
}
}
private void ToggleFullScreen()
{
if (context1.IsFullscreen)
context1.SetWindowed();
else
{
context1.SetFullScreen(640, 480, new OpenTK.OpenGL.ColorDepth(8, 8, 8, 8));
}
}
}
}

View file

@ -0,0 +1,123 @@
<?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>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -0,0 +1,60 @@
namespace QueryDisplayModes
{
partial class DisplayModesForm
{
/// <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.listBox1 = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// listBox1
//
this.listBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(0, 0);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(292, 264);
this.listBox1.TabIndex = 0;
//
// DisplayModes
//
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.listBox1);
this.Name = "DisplayModes";
this.Text = "Query Display Modes";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListBox listBox1;
}
}

View file

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenTK.OpenGL;
namespace QueryDisplayModes
{
public partial class DisplayModesForm : Form
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new DisplayModesForm());
}
GLContext context;
public DisplayModesForm()
{
InitializeComponent();
context = GLContext.Create(this, new OpenTK.OpenGL.ColorDepth(8, 8, 8, 8), 0, 0);
DisplayMode[] modes = context.EnumDisplayModes();
for (int i = 0; i < modes.Length; i++)
listBox1.Items.Add(modes[i]);
}
}
}

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,11 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace QueryDisplayModes
{
static class Program
{
}
}

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("QueryDisplayModes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QueryDisplayModes")]
[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("27ed3249-d42f-4f47-b80a-5d8039d18d77")]
// 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,71 @@
//------------------------------------------------------------------------------
// <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 QueryDisplayModes.Properties
{
/// <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 ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("QueryDisplayModes.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,30 @@
//------------------------------------------------------------------------------
// <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 QueryDisplayModes.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,235 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
#region --- Using Directives ---
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using OpenTK.OpenGL;
using Enums = OpenTK.OpenGL.Enums;
#endregion --- Using Directives ---
namespace OpenTK.Examples.OpenGL.GLSL
{
public class Cube : Framework
{
#region --- Variables ---
#region Shaders
string[] vertex_shader_source =
{
"void main() {",
"gl_FrontColor = gl_Color;",
"gl_Position = ftransform();",
"}",
};
string[] fragment_shader_source =
{
"void main() { gl_FragColor = gl_Color; }\0"
};
#endregion
static float angle;
#endregion --- Variables ---
#region --- Methods ---
#region Entry point
[STAThread]
static void Main()
{
new Cube().Run();
}
#endregion
#region DrawCube
public void DrawCube()
{
GL.Begin(Enums.BeginMode.QUADS);
GL.Color3f(1, 0, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Color3f(1, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Color3f(1, 0, 1);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Color3f(0, 0, 1);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 1);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.End();
}
#endregion
#endregion --- Methods ---
#region --- Event Handlers ---
#region OnLoad
protected override void OnLoad(object sender, EventArgs e)
{
base.OnLoad(sender, 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);
GL.Enable(Enums.EnableCap.DEPTH_TEST);
int vertex_shader_object, fragment_shader_object;
int[] status = new int[1];
int shader_program;
vertex_shader_object = GL.CreateShader(Enums.VERSION_2_0.VERTEX_SHADER);
fragment_shader_object = GL.CreateShader(Enums.VERSION_2_0.FRAGMENT_SHADER);
GL.ShaderSource(vertex_shader_object, vertex_shader_source.Length, vertex_shader_source, null);
GL.CompileShader(vertex_shader_object);
GL.GetShaderiv(vertex_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, status);
if (status[0] != (int)Enums.Boolean.TRUE)
{
StringBuilder info = new StringBuilder(1024);
GL.GetShaderInfoLog(vertex_shader_object, info.MaxCapacity, null, info);
throw new Exception(info.ToString());
}
GL.ShaderSource(fragment_shader_object, fragment_shader_source.Length, fragment_shader_source, null);
GL.CompileShader(fragment_shader_object);
GL.GetShaderiv(fragment_shader_object, Enums.VERSION_2_0.COMPILE_STATUS, status);
if (status[0] != (int)Enums.Boolean.TRUE)
{
StringBuilder info = new StringBuilder(1024);
GL.GetShaderInfoLog(fragment_shader_object, 1024, null, info);
throw new Exception(info.ToString());
}
shader_program = GL.CreateProgram();
GL.AttachShader(shader_program, fragment_shader_object);
GL.AttachShader(shader_program, vertex_shader_object);
GL.LinkProgram(shader_program);
GL.UseProgram(shader_program);
OnResize(sender, e);
}
#endregion
#region OnResize
protected override void OnResize(object sender, EventArgs e)
{
base.OnResize(sender, e);
if (ClientSize.Height == 0)
ClientSize = new System.Drawing.Size(ClientSize.Width, 1);
GL.Viewport(0, 0, ClientSize.Width, ClientSize.Height);
double ratio = 0.0;
ratio = ClientSize.Width / (double)ClientSize.Height;
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, ratio, 1.0, 64.0);
}
#endregion
#region OnPaint
protected override void OnPaint()
{
base.OnPaint();
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
Glu.LookAt(
0.0, 5.0, 5.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0
);
GL.Rotatef(angle, 0.0f, 1.0f, 0.0f);
angle += 0.05f;
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT | Enums.ClearBufferMask.DEPTH_BUFFER_BIT);
DrawCube();
ActiveContext.SwapBuffers();
}
#endregion
#region OnKeyDown
protected override void OnKeyDown(object sender, KeyEventArgs e)
{
base.OnKeyDown(sender, e);
switch (e.KeyData)
{
case Keys.Escape:
Application.Exit();
break;
case Keys.F1:
this.SetResolution(this.Width, this.Height, this.ColorDepth, !this.IsFullscreen);
break;
}
}
#endregion
#endregion --- Event Handlers ---
}
}

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("GLSL.Lesson01")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GLSL.Lesson01")]
[assembly: AssemblyCopyright("Copyright © 2006 Stephen Apostolopoulos")]
[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("74f178b6-84df-466f-b144-74027560980b")]
// 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.Examples.OpenGL.GLSL.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.Examples.OpenGL.GLSL.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.Examples.OpenGL.GLSL.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,693 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos and Erik Ylvisaker.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Threading;
using OpenTK.Platform.Windows;
using System.Runtime.InteropServices;
using OpenTK.OpenGL.Platform;
using OpenTK.OpenGL;
namespace OpenTK
{
public class Framework : IDisposable
{
#region --- Private variables ---
private Form activeForm;
private GLContext activeContext;
private PlatformSpecific platform;
private OpenGL.ColorDepth colorDepth;
private int zDepth;
private int stencilDepth;
private string text = "OpenTK application";
#endregion
Application.MessageLoopCallback MessageLoop;
#region --- Public Properties ---
public Form ActiveForm
{
get { return activeForm; }
}
public GLContext ActiveContext
{
get { return activeContext; }
private set { activeContext = value; }
}
public string Text
{
get { return text; }
set
{
text = value;
if (activeForm != null)
activeForm.Text = value;
}
}
public Size ClientSize
{
get { return ActiveForm.ClientSize; }
set { activeForm.ClientSize = value; }
}
public int Width
{
get { return ClientSize.Width; }
set { ClientSize = new Size(value, ClientSize.Height); }
}
public int Height
{
get { return ClientSize.Height; }
set { ClientSize = new Size(ClientSize.Width, value); }
}
public bool IsFullscreen
{
get
{
return ActiveContext.IsFullscreen;
}
}
public OpenGL.ColorDepth ColorDepth
{
get { return colorDepth; }
private set { colorDepth = value; }
}
public int ZDepth
{
get { return zDepth; }
set { zDepth = value; }
}
public int StencilDepth
{
get { return stencilDepth; }
set { stencilDepth = value; }
}
#endregion
#region --- Creation and Destruction ---
/// <summary>
/// Constructs a Framework object with default (safe) parameters.
/// </summary>
public Framework()
: this(null, 640, 480, new OpenTK.OpenGL.ColorDepth(8, 8, 8, 8), 16, 0, false)
{ }
/// <summary>
/// Construcs a Framework object with the given parameters.
/// </summary>
/// <param name="title">The Title of the Form.</param>
/// <param name="width">The Width of the Form.</param>
/// <param name="height">The Height of the Form.</param>
/// <param name="color">The ColorDepth of the OpenGL Context.</param>
/// <param name="depth">The ZDepth of the OpenGL Context.</param>
/// <param name="stencil">The StencilDepth of the OpenGL Context.</param>
/// <param name="fullscreen">The Fullscreen property of the Form.</param>
public Framework(string title, int width, int height, OpenTK.OpenGL.ColorDepth color,
int depth, int stencil, bool fullscreen)
{
platform = PlatformSpecific.CreatePlatformMethods();
Setup(title, width, height, color, depth, stencil, fullscreen);
}
~Framework()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected void Dispose(bool disposing)
{
if (disposing)
{
}
if (activeContext != null)
{
activeContext.Dispose();
activeContext = null;
}
if (activeForm != null)
{
activeForm.Dispose();
activeForm = null;
}
}
#endregion
#region --- Creation and setup of windows ---
private void Setup(string title, int width, int height, OpenTK.OpenGL.ColorDepth color,
int depth, int stencil, bool fullscreen)
{
System.Console.WriteLine("Created Framework.");
// Initialise components.
ColorDepth = color;
ZDepth = depth;
StencilDepth = stencil;
if (string.IsNullOrEmpty(title) == false)
Text = title;
if (fullscreen)
CreateFullScreenDisplay(width, height);
else
CreateWindowedDisplay(width, height);
//Application.Idle += this.OnIdle;
//MessageLoop = new Application.MessageLoopCallback(MainLoop);
//Application.RegisterMessageLoop(MessageLoop);
System.Console.WriteLine("Done Initializing.");
}
private void CreateWindowedDisplay(int width, int height)
{
DisposeForm();
activeForm = new WindowedForm();
activeForm.Text = Text;
activeContext = GLContext.Create(activeForm,
this.ColorDepth, this.ZDepth, this.StencilDepth);
AttachEvents(activeForm);
activeForm.ClientSize = new Size(width, height);
activeForm.TopMost = true;
activeForm.Enabled = true;
activeForm.Show();
}
private void CreateFullScreenDisplay(int width, int height)
{
DisposeForm();
activeForm = new FullScreenForm();
activeForm.Text = Text;
activeContext = GLContext.Create(activeForm,
this.ColorDepth, this.ZDepth, this.StencilDepth);
AttachEvents(activeForm);
activeForm.FormBorderStyle = FormBorderStyle.None;
activeForm.ClientSize = new Size(width, height);
activeForm.Location = Point.Empty;
activeForm.TopMost = true;
activeForm.Enabled = true;
activeForm.Show();
activeContext.SetFullScreen(width, height, ColorDepth);
}
private void AttachEvents(Form frm)
{
frm.Load += this.OnLoad;
frm.Resize += this.OnResize;
frm.Paint += this.OnPaint;
frm.KeyDown += this.OnKeyDown;
frm.KeyUp += this.OnKeyUp;
frm.KeyPress += this.OnKeyPress;
frm.Click += this.OnClick;
frm.MouseDown += this.OnMouseDown;
frm.MouseEnter += this.OnMouseEnter;
frm.MouseHover += this.OnMouseHover;
frm.MouseLeave += this.OnMouseLeave;
frm.MouseMove += this.OnMouseMove;
frm.MouseUp += this.OnMouseUp;
frm.MouseWheel += this.OnMouseWheel;
}
#endregion
#region --- Events ---
virtual protected void OnIdle(object sender, EventArgs e)
{
while (ActiveForm != null && platform.IsIdle())
{
if (!ActiveForm.Focused)
{
Thread.Sleep(100);
}
this.OnPaint();
}
}
virtual protected void OnMouseWheel(object sender, MouseEventArgs e)
{
if (MouseWheel != null)
MouseWheel(sender, e);
}
virtual protected void OnMouseUp(object sender, MouseEventArgs e)
{
if (MouseUp != null)
MouseUp(sender, e);
}
virtual protected void OnMouseMove(object sender, MouseEventArgs e)
{
if (MouseMove != null)
MouseMove(sender, e);
}
virtual protected void OnMouseLeave(object sender, EventArgs e)
{
if (MouseLeave != null)
MouseLeave(sender, e);
}
virtual protected void OnMouseHover(object sender, EventArgs e)
{
if (MouseHover != null)
MouseHover(sender, e);
}
virtual protected void OnMouseEnter(object sender, EventArgs e)
{
if (MouseEnter != null)
MouseEnter(sender, e);
}
virtual protected void OnMouseDown(object sender, MouseEventArgs e)
{
if (MouseDown != null)
MouseDown(sender, e);
}
virtual protected void OnClick(object sender, EventArgs e)
{
if (Click != null)
Click(sender, e);
}
virtual protected void OnKeyPress(object sender, KeyPressEventArgs e)
{
if (KeyPress != null)
KeyPress(sender, e);
}
virtual protected void OnKeyUp(object sender, KeyEventArgs e)
{
if (KeyUp != null)
KeyUp(sender, e);
}
virtual protected void OnKeyDown(object sender, KeyEventArgs e)
{
if (KeyDown != null)
KeyDown(sender, e);
}
private void OnPaint(object sender, PaintEventArgs e)
{
OnPaint();
if (Paint != null)
Paint(sender, e);
}
virtual protected void OnPaint()
{
}
virtual protected void OnResize(object sender, EventArgs e)
{
if (Resize != null)
Resize(sender, e);
}
virtual protected void OnLoad(object sender, EventArgs e)
{
if (Load != null)
Load(sender, e);
}
public event EventHandler Load;
public event EventHandler Resize;
public event PaintEventHandler Paint;
public event KeyEventHandler KeyDown;
public event KeyEventHandler KeyUp;
public event KeyPressEventHandler KeyPress;
public event EventHandler Click;
public event MouseEventHandler MouseDown;
public event EventHandler MouseEnter;
public event EventHandler MouseHover;
public event EventHandler MouseLeave;
public event MouseEventHandler MouseMove;
public event MouseEventHandler MouseUp;
public event MouseEventHandler MouseWheel;
#endregion
#region --- Window Management ---
private void DisposeForm()
{
if (activeContext != null)
activeContext.Dispose();
if (activeForm != null)
activeForm.Dispose();
activeContext = null;
activeForm = null;
}
public void SetResolution(int width, int height, OpenGL.ColorDepth color, bool fullscreen)
{
ColorDepth = color;
if (fullscreen && IsFullscreen)
{
activeForm.ClientSize = new Size(width, height);
activeContext.SetFullScreen(width, height, color);
}
else if (fullscreen && !IsFullscreen)
{
CreateFullScreenDisplay(width, height);
}
else
{
CreateWindowedDisplay(width, height);
}
}
#endregion
#region --- Main Loop ---
/// <summary>
/// Enters the Framework's main loop, updating state and rendering.
/// </summary>
public void Run()
{
// TODO: Find a better main loop. This is evil! (Probably a custom main loop or something based on the Idle event).
while (ActiveForm != null && ActiveForm.IsDisposed == false)
{
OnPaint(this, null);
if (platform.IsIdle() == false)
Application.DoEvents();
}
}
#endregion
}
#region Old Code
/*
public partial class Framework : Form, IDisposable
{
#region Public properties
#region Context
private GLContext _context;
public GLContext Context
{
get { return _context; }
internal set { _context = value; }
}
#endregion
#region Fullscreen property
private bool _fullscreen;
public bool Fullscreen
{
get { return _fullscreen; }
internal set { _fullscreen = value; }
}
#endregion
#region ColorDepth property
private OpenTK.OpenGL.ColorDepth _color_depth;
public OpenTK.OpenGL.ColorDepth ColorDepth
{
get { return _color_depth; }
internal set { _color_depth = value; }
}
#endregion
#region ZDepth property
private int _z_depth;
public int ZDepth
{
get { return _z_depth; }
internal set { _z_depth = value; }
}
#endregion
#region StencilDepth property
private int _stencil_depth;
public int StencilDepth
{
get { return _stencil_depth; }
internal set { _stencil_depth = value; }
}
#endregion
#region DesktopResolution property
private Size _desktop_resolution;
public Size DesktopResolution
{
get { return _desktop_resolution; }
internal set { _desktop_resolution = value; }
}
#endregion
#region DesktopRefreshRate property
private float _desktop_refresh_rate;
public float DesktopRefreshRate
{
get { return _desktop_refresh_rate; }
internal set { _desktop_refresh_rate = value; }
}
#endregion
#region DesktopColorDepth property
private OpenTK.OpenGL.ColorDepth _desktop_color_depth;
public OpenTK.OpenGL.ColorDepth DesktopColorDepth
{
get { return _desktop_color_depth; }
internal set { _desktop_color_depth = value; }
}
#endregion
#endregion
FrameworkImplementation Implementation;
#region Constructors
public Framework()
{
Setup(null, 800, 600, new OpenTK.OpenGL.ColorDepth(8, 8, 8, 8), 16, 0, false);
}
public Framework(string title, int width, int height, OpenTK.OpenGL.ColorDepth color, int depth, int stencil, bool fullscreen)
{
Setup(title, width, height, color, depth, stencil, fullscreen);
}
#endregion
#region Setup(string title, int width, int height, OpenTK.OpenGL.ColorDepth color, int depth, int stencil, bool fullscreen)
private void Setup(string title, int width, int height, OpenTK.OpenGL.ColorDepth color, int depth, int stencil, bool fullscreen)
{
System.Console.WriteLine("Created Framework.");
// Set platform.
try
{
PlatformID platform = Environment.OSVersion.Platform;
if (platform == PlatformID.Win32NT ||
platform == PlatformID.Win32Windows)
{
System.Console.Write("Instantiating Windows Implementation...");
Implementation = new WindowsImplementation(this);
System.Console.WriteLine("success.");
}
else if (platform == PlatformID.Unix ||
platform == (PlatformID)128) // older versions of Mono report 128.
{
System.Console.Write("Instantiating X11 Implementation...");
Implementation = new X11Implementation(this);
System.Console.WriteLine("success.");
}
else
{
throw new PlatformNotSupportedException("The platform on which you are trying to run this program is not currently supported. Sorry for the inconvenience.");
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
throw e;
}
this.HandleCreated += new EventHandler(Implementation.OnHandleCreated);
//Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
//if (xplatui != null)
//{
// Context = GLContext.Create(this, 8, 8, 8, 8, 16, 0);
// //Context.MakeCurrent();
//}
// Initialise components.
ColorDepth = color;
ZDepth = depth;
StencilDepth = stencil;
System.Console.WriteLine("Creating Context.");
Context = GLContext.Create(this, color, depth, stencil);
// Code taken from NeHe tutorials
this.CreateParams.Style |= (int)WinApi.WindowClassStyle.HRedraw | (int)WinApi.WindowClassStyle.VRedraw | (int)WinApi.WindowClassStyle.OwnDC;
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); // No Need To Erase Form Background
this.SetStyle(ControlStyles.Opaque, true); // No Need To Draw Form Background
//this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // Buffer Control
//this.SetStyle(ControlStyles.ResizeRedraw, true); // Redraw On Resize
this.SetStyle(ControlStyles.UserPaint, true); // We'll Handle Painting Ourselves
System.Console.WriteLine("Setting Resolution.");
Implementation.SetResolution(width, height, color, fullscreen);
if (string.IsNullOrEmpty(title))
title = "OpenTK Windows application";
this.Text = title;
Application.Idle += new EventHandler(OnIdle);
System.Console.WriteLine("Done Initializing.");
}
#endregion
#region Event Handlers
/// <summary>
/// Called when all pending messages have been processed, this is where the application 'Main Loop' resides.
/// </summary>
/// <param name="sender">Not used.</param>
/// <param name="e">Not used.</param>
protected internal void OnIdle(object sender, EventArgs args)
{
while (Implementation.IsIdle())
{
//if (ActiveForm != this)
// Thread.Sleep(100);
OnPaint(null);
}
}
#endregion
internal new void SetTopLevel(bool topLevel)
{
base.SetTopLevel(topLevel);
}
#region Public member functions
/// <summary>
/// Requests mode change. The parameters are hints for the mode, which may or may not be
/// possible according to the hardware.
/// </summary>
/// <param name="width">The horizontal resolution in pixels.</param>
/// <param name="height">The vertical resolution in pixels.</param>
/// <param name="color">The color depth.</param>
/// <param name="fullscreen">Set to true to set a fullscreen mode or false to set a windowed mode.</param>
/// <returns>True if the mode set was fullscreen, false otherwise.</returns></returns>
public void SetResolution(int width, int height, OpenTK.OpenGL.ColorDepth color, bool fullscreen)
{
Implementation.SetResolution(width, height, color, fullscreen);
}
#endregion
#region IDisposable Members
void IDisposable.Dispose()
{
//GC.SuppressFinalize(true);
Application.Idle -= OnIdle;
}
#endregion
}
* */
#endregion
}

View file

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace OpenTK
{
public partial class FullScreenForm : Form
{
public FullScreenForm()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); // No Need To Erase Form Background
this.SetStyle(ControlStyles.Opaque, true); // No Need To Draw Form Background
//this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // Buffer Control
//this.SetStyle(ControlStyles.ResizeRedraw, true); // Redraw On Resize
this.SetStyle(ControlStyles.UserPaint, true); // We'll Handle Painting Ourselves
}
}
}

View file

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK
{
public class PlatformSpecific
{
public static PlatformSpecific CreatePlatformMethods()
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
Environment.OSVersion.Platform == PlatformID.Win32Windows)
{
return new WindowsPlatform();
}
else if (Environment.OSVersion.Platform == PlatformID.Unix ||
Environment.OSVersion.Platform == (PlatformID)128) // some older versions of Mono reported 128.
{
return new X11Platform();
}
else
{
// return an object which implements the base methods, using "safe" .net fallback routines.
return new PlatformSpecific();
//throw new PlatformNotSupportedException("The platform on which you are trying to run this program is not currently supported. Sorry for the inconvenience.");
}
}
protected PlatformSpecific()
{
}
public virtual bool IsIdle()
{
return false;
}
public virtual bool ProcessEvents()
{
return false;
}
}
}

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("Framework")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Framework")]
[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("7652241e-158d-4eb1-85f4-ed40ee356791")]
// 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.2.0")]
[assembly: AssemblyFileVersion("0.3.2.0")]

View file

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace OpenTK
{
public partial class WindowedForm : Form
{
public WindowedForm()
{
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); // No Need To Erase Form Background
this.SetStyle(ControlStyles.Opaque, true); // No Need To Draw Form Background
//this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // Buffer Control
//this.SetStyle(ControlStyles.ResizeRedraw, true); // Redraw On Resize
this.SetStyle(ControlStyles.UserPaint, true); // We'll Handle Painting Ourselves
}
}
}

View file

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Platform.Windows;
namespace OpenTK
{
class WindowsPlatform : PlatformSpecific
{
public override bool IsIdle()
{
WinApi.Message msg;
return !WinApi.PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
}
public override bool ProcessEvents()
{
return base.ProcessEvents();
}
}
}

View file

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Platform.X;
namespace OpenTK
{
class X11Platform : PlatformSpecific
{
IntPtr display;
public X11Platform()
{
Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
if (xplatui != null)
{
Console.WriteLine("Got XplatUIX11 type.");
display = (IntPtr)xplatui.GetField("DisplayHandle",
System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic).GetValue(null);
}
}
public override bool IsIdle()
{
return (X11Api.Pending(display) == 0) ? true : false;
}
}
}

View file

@ -0,0 +1,53 @@
OpenTK.OpenGL.Bind 0.9.3
0.7.7 -> 0.9.3
+ Synced code with Tao.GlBindGen
+ Re-enabled extensions
+ Updated specs
+ Now uses CodeDOM for code generation
+ Imports and delegates are decorated with the SupressUnmanagedCodeSecurity attribute for call overhead reduction
+ Several bugs have been fixed
0.7.6 -> 0.7.7
+ Several bugfixes regarding bugs from the latest (0.7.6) code synchronisation between Tao.GlBindGen and OpenTK.OpenGL.Bind
+ Split the Enums, Core OpenGL and Extension OpenGL functions into different files. This speeds up the Visual Studio IDE a lot.
+ The Extension functions have been removed from the OpenTK.OpenGL.GL class. They will be added back on a later version, probably as OpenTK.OpenGL.GL.Extensions. No need to clatter up the code API with thousands of mostly useless extensions.
+ Applications load much faster now.
+ Killed the Context class generation. It added a lot of complexity for little gain (what, cleaner OOP internal structure? Oh, please!) This move frees up the Context classes which can now be updated without dragging around several thousand function initialisations.
+ OpenTK.OpenGL.GL is self-contained now. Delegates are initialised statically, calling the platform specific *GetAddress functions where needed (they are contained in the GL class, too - but not auto-generated).
+ Revamped the WriteSpecs class. Its methods are now completely modular (enum, core and extension writers have been split).
+ This still needs some refactoring to reduce code copy-paste and allow for future wgl / glx binding generation.
0.7.5.2 -> 0.7.6
+ Added NeedWrapper and WrapperType properties to each parameter (needed for more fine grained control on wrapper generation).
+ Added Function, Parameter, ParameterCollection (deep) copy constructors. This allows simpler code in many places (since we can now create new Functions without fear of affecting the old ones, for example).
+ Merged the ParameterCollection.cs with Parameter.cs
+ Added the FunctionBody class which contains the contents of a function as a list of strings. It is mainly intended for wrappers (allows cleaner code, too).
+ The wrapper generation now happens in TranlateSpecs.cs instead of WriteSpecs.cs. (Translations and generations should only happen during the translation phase, not while reading or writing. Allow for cleaner code).
+ Revamped the wrapper generator code. Now it handles correctly the cases where a function has more than one parameter that needs wrapping (i.e. it generates all permutations correctly). This is handled by recursively generating the needed permutations (it was a hell to implement).
+ Added some comments (many more to follow).
+ Removed some commented-out regions and some obsolete functions.
0.7.5.1 -> 0.7.5.2
+ Added translation for out char[] parameters (they are treated as StringBuilders, as specified in MSDN).
+ Added System.Text using directive.
0.7.5 -> 0.7.5.1
+ Added license information to the generated bindings.
+ Changed the name of the main Context class to GLContext (Context is used in the BCL).
0.7.4 -> 0.7.5
+ Added wrappers for all functions that accept arrays. Permitted parameters for these are: an array of the original type (e.g. float[]), an IntPtr (if you manage memory yourself), or any blittable type (e.g. float[,,]). No type checking is done in the last case, so be careful!
+ Updated the wrappers for all functions that accept or return void pointers. Permitted parameters for these are: an IntPtr or any blittable type (type checking is turned off, so be extra careful!)
+ Aliased the GLbool type to int. It is hacky, but the examples bundled with Tao rely on this...
+ Added a wrapper for glLineStipple. Now you can pass an int to it, but only the last 16 bits will be used for the stipple (as per the function specification). This was the only way to avoid aliasing the parameter to ushort (non-CLS compatible) or having the user write unchecked((short)0x....) every time he used the function.
+ Added the WrapperType enum. Every function has a Property that indicates the wrapper it will need. This cleans up the WriteWrappers function somewhat.
+ Added the PreviousType property to the Function class. This is used when generating wrappers for functions with type-checked arrays (e.g. float[] arrays etc).
+ Corrected some type aliases in cs_types.txt
+ Added the missing wrappers for glReadPixels! (this falls in the out void array).
+ A missing enum now defaults to Enum.[Function category] (a new property was added to the Function class and the SpecReader.ReadFunctions function was modified). I should test this to see if it works ok.

View file

@ -0,0 +1,11 @@
OpenTK.OpenGL.Bind 0.9.4 todos:
Major:
+ Change the output of extensions from GL.BlahARB to GL.ARB.Blah
+ Use generics instead of object overloads.
+ Add ref overloads for arrays
Minor:
+ Clean up the reader.
+ Add more settings to Settings.cs (the name of the files to read).
+ Comment the code.

128
Source/OpenGL/Bind/Main.cs Normal file
View file

@ -0,0 +1,128 @@
#region License
/*
MIT License
Copyright ©2003-2006 Tao Framework Team
http://www.taoframework.com
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion License
using System;
using System.Text;
using System.IO;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Collections.Generic;
using System.CodeDom;
namespace OpenTK.OpenGL.Bind
{
static class MainClass
{
static void Main(string[] arguments)
{
Console.WriteLine("OpenGL binding generator {0} for OpenTK.",
System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
Console.WriteLine("For comments, bugs and suggestions visit http://opentk.sourceforge.net");
//Console.WriteLine(" - the OpenTK team ;-)");
Console.WriteLine();
#region Handle Arguments
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":
Settings.InputPath = b[1];
break;
case "out":
case "Properties.Bind.Default.OutputPath":
Settings.OutputPath = b[1];
break;
case "class":
Settings.GLClass = 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;
}
#endregion
try
{
long ticks = System.DateTime.Now.Ticks;
List<CodeMemberMethod> functions;
List<CodeTypeDelegate> delegates;
CodeTypeDeclarationCollection enums;
CodeTypeDeclarationCollection enums2;
delegates = SpecReader.ReadFunctionSpecs("gl.spec");
SpecReader.ReadEnumSpecs("enum.spec", out enums);
SpecReader.ReadEnumSpecs("enumext.spec", out enums2);
enums = SpecTranslator.Merge(enums, enums2);
enums = SpecTranslator.TranslateEnums(enums);
functions = SpecTranslator.TranslateDelegates(delegates, enums);
// Generate the code
SpecWriter.Generate(delegates, functions, enums);
ticks = System.DateTime.Now.Ticks - ticks;
Console.WriteLine("Bindings generated in {0} seconds.", ticks / (double)10000000.0);
Console.WriteLine();
Console.WriteLine("Press enter to continue...");
Console.ReadLine();
}
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.");
}
}
}
}

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 Stefanos Apostolopoulos")]
[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.9.0.3")]
[assembly: AssemblyFileVersion("0.9.0.3")]

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,24 @@
#region License
//Copyright (c) 2006 Stephen Apostolopoulos
//See license.txt for license info
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
static class Settings
{
public static string InputPath = "..\\..\\..\\Source\\OpenGL\\Specifications";
public static string OutputPath = "..\\..\\..\\Source\\OpenGL\\OpenGL\\Bindings";
public static string OutputNamespace = "OpenTK.OpenGL";
public static string GLClass = "GL";
public static string WglClass = "Wgl";
public static string GlxClass = "Glx";
public static string GluClass = "Glu";
public static string GLFunctionPrepend = String.Empty;
}
}

View file

@ -0,0 +1,423 @@
#region --- License ---
/*
MIT License
Copyright ©2006-2007 Tao Framework Team
http://www.taoframework.com
Copyright ©2005-2007 OpenTK
http://sourceforge.net/projects/opentk
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion License
#region --- Using Directives ---
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.CodeDom;
#endregion
namespace OpenTK.OpenGL.Bind
{
static class SpecReader
{
#region internal static string FilePath
internal static string FilePath
{
get
{
string filePath = Path.Combine("..", "..");
string fileDirectory = Settings.InputPath;
string fileName = "gl.spec";
if (File.Exists(fileName))
{
filePath = "";
fileDirectory = "";
}
else if (File.Exists(Path.Combine(fileDirectory, fileName)))
{
filePath = "";
}
return Path.Combine(filePath, fileDirectory);
}
}
#endregion
#region private static StreamReader OpenSpecFile(string file)
private static StreamReader OpenSpecFile(string file)
{
string path = Path.Combine(FilePath, file);
StreamReader sr;
try
{
sr = new StreamReader(path);
}
catch (Exception e)
{
Console.WriteLine("Error opening spec file: {0}", path);
Console.WriteLine("Error: {0}", e.Message);
throw e;
}
return sr;
}
#endregion
#region private static bool IsExtension(string function_name)
private static bool IsExtension(string function_name)
{
return (function_name.EndsWith("ARB") ||
function_name.EndsWith("EXT") ||
function_name.EndsWith("ATI") ||
function_name.EndsWith("NV") ||
function_name.EndsWith("SUN") ||
function_name.EndsWith("SUNX") ||
function_name.EndsWith("SGI") ||
function_name.EndsWith("SGIS") ||
function_name.EndsWith("SGIX") ||
function_name.EndsWith("MESA") ||
function_name.EndsWith("3DFX") ||
function_name.EndsWith("IBM") ||
function_name.EndsWith("GREMEDY") ||
function_name.EndsWith("HP") ||
function_name.EndsWith("INTEL") ||
function_name.EndsWith("PGI") ||
function_name.EndsWith("INGR") ||
function_name.EndsWith("APPLE"));
}
#endregion
#region private static string NextValidLine(StreamReader sr)
private static string NextValidLine(StreamReader sr)
{
string line;
do
{
if (sr.EndOfStream)
return null;
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;
return line;
}
while (true);
}
#endregion
#region public static void ReadFunctionSpecs(string file, out List<CodeTypeDelegate> delegates, out List<CodeMemberMethod> functions)
public static List<CodeTypeDelegate> ReadFunctionSpecs(string file)
{
StreamReader sr = OpenSpecFile(file);
Console.WriteLine("Reading function specs from file: {0}", file);
List<CodeTypeDelegate> delegates = new List<CodeTypeDelegate>();
do
{
string line = NextValidLine(sr);
if (String.IsNullOrEmpty(line))
break;
// Get next OpenGL function
while (line.Contains("(") && !sr.EndOfStream)
{
CodeTypeDelegate d = new CodeTypeDelegate();
d.Attributes = MemberAttributes.Static;
d.CustomAttributes.Add(new CodeAttributeDeclaration("System.Security.SuppressUnmanagedCodeSecurity"));
// Get function name:
d.Name = line.Split(SpecTranslator.Separators, StringSplitOptions.RemoveEmptyEntries)[0];
if (IsExtension(d.Name))
{
d.UserData.Add("Extension", true);
}
else
{
d.UserData.Add("Extension", false);
}
//d.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, d.Name));
//d.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, d.Name));
// Get function parameters and return value:
do
{
line = sr.ReadLine();
List<string> words = new List<string>(
line.Replace('\t', ' ').Split(SpecTranslator.Separators, StringSplitOptions.RemoveEmptyEntries));
if (words.Count == 0)
break;
// Identify line:
switch (words[0])
{
case "return": // Line denotes return value
CodeTypeReference tr = new CodeTypeReference(
words[1]
);
//if (tr.BaseType == "GLvoid")
// tr.BaseType = "System.Void";
d.ReturnType = tr;
break;
case "param": // Line denotes parameter
CodeParameterDeclarationExpression p =
new CodeParameterDeclarationExpression();
p.Name = words[1];
p.Type = new CodeTypeReference(words[2]);
p.Direction = words[3] == "in" ? FieldDirection.In : FieldDirection.Out;
if (words[3] != "in")
p.CustomAttributes.Add(new CodeAttributeDeclaration("In, Out"));
p.Type.ArrayRank = words[4] == "array" ? 1 : 0;
d.Parameters.Add(p);
break;
/* version directive is not used. GetTexParameterIivEXT and GetTexParameterIuivEXT define two(!) versions (why?)
case "version": // Line denotes function version (i.e. 1.0, 1.2, 1.5)
d.UserData.Add("version", words[1]);
break;
*/
case "category":
d.UserData.Add("Category", words[1]);
break;
}
}
while (!sr.EndOfStream);
delegates.Add(d);
}
}
while (!sr.EndOfStream);
return delegates;
}
#endregion
#region public static void ReadEnumSpecs(string file, out List<CodeMemberField> enums)
public static void ReadEnumSpecs(string file, out CodeTypeDeclarationCollection enums)
{
enums = new CodeTypeDeclarationCollection();
StreamReader sr = OpenSpecFile(file);
Console.WriteLine("Reading constant specs from file: {0}", file);
do
{
string line = NextValidLine(sr);
if (String.IsNullOrEmpty(line))
break;
line = line.Replace('\t', ' ');
// We just encountered the start of a new enumerant:
while (!String.IsNullOrEmpty(line) && line.Contains("enum"))
{
string[] words = line.Split(SpecTranslator.Separators, StringSplitOptions.RemoveEmptyEntries);
if (words.Length == 0)
continue;
// Declare a new enumerant
CodeTypeDeclaration e = new CodeTypeDeclaration();
e.IsEnum = true;
e.Name = SpecTranslator.GetTranslatedEnum(words[0]);
//d.Attributes = MemberAttributes.Const | MemberAttributes.Public;
// And fill in the values for this enumerant
do
{
line = NextValidLine(sr);
if (String.IsNullOrEmpty(line) || line.StartsWith("#"))
continue;
if (line.Contains("enum:") || sr.EndOfStream)
break;
line = line.Replace('\t', ' ');
words = line.Split(SpecTranslator.Separators, StringSplitOptions.RemoveEmptyEntries);
if (words.Length == 0)
continue;
// If we reach this point, we have found a new value for the current enumerant
CodeMemberField c = new CodeMemberField();
if (line.Contains("="))
{
c.Name = SpecTranslator.GetTranslatedEnum(words[0]);
uint number;
if (UInt32.TryParse(words[2].Replace("0x", String.Empty), System.Globalization.NumberStyles.AllowHexSpecifier, null, out number))
{
if (number > 0x7FFFFFFF)
{
words[2] = "unchecked((Int32)" + words[2] + ")";
}
}
else if (words[2].StartsWith("GL_"))
{
words[2] = words[2].Substring(3);
}
//c.InitExpression = new CodeFieldReferenceExpression(null, words[2]);
//c.UserData.Add("InitExpression", " = " + words[2]);
c.UserData.Add("ObjectReference", null);
c.UserData.Add("FieldReference", words[2]);
}
else if (words[0] == "use")
{
c.Name = SpecTranslator.GetTranslatedEnum(words[2]);
//c.InitExpression = new CodeFieldReferenceExpression(new CodeSnippetExpression(words[1]), SpecTranslator.GetTranslatedEnum(words[2]));
//c.UserData.Add("InitExpression", " = " + words[1] + "." + SpecTranslator.GetTranslatedEnum(words[2]));
c.UserData.Add("ObjectReference", words[1]);
c.UserData.Add("FieldReference", words[2]);
}
//if (!String.IsNullOrEmpty(c.Name) && !e.Members.Contains.Contains(c))
SpecTranslator.Merge(e.Members, c);
}
while (!sr.EndOfStream);
// At this point, the complete value list for the current enumerant has been read, so add this
// enumerant to the list.
e.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, "public enum " + e.Name));
e.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, "public enum " + e.Name));
// Hack - discard Boolean enum, it fsucks up the fragile translation code ahead.
//if (!e.Name.Contains("Bool"))
SpecTranslator.Merge(enums, e);
}
}
while (!sr.EndOfStream);
}
#endregion
#region public static bool ListContainsConstant(List<CodeMemberField> enums, CodeMemberField c)
public static bool ListContainsConstant(List<CodeMemberField> constants, CodeMemberField c)
{
foreach (CodeMemberField d in constants)
if (d.Name == c.Name)
return true;
return false;
}
#endregion
#region public static Dictionary<string, CodeTypeReference> ReadTypeMap(string file)
public static Dictionary<string, CodeTypeReference> ReadTypeMap(string file)
{
Dictionary<string, CodeTypeReference> map =
new Dictionary<string, CodeTypeReference>();
string path = Path.Combine(FilePath, file);
StreamReader sr;
try
{
sr = new StreamReader(path);
}
catch (Exception)
{
Console.WriteLine("Error opening typemap file: {0}", path);
return null;
}
Console.WriteLine("Reading typemaps from file: {0}", file);
do
{
string line = sr.ReadLine();
if (String.IsNullOrEmpty(line) || line.StartsWith("#"))
continue;
string[] words = line.Split(new char[] { ' ', ',', '*', '\t' }, StringSplitOptions.RemoveEmptyEntries);
if (words[0] == "void")
{
// Special case for "void" -> ""
map.Add(words[0], new CodeTypeReference(String.Empty));
}
else if (words[0] == "VoidPointer")
{ // Special case for "VoidPointer" -> "GLvoid*"
map.Add(words[0], new CodeTypeReference("System.Object"));
}
else if (words[0] == "CharPointer" || words[0] == "charPointerARB")
{
map.Add(words[0], new CodeTypeReference("System.String"));
}
else if (words[0].Contains("Pointer"))
{
map.Add(words[0], new CodeTypeReference(words[1], 1));
}
//else if (words[1].Contains("Boolean"))
//{
// // Do not add this to the typemap!
//}
/*else if (words[1] == "GLenum")
{
// Do not throw away the type to generic GLenum. We want type checking!
}*/
else
{
map.Add(words[0], new CodeTypeReference(words[1]));
}
}
while (!sr.EndOfStream);
return map;
}
#endregion
}
}

View file

@ -0,0 +1,884 @@
#region --- License ---
/*
MIT License
Copyright ©2006-2007 Tao Framework Team
http://www.taoframework.com
Copyright ©2005-2007 OpenTK
http://sourceforge.net/projects/opentk
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion License
#region --- Using Directives ---
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.CodeDom;
#endregion
namespace OpenTK.OpenGL.Bind
{
#region WrapperTypes enum
public enum WrapperTypes
{
/// <summary>
/// No wrapper needed.
/// </summary>
None,
/// <summary>
/// Function takes bool parameter - C uses Int for bools, so we have to marshal.
/// </summary>
BoolParameter,
/// <summary>
/// Function takes generic parameters - add ref/out generic and generic overloads.
/// </summary>
GenericParameter,
/// <summary>
/// Function takes arrays as parameters - add ref/out and ([Out]) array overloads.
/// </summary>
ArrayParameter,
/// <summary>
/// Function with bitmask parameters. Bitmask parameters map to UInt, but since we can only use signed
/// types (for CLS compliance), we must add the unchecked keyword.
/// Usually found in bitmasks
/// </summary>
UncheckedParameter,
/// <summary>
/// Function returns string - needs manual marshalling through IntPtr to prevent the managed GC
/// from freeing memory allocated on the unmanaged side (e.g. glGetString).
/// </summary>
StringReturnValue,
/// <summary>
/// Function returns a void pointer - maps to IntPtr, and the user has to manually marshal the type.
/// </summary>
GenericReturnValue,
/// <summary>
/// Function returns a typed pointer - we have to copy the data to an array to protect it from the GC.
/// </summary>
ArrayReturnValue
}
#endregion
static class SpecTranslator
{
#region static SpecTranslator()
// Do not remove! - forces BeforeFieldInit to false.
static SpecTranslator()
{
}
#endregion
#region Fields and Properties
public static char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' };
#region GL types dictionary
private static Dictionary<string, CodeTypeReference> _gl_types = SpecReader.ReadTypeMap("gl.tm");
public static Dictionary<string, CodeTypeReference> GLTypes
{
get { return SpecTranslator._gl_types; }
set { SpecTranslator._gl_types = value; }
}
#endregion
#region CS types dictionary
private static Dictionary<string, CodeTypeReference> _cs_types = SpecReader.ReadTypeMap("csharp.tm");
public static Dictionary<string, CodeTypeReference> CSTypes
{
get { return SpecTranslator._cs_types; }
set { SpecTranslator._cs_types = value; }
}
#endregion
#region GLX types dictionary
private static Dictionary<string, string> _glx_types;
public static Dictionary<string, string> GLXTypes
{
get { return _glx_types; }
set { _glx_types = value; }
}
#endregion
#region WGL types dictionary
private static Dictionary<string, string> _wgl_types;
public static Dictionary<string, string> WGLTypes
{
get { return _wgl_types; }
set { _wgl_types = value; }
}
#endregion
#endregion
#region public static List<CodeMemberMethod> TranslateDelegates(List<CodeTypeDelegate> delegates, CodeTypeDeclarationCollection enums)
public static List<CodeMemberMethod> TranslateDelegates(List<CodeTypeDelegate> delegates, CodeTypeDeclarationCollection enums)
{
List<CodeMemberMethod> functions = new List<CodeMemberMethod>();
foreach (CodeTypeDelegate d in delegates)
{
TranslateReturnValue(d);
TranslateParameters(d, enums);
functions.AddRange(CreateWrappers(d));
}
return functions;
}
#endregion
#region private static void TranslateReturnValue(CodeTypeDelegate d)
private static void TranslateReturnValue(CodeTypeDelegate d)
{
CodeTypeReference s;
if (d.ReturnType.BaseType == "void")
d.ReturnType.BaseType = "System.Void";
if (GLTypes.TryGetValue(d.ReturnType.BaseType, out s))
d.ReturnType = s;
if (d.ReturnType.BaseType == "GLstring")
{
d.ReturnType = new CodeTypeReference("IntPtr");
d.ReturnType.UserData.Add("Wrapper", WrapperTypes.StringReturnValue);
}
if (d.ReturnType.BaseType.ToLower().Contains("object"))
{
d.ReturnType.BaseType = "IntPtr";
d.ReturnType.UserData.Add("Wrapper", WrapperTypes.GenericReturnValue);
d.ReturnType.ArrayRank = 0;
}
if (d.ReturnType.UserData.Contains("Wrapper"))
{
d.UserData.Add("Wrapper", null);
}
}
#endregion
#region private static void TranslateParameters(CodeTypeDelegate d)
private static void TranslateParameters(CodeTypeDelegate d, CodeTypeDeclarationCollection enums)
{
CodeTypeReference s;
if (d.Name == "BufferDataARB")
{
}
// Translate each parameter of the function while checking for needed wrappers:
foreach (CodeParameterDeclarationExpression p in d.Parameters)
{
// Translate parameter type
if (Search(enums, p.Type.BaseType))
{
p.Type.BaseType = "Enums." + p.Type.BaseType;
}
else if (GLTypes.TryGetValue(p.Type.BaseType, out s))
{
if (s.BaseType == "GLenum" && d.UserData.Contains("Category"))
{
bool found = false;
// There is no enumerant with the needed name. Try to see if any of the generic enumerants
// (category: VERSION_1_1 etc) match the needed name.
foreach (CodeTypeDeclaration enumerant in enums)
{
if (enumerant.Name == (string)d.UserData["Category"])
{
p.Type.BaseType = "Enums." + (string)d.UserData["Category"];
found = true;
break;
}
}
if (!found || p.Type.BaseType.ToLower().Contains("bool"))
{
p.Type.BaseType = s.BaseType;
}
}
else
{
p.Type.BaseType = s.BaseType;
}
}
if (p.Type.ArrayRank == 0 && p.Type.BaseType.ToLower().Contains("enums."))
{
// Do nothing
}
else if (p.Type.ArrayRank > 0 && p.Type.BaseType.Contains("char") ||
p.Type.ArrayRank == 0 && p.Type.BaseType.ToLower().Contains("string"))
{
// GLchar[] parameters should become (in) string or (out) StringBuilder
if (p.Direction == FieldDirection.Out || p.Direction == FieldDirection.Ref)
p.Type = new CodeTypeReference("System.Text.StringBuilder");
else
p.Type = new CodeTypeReference("System.String");
}
else if (p.Type.ArrayRank > 0 && p.Type.BaseType.ToLower().Contains("string"))
{
// string parameters do not need special wrappers. We add this here
// to simplify the next if-statements.
// p.Type.ArrayRank = 0;
}
else if (p.Type.ArrayRank > 0)
{
// All other array parameters need wrappers (around IntPtr).
if (p.Type.BaseType.Contains("void") || p.Type.BaseType.Contains("Void"))
{
p.UserData.Add("Wrapper", WrapperTypes.GenericParameter);
}
else
{
p.UserData.Add("Wrapper", WrapperTypes.ArrayParameter);
p.UserData.Add("OriginalType", new string(p.Type.BaseType.ToCharArray()));
}
// We do not want an array of IntPtrs (IntPtr[]) - it is the IntPtr that points to the array.
p.Type = new CodeTypeReference();
p.Type.BaseType = "System.IntPtr";
p.Type.ArrayRank = 0;
// The same wrapper works for either in or out parameters.
//p.CustomAttributes.Add(new CodeAttributeDeclaration("In, Out"));
}
else if (p.Type.BaseType.Contains("ushort") && d.Name.Contains("LineStipple"))
{
// glLineStipple needs wrapper to allow large unsigned mask values.
p.UserData.Add("Wrapper", WrapperTypes.UncheckedParameter);
}
if (p.Type.BaseType.ToLower().Contains("boolean"))
{
p.Type.BaseType = "System.Boolean";
//p.UserData.Add("Wrapper", WrapperTypes.BoolParameter);
p.CustomAttributes.Add(
new CodeAttributeDeclaration(
"MarshalAs",
new CodeAttributeArgument(new CodeSnippetExpression("UnmanagedType.Bool"))
)
);
}
if (p.UserData.Contains("Wrapper") && !d.UserData.Contains("Wrapper"))
{
// If there is at least 1 parameter that needs wrappers, mark the funcction for wrapping.
d.UserData.Add("Wrapper", null);
}
p.Direction = FieldDirection.In;
}
}
#endregion
private static bool Search(CodeTypeDeclarationCollection enums, string name)
{
foreach (CodeTypeDeclaration enumerant in enums)
{
if (enumerant.Name == name)
{
return true;
}
}
return false;
}
#region private static List<CodeMemberMethod> CreateWrappers(CodeTypeDelegate d)
private static List<CodeMemberMethod> CreateWrappers(CodeTypeDelegate d)
{
List<CodeMemberMethod> wrappers = new List<CodeMemberMethod>();
CodeMemberMethod f = new CodeMemberMethod();
// Check if a wrapper is needed:
if (!d.UserData.Contains("Wrapper"))
{
// If not, add just add a function that calls the delegate.
f = CreatePrototype(d);
if (!f.ReturnType.BaseType.Contains("Void"))
f.Statements.Add(new CodeMethodReturnStatement(GenerateInvokeExpression(f)));
else
f.Statements.Add(GenerateInvokeExpression(f));
wrappers.Add(f);
}
else
{
// We have to add wrappers for all possible WrapperTypes.
// First, check if the return type needs wrapping:
if (d.ReturnType.UserData.Contains("Wrapper"))
{
switch ((WrapperTypes)d.ReturnType.UserData["Wrapper"])
{
// If the function returns a string (glGetString) we must manually marshal it
// using Marshal.PtrToStringXXX. Otherwise, the GC will try to free the memory
// used by the string, resulting in corruption (the memory belongs to the
// unmanaged boundary).
case WrapperTypes.StringReturnValue:
f = CreatePrototype(d);
f.ReturnType = new CodeTypeReference("System.String");
f.Statements.Add(
new CodeMethodReturnStatement(
new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression("Marshal"),
"PtrToStringAnsi",
new CodeExpression[] { GenerateInvokeExpression(f) }
)
)
);
wrappers.Add(f);
break;
// If the function returns a void* (GenericReturnValue), we'll have to return an IntPtr.
// The user will unfortunately need to marshal this IntPtr to a data type manually.
case WrapperTypes.GenericReturnValue:
f = CreatePrototype(d);
if (!f.ReturnType.BaseType.Contains("Void"))
f.Statements.Add(new CodeMethodReturnStatement(GenerateInvokeExpression(f)));
else
f.Statements.Add(GenerateInvokeExpression(f));
wrappers.Add(f);
break;
}
}
if (d.Name.Contains("LineStipple"))
{
// glLineStipple accepts a GLushort bitfield. Since GLushort is mapped to Int16, not UInt16
// (for CLS compliance), we'll have to add the unchecked keyword.
f = CreatePrototype(d);
CodeSnippetExpression e =
new CodeSnippetExpression("Delegates.glLineStipple(factor, unchecked((GLushort)pattern))");
f.Statements.Add(e);
wrappers.Add(f);
}
WrapPointersMonsterFunctionMK2(String.IsNullOrEmpty(f.Name) ? CreatePrototype(d) : f, wrappers);
}
return wrappers;
}
#endregion
#region private static void WrapPointersMonsterFunctionMK2(CodeTypeDelegate d, List<CodeMemberMethod> wrappers)
// This function needs some heavy refactoring. I'm ashamed I ever wrote it, but it works...
// What it does is this: it adds to the wrapper list all possible wrapper permutations
// for functions that have more than one IntPtr parameter. Example:
// "void Delegates.f(IntPtr p, IntPtr q)" where p and q are pointers to void arrays needs the following wrappers:
// "void f(IntPtr p, IntPtr q)"
// "void f(IntPtr p, object q)"
// "void f(object p, IntPtr q)"
// "void f(object p, object q)"
private static int count = 0;
private static void WrapPointersMonsterFunctionMK2(CodeMemberMethod f, List<CodeMemberMethod> wrappers)
{
if (count == 0)
{
bool functionContainsIntPtrParameters = false;
// Check if there are any IntPtr parameters (we may have come here from a ReturnType wrapper
// such as glGetString, which contains no IntPtr parameters)
foreach (CodeParameterDeclarationExpression p in f.Parameters)
{
if (p.Type.BaseType.Contains("IntPtr"))
{
functionContainsIntPtrParameters = true;
break;
}
}
if (functionContainsIntPtrParameters)
{
wrappers.Add(IntPtrToIntPtr(f));
}
else
{
return;
}
}
if (count >= 0 && count < f.Parameters.Count)
{
if (f.Parameters[count].UserData.Contains("Wrapper"))
{
//++count;
//WrapPointersMonsterFunctionMK2(d, wrappers);
//--count;
if ((WrapperTypes)f.Parameters[count].UserData["Wrapper"] == WrapperTypes.ArrayParameter)
{
++count;
WrapPointersMonsterFunctionMK2(f, wrappers);
--count;
CodeMemberMethod w = IntPtrToArray(f, count);
wrappers.Add(w);
++count;
WrapPointersMonsterFunctionMK2(w, wrappers);
--count;
/*w = IntPtrToReference(f, count);
wrappers.Add(w);
++count;
WrapPointersMonsterFunctionMK2(w, wrappers);
--count;*/
}
else if ((WrapperTypes)f.Parameters[count].UserData["Wrapper"] == WrapperTypes.GenericParameter)
{
++count;
WrapPointersMonsterFunctionMK2(f, wrappers);
--count;
CodeMemberMethod w = IntPtrToObject(f, count);
wrappers.Add(w);
++count;
WrapPointersMonsterFunctionMK2(w, wrappers);
--count;
}
}
else
{
++count;
WrapPointersMonsterFunctionMK2(f, wrappers);
--count;
}
}
}
#endregion
#region private static CodeMemberMethod IntPtrToIntPtr(CodeMemberMethod f)
private static CodeMemberMethod IntPtrToIntPtr(CodeMemberMethod f)
{
CodeMemberMethod w = CreatePrototype(f);
if (!w.ReturnType.BaseType.Contains("Void"))
{
w.Statements.Add(new CodeMethodReturnStatement(GenerateInvokeExpression(w)));
}
else
{
w.Statements.Add(GenerateInvokeExpression(w));
}
return w;
}
#endregion
#region private static CodeMemberMethod IntPtrToObject(CodeMemberMethod f, int index)
private static CodeMemberMethod IntPtrToObject(CodeMemberMethod f, int index)
{
CodeMemberMethod w = CreatePrototype(f);
CodeParameterDeclarationExpression newp = new CodeParameterDeclarationExpression();
newp.Name = f.Parameters[index].Name;
newp.Type = new CodeTypeReference("System.Object");
//if (newp.Flow == Parameter.FlowDirection.Out)
// newp.Flow = Parameter.FlowDirection.Undefined;
w.Parameters[index] = newp;
// In the function body we should pin all objects in memory before calling the
// low-level function.
w.Statements.AddRange(GenerateInvokeExpressionWithPins(w));
return w;
}
#endregion
#region private static CodeMemberMethod IntPtrToArray(CodeMemberMethod f, int index)
// IntPtr -> GL[...] wrapper.
private static CodeMemberMethod IntPtrToArray(CodeMemberMethod f, int index)
{
CodeMemberMethod w = CreatePrototype(f);
// Search and replace IntPtr parameters with the known parameter types:
CodeParameterDeclarationExpression newp = new CodeParameterDeclarationExpression();
newp.Name = f.Parameters[index].Name;
newp.Type.BaseType = (string)f.Parameters[index].UserData["OriginalType"];
newp.Type.ArrayRank = 1;
w.Parameters[index] = newp;
// In the function body we should pin all objects in memory before calling the
// low-level function.
w.Statements.AddRange(GenerateInvokeExpressionWithPins(w));
return w;
}
#endregion
#region private static CodeMemberMethod IntPtrToReference(CodeMemberMethod f, int index)
/// <summary>
/// This function is not working yet! How can we obtain a pinned IntPtr from a ref
/// without resorting to unsafe code?
/// </summary>
/// <param name="f"></param>
/// <param name="index"></param>
/// <returns></returns>
private static CodeMemberMethod IntPtrToReference(CodeMemberMethod f, int index)
{
CodeMemberMethod w = CreatePrototype(f);
// Search and replace IntPtr parameters with the known parameter types:
CodeParameterDeclarationExpression newp = new CodeParameterDeclarationExpression();
newp.Name = f.Parameters[index].Name;
newp.Type.BaseType = (string)f.Parameters[index].UserData["OriginalType"];
newp.Direction = FieldDirection.Ref;
w.Parameters[index] = newp;
// In the function body we should pin all objects in memory before calling the
// low-level function.
w.Statements.AddRange(GenerateInvokeExpressionWithPins(w));
return w;
}
#endregion
#region private static CodeMemberMethod CreatePrototype(CodeTypeDelegate d)
private static CodeMemberMethod CreatePrototype(CodeTypeDelegate d)
{
CodeMemberMethod f = new CodeMemberMethod();
f.Name = Settings.GLFunctionPrepend + d.Name;
f.Parameters.AddRange(d.Parameters);
f.ReturnType = d.ReturnType;
f.Attributes = MemberAttributes.Static | MemberAttributes.Public;
//f.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, f.Name));
//f.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, f.Name));
/*f.Comments.Add(new CodeCommentStatement("<summary>", true));
f.Comments.Add(new CodeCommentStatement(" ", true));
f.Comments.Add(new CodeCommentStatement("</summary>", true));*/
return f;
}
#endregion
#region private static CodeMemberMethod CreatePrototype(CodeMemberMethod d)
private static CodeMemberMethod CreatePrototype(CodeMemberMethod d)
{
CodeMemberMethod f = new CodeMemberMethod();
f.Name = d.Name;
f.Parameters.AddRange(d.Parameters);
f.ReturnType = d.ReturnType;
f.Attributes = MemberAttributes.Static | MemberAttributes.Public;
//f.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, f.Name));
//f.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, f.Name));
foreach (object key in d.UserData.Keys)
{
f.UserData.Add(key, d.UserData[key]);
}
/*f.Comments.Add(new CodeCommentStatement("<summary>", true));
f.Comments.Add(new CodeCommentStatement(" ", true));
f.Comments.Add(new CodeCommentStatement("</summary>", true));*/
return f;
}
#endregion
#region private static CodeExpression GenerateInvokeExpression(CodeMemberMethod f)
private static CodeExpression GenerateInvokeExpression(CodeMemberMethod f)
{
CodeVariableReferenceExpression[] parameters = new CodeVariableReferenceExpression[f.Parameters.Count];
int i = 0;
foreach (CodeParameterDeclarationExpression p in f.Parameters)
{
parameters[i++] = new CodeVariableReferenceExpression(p.Name);
}
return new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression("Delegates"),
"gl" + f.Name,
parameters
);
}
#endregion
#region private static CodeStatementCollection GenerateInvokeExpressionWithPins(CodeMemberMethod f)
private static CodeStatementCollection GenerateInvokeExpressionWithPins(CodeMemberMethod f)
{
CodeVariableReferenceExpression[] parameters = new CodeVariableReferenceExpression[f.Parameters.Count];
CodeTryCatchFinallyStatement m = new CodeTryCatchFinallyStatement();
CodeStatementCollection statements = new CodeStatementCollection();
int h = 0;
int i = 0;
foreach (CodeParameterDeclarationExpression p in f.Parameters)
{
// Do manual marshalling for objects and arrays, but not strings.
if (p.Type.BaseType.ToLower().Contains("object") && !p.Type.BaseType.ToLower().Contains("enums.") ||
(p.Type.ArrayRank > 0 && !p.Type.BaseType.ToLower().Contains("string")))
{
// Pin the object and store the resulting GCHandle to h0, h1, ...
CodeVariableDeclarationStatement s = new CodeVariableDeclarationStatement();
s.Type = new CodeTypeReference("GCHandle");
s.Name = "h" + h;
s.InitExpression =
new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression("GCHandle"),
"Alloc",
new CodeTypeReferenceExpression[] {
new CodeTypeReferenceExpression(p.Name),
new CodeTypeReferenceExpression("GCHandleType.Pinned")
}
);
statements.Add(s);
// Free the object using the h0, h1, ... variables
m.FinallyStatements.Add(
new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression("h" + h),
"Free"
)
);
// Add the h(n) variable to the list of parameters
parameters[i] = new CodeVariableReferenceExpression("h" + h + ".AddrOfPinnedObject()");
h++;
}
else
{
// Add the normal paramater to the parameter list
parameters[i] = new CodeVariableReferenceExpression(p.Name);
}
i++;
}
if (!f.ReturnType.BaseType.Contains("Void"))
{
m.TryStatements.Add(
new CodeMethodReturnStatement(
new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression("Delegates"),
"gl" + f.Name,
parameters
)
)
);
}
else
{
m.TryStatements.Add(
new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression("Delegates"),
"gl" + f.Name,
parameters
)
);
}
statements.Add(m);
return statements;
}
#endregion
#region public static CodeTypeDeclarationCollection Merge(CodeTypeDeclarationCollection list1, CodeTypeDeclarationCollection list2)
public static CodeTypeDeclarationCollection Merge(CodeTypeDeclarationCollection list1, CodeTypeDeclarationCollection list2)
{
foreach (CodeTypeDeclaration d in list2)
{
Merge(list1, d);
}
return list1;
}
#endregion
#region public static CodeTypeDeclarationCollection Merge(CodeTypeDeclarationCollection list, CodeTypeDeclaration item)
public static CodeTypeDeclarationCollection Merge(CodeTypeDeclarationCollection list, CodeTypeDeclaration item)
{
bool t_exists = false;
foreach (CodeTypeDeclaration d in list)
{
if (d.Name == item.Name)
{
t_exists = true;
foreach (CodeTypeMember m in item.Members)
{
Merge(d.Members, m);
}
}
}
if (!t_exists)
{
list.Add(item);
}
return list;
}
#endregion
#region public static CodeTypeMemberCollection Merge(CodeTypeMemberCollection list, CodeTypeMember item)
public static CodeTypeMemberCollection Merge(CodeTypeMemberCollection list, CodeTypeMember item)
{
bool t_exists = false;
foreach (CodeTypeMember d in list)
{
if (d.Name == item.Name)
{
t_exists = true;
}
}
if (!t_exists)
{
list.Add(item);
}
return list;
}
#endregion
#region public static CodeTypeDeclarationCollection TranslateEnums(CodeTypeDeclarationCollection enums)
public static CodeTypeDeclarationCollection TranslateEnums(CodeTypeDeclarationCollection enums)
{
// Add missing enums.
{
CodeTypeDeclaration e = new CodeTypeDeclaration("SGIX_icc_texture");
e.IsEnum = true;
CodeMemberField c;
c = new CodeMemberField(); c.Name = "RGB_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8460"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "RGBA_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8461"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "ALPHA_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8462"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "LUMINANCE_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8463"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "INTENSITY_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8464"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "LUMINANCE_ALPHA_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8465"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "R5_G6_B5_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8466"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "R5_G6_B5_A8_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8467"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "ALPHA16_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8468"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "LUMINANCE16_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x8469"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "INTENSITY16_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x846A"); e.Members.Add(c);
c = new CodeMemberField(); c.Name = "LUMINANCE16_ALPHA8_ICC_SGIX"; c.InitExpression = new CodeFieldReferenceExpression(null, "0x846B"); e.Members.Add(c);
enums.Add(e);
}
// Translate enums.
foreach (CodeTypeDeclaration e in enums)
{
if (Char.IsDigit(e.Name[0]))
e.Name = e.Name.Insert(0, "_");
if (e.Name == "Boolean")
continue;
foreach (CodeMemberField c in e.Members)
{
// Prepend an '_' if the first letter is a number (e.g. 4_BYTES -> _4_BYTES)
if (Char.IsDigit(c.Name[0]))
c.Name = c.Name.Insert(0, "_");
if (c.UserData["FieldReference"] == null)
continue;
c.UserData["ObjectReference"] = GetTranslatedEnum((string)c.UserData["ObjectReference"]);
c.UserData["FieldReference"] = GetTranslatedEnum((string)c.UserData["FieldReference"]);
// There are cases when a value is not a number but an aliased constant, with no enum specified.
// In this case try searching all enums for the correct constant to alias (stupid opengl specs).
if (c.UserData["ObjectReference"] == null &&
!((string)c.UserData["FieldReference"]).StartsWith("0x") &&
!Char.IsDigit(((string)c.UserData["FieldReference"])[0]))
{
if (((string)c.UserData["FieldReference"]).StartsWith("GL_"))
c.UserData["FieldReference"] = ((string)c.UserData["FieldReference"]).Substring(3);
foreach (CodeTypeDeclaration enumerant in enums)
{
foreach (CodeTypeMember member in enumerant.Members)
{
if (member.Name == (string)c.UserData["FieldReference"] ||
member.Name == ((string)c.UserData["FieldReference"]).TrimStart('_'))
{
c.UserData["ObjectReference"] = enumerant.Name;
}
}
}
}
c.InitExpression =
new CodeFieldReferenceExpression(
c.UserData["ObjectReference"] == null ? null : new CodeSnippetExpression((string)c.UserData["ObjectReference"]),
(string)c.UserData["FieldReference"]
);
}
}
return enums;
}
#endregion
#region public static string GetTranslatedEnum(string name)
public static string GetTranslatedEnum(string name)
{
int useless;
if (String.IsNullOrEmpty(name))
return null;
// Check if the name starts with a number, and prepend a "_" if yes.
if (!name.StartsWith("0x") &&
!Int32.TryParse(name, out useless) &&
Char.IsDigit(name[0]))
{
return name.Insert(0, "_");
}
if (name == "LightProperty")
{
return "LightParameter";
}
return name;
}
#endregion
}
}

View file

@ -0,0 +1,344 @@
#region --- License ---
/*
MIT License
Copyright ©2006-2007 Tao Framework Team
http://www.taoframework.com
Copyright ©2005-2007 OpenTK
http://sourceforge.net/projects/opentk
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#endregion License
#region --- Using Directives ---
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
using System.CodeDom;
#endregion
namespace OpenTK.OpenGL.Bind
{
static class SpecWriter
{
#region internal class CodeTypeNameComparer<T> : Comparer<T> where T : CodeTypeMember
internal class CodeTypeNameComparer<T> : Comparer<T> where T : CodeTypeMember
{
public override int Compare(T x, T y)
{
return x.Name.CompareTo(y.Name);
}
}
#endregion
#region Generate
public static void Generate(
List<CodeTypeDelegate> delegates,
List<CodeMemberMethod> functions,
CodeTypeDeclarationCollection enums
)
{
if (!Directory.Exists(Settings.OutputPath))
Directory.CreateDirectory(Settings.OutputPath);
CodeNamespace ns = new CodeNamespace(Settings.OutputNamespace);
ns.Imports.Add(new CodeNamespaceImport("System"));
ns.Imports.Add(new CodeNamespaceImport("System.Runtime.InteropServices"));
ns.Imports.Add(new CodeNamespaceImport("System.Text"));
//ns.Imports.Add(new CodeNamespaceImport(Settings.OutputNamespace + ".Enums"));
foreach (string key in SpecTranslator.CSTypes.Keys)
{
ns.Imports.Add(new CodeNamespaceImport(key + " = System." + SpecTranslator.CSTypes[key].BaseType));
}
functions.Sort(new CodeTypeNameComparer<CodeMemberMethod>());
delegates.Sort(new CodeTypeNameComparer<CodeTypeDelegate>());
ns.Types.Add(GenerateGLClass(functions));
ns.Types.Add(GenerateDelegatesClass(delegates));
ns.Types.Add(GenerateImportsClass(delegates));
CodeCompileUnit cu = new CodeCompileUnit();
cu.StartDirectives.Add(new CodeDirective());
cu.Namespaces.Add(ns);
using (StreamWriter sw = new StreamWriter(Path.Combine(Settings.OutputPath, Settings.GLClass + ".cs"), false))
{
Console.WriteLine("Writing {0} class", Settings.OutputNamespace + "." + Settings.GLClass);
Microsoft.CSharp.CSharpCodeProvider cs = new Microsoft.CSharp.CSharpCodeProvider();
System.CodeDom.Compiler.CodeGeneratorOptions options = new System.CodeDom.Compiler.CodeGeneratorOptions();
options.BracingStyle = "C";
options.BlankLinesBetweenMembers = false;
options.VerbatimOrder = true;
cs.GenerateCodeFromCompileUnit(cu, sw, options);
sw.Flush();
}
ns.Name = Settings.OutputNamespace + ".Enums";
ns.Imports.Clear();
ns.Imports.Add(new CodeNamespaceImport("System"));
ns.Types.Clear();
//enums.Sort(new CodeTypeNameComparer<CodeTypeDeclaration>());
//CodeTypeDeclaration d = new CodeTypeDeclaration("Enums");
//d.IsStruct = true;
//d.Members.AddRange(enums);
//ns.Types.Add(d);
ns.Types.AddRange(enums);
using (StreamWriter sw = new StreamWriter(Path.Combine(Settings.OutputPath, Settings.GLClass + "enums.cs"), false))
{
Console.WriteLine("Writing {0} enums", Settings.OutputNamespace + "." + Settings.GLClass);
Microsoft.CSharp.CSharpCodeProvider cs = new Microsoft.CSharp.CSharpCodeProvider();
System.CodeDom.Compiler.CodeGeneratorOptions options = new System.CodeDom.Compiler.CodeGeneratorOptions();
options.BracingStyle = "C";
options.BlankLinesBetweenMembers = false;
options.VerbatimOrder = true;
cs.GenerateCodeFromCompileUnit(cu, sw, options);
sw.Flush();
}
}
#endregion
#region private static CodeTypeDeclaration GenerateGLClass(List<CodeMemberMethod> functions, List<CodeMemberField> enums)
private static CodeTypeDeclaration GenerateGLClass(List<CodeMemberMethod> functions)
{
CodeTypeDeclaration gl_class = new CodeTypeDeclaration(Settings.GLClass);
gl_class.IsClass = true;
gl_class.IsPartial = true;
gl_class.TypeAttributes = System.Reflection.TypeAttributes.Public;
gl_class.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, "GL class"));
gl_class.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, "GL class"));
gl_class.Members.Add(new CodeSnippetTypeMember(" #pragma warning disable 1591"));
gl_class.Members.Add(new CodeSnippetTypeMember(
@"
#region Private Constants
#region string GL_NATIVE_LIBRARY
/// <summary>
/// Specifies OpenGl's native library archive.
/// </summary>
/// <remarks>
/// Specifies opengl32.dll everywhere; will be mapped via .config for mono.
/// </remarks>
internal const string GL_NATIVE_LIBRARY = ""opengl32.dll"";
#endregion string GL_NATIVE_LIBRARY
#endregion Private Constants
"));
/*
if (constants.Count > 0)
{
constants[0].StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, "OpenGL constants"));
constants[constants.Count - 1].EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, "OpenGL constants"));
}
gl_class.Members.AddRange(constants.ToArray());
*/
if (functions.Count > 0)
{
functions[0].StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, "OpenGL functions"));
functions[functions.Count - 1].EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, "OpenGL functions"));
}
gl_class.Members.AddRange(functions.ToArray());
return gl_class;
}
#endregion
#region private static CodeTypeDeclaration GenerateDelegatesClass(List<CodeTypeDelegate> delegates)
private static CodeTypeDeclaration GenerateDelegatesClass(List<CodeTypeDelegate> delegates)
{
CodeTypeDeclaration delegate_class = new CodeTypeDeclaration("Delegates");
delegate_class.TypeAttributes = System.Reflection.TypeAttributes.NotPublic;
CodeStatementCollection statements = new CodeStatementCollection();
foreach (CodeTypeDelegate d in delegates)
{
delegate_class.Members.Add(d);
CodeMemberField m = new CodeMemberField();
m.Name = "gl" + d.Name;
m.Type = new CodeTypeReference(d.Name);
m.Attributes = MemberAttributes.Public | MemberAttributes.Static;
//m.InitExpression =
//new CodeCastExpression(
// "Delegates." + d.Name,
// new CodeMethodInvokeExpression(
// new CodeMethodReferenceExpression(
// new CodeTypeReferenceExpression(Properties.Bind.Default.OutputClass),
// "GetDelegateForExtensionMethod"
// ),
// new CodeExpression[] {
// new CodeSnippetExpression("\"gl" + d.Name + "\""),
// new CodeTypeOfExpression("Delegates." + d.Name)
// }
// )
//);
// Hack - generate inline initialisers in the form:
// public static Accum glAccum = GetDelegate[...] ?? new Accum(Imports.Accum);
CodeSnippetExpression expr = new CodeSnippetExpression();
//expr.Value = "public static " + d.Name + " gl" + d.Name + " = ";
expr.Value +=
"((" + d.Name + ")(" + Settings.GLClass +".GetDelegateForExtensionMethod(\"" + "gl" + d.Name + "\", typeof(" + d.Name + "))))";
if (d.UserData.Contains("Extension") && !(bool)d.UserData["Extension"])
{
expr.Value += " ?? ";
expr.Value += "new " + d.Name + "(Imports." + d.Name + ")";
}
m.InitExpression = expr;
delegate_class.Members.Add(m);
/*
if (!(bool)d.UserData["Extension"])
{
statements.Add(
new CodeSnippetExpression(
"Delegates.gl" + d.Name + " = Delegates.gl" + d.Name + " ?? new Delegates." + d.Name + "(Imports." + d.Name + ")"
)
);
}
*/
}
// Disable BeforeFieldInit attribute and initialize OpenGL core.
CodeTypeConstructor con = new CodeTypeConstructor();
//con.Statements.AddRange(statements);
delegate_class.Members.Add(con);
delegate_class.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, delegate_class.Name));
delegate_class.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, delegate_class.Name));
return delegate_class;
}
#endregion
#region private static CodeTypeDeclaration GenerateImportsClass(List<CodeTypeDelegate> delegates)
private static CodeTypeDeclaration GenerateImportsClass(List<CodeTypeDelegate> delegates)
{
CodeTypeDeclaration import_class = new CodeTypeDeclaration("Imports");
import_class.TypeAttributes = System.Reflection.TypeAttributes.NotPublic;
import_class.Members.Add(new CodeTypeConstructor());
foreach (CodeTypeDelegate d in delegates)
{
if (!(bool)d.UserData["Extension"])
{
CodeMemberMethodImport m = new CodeMemberMethodImport();
m.Name = d.Name;
m.CustomAttributes.Add(new CodeAttributeDeclaration("System.Security.SuppressUnmanagedCodeSecurity()"));
m.CustomAttributes.Add(
new CodeAttributeDeclaration(
"DllImport(" + Settings.GLClass + ".GL_NATIVE_LIBRARY, EntryPoint = \"" + "gl" + m.Name + "\", ExactSpelling = true)"
)
);
m.Parameters.AddRange(d.Parameters);
m.ReturnType = d.ReturnType;
import_class.Members.Add(new CodeSnippetTypeMember(m.Text));
}
}
import_class.StartDirectives.Add(new CodeRegionDirective(CodeRegionMode.Start, import_class.Name));
import_class.EndDirectives.Add(new CodeRegionDirective(CodeRegionMode.End, import_class.Name));
return import_class;
}
#endregion
}
#region class CodeMemberMethodImport : CodeMemberMethod
/// <summary>
/// A hack to create the C# code for a DllImported function;
/// CodeDom does not directly support static extern methods.
/// </summary>
class CodeMemberMethodImport : CodeMemberMethod
{
public string Text
{
get
{
string s;
//m.Attributes = MemberAttributes.Static | MemberAttributes.Public;
s = " #region " + this.Name + Environment.NewLine;
s += " [System.Security.SuppressUnmanagedCodeSecurity()]" + Environment.NewLine;
s += " [DllImport(" + Settings.GLClass + ".GL_NATIVE_LIBRARY, EntryPoint = \"" + "gl" + this.Name + "\", ExactSpelling = true)]" + Environment.NewLine;
s += " public extern static ";
if (this.ReturnType.BaseType == "System.Void")
{
s += "void";
}
else
{
s += this.ReturnType.BaseType;
}
s += " " + this.Name + "(";
foreach (CodeParameterDeclarationExpression p in this.Parameters)
{
s += p.Type.BaseType;
if (p.Type.ArrayRank > 0)
s += "[]";
s += " ";
if (p.Name == "base")
s += "@base";
else if (p.Name == "params")
s += "@params";
else if (p.Name == "string")
s += "@string";
else if (p.Name == "ref")
s += "@ref";
else
s += p.Name;
s += ", ";
}
s = s.TrimEnd(',', ' ') + ");" + Environment.NewLine;
s += " #endregion" + Environment.NewLine;
return s;
}
}
}
#endregion
}

View file

@ -0,0 +1,97 @@
#region License
//Copyright (c) 2006 Stephen Apostolopoulos
//See license.txt for license info
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
#region Constant class
/// <summary>
/// Represents an opengl constant in C# format. Both the constant name and value
/// can be retrieved or set. The value can be either a number, another constant
/// or an alias to a constant
/// </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 public string ToString()
/// <summary>
/// Returns a string that represents the full constant declaration without decorations
/// (eg const uint GL_XXX_YYY = 0xDEADBEEF).
/// </summary>
/// <returns></returns>
override public string ToString()
{
return Name + " = " + Value;
}
#endregion
}
#endregion
}

View file

@ -0,0 +1,49 @@
#region License
//Copyright (c) 2006 Stephen Apostolopoulos
//See license.txt for license info
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
#region class Enum
public class 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();
}
}
#endregion
}

View file

@ -0,0 +1,266 @@
#region License
//Copyright (c) 2006 Stephen Apostolopoulos
//See license.txt for license info
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL.Bind
{
#region class Function
/// <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 Constructors
public Function()
{
Parameters = new ParameterCollection();
Body = new FunctionBody();
}
public Function(Function f)
{
this.Body = new FunctionBody(f.Body);
this.Category = new string(f.Category.ToCharArray());
this.Extension = f.Extension;
this.Name = new string(f.Name.ToCharArray());
this.NeedsWrapper = f.NeedsWrapper;
this.Parameters = new ParameterCollection(f.Parameters);
this.ReturnValue = new string(f.ReturnValue.ToCharArray());
this.Version = new string(f.Version.ToCharArray());
this.WrapperType = f.WrapperType;
}
#endregion
#region Function body
FunctionBody _body;
public FunctionBody Body
{
get { return _body; }
set { _body = value; }
}
#endregion
#region Category property
private string _category;
public string Category
{
get { return _category; }
set { _category = value; }
}
#endregion
#region Wrapper type property
private WrapperTypes _wrapper_type = WrapperTypes.None;
public WrapperTypes WrapperType
{
get { return _wrapper_type; }
set { _wrapper_type = value; }
}
#endregion
#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;
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 Call function string
public string CallString()
{
StringBuilder sb = new StringBuilder();
sb.Append(Name);
sb.Append("(");
foreach (Parameter p in Parameters)
{
if (p.Unchecked)
sb.Append("unchecked((" + p.Type + ")");
sb.Append(p.Name);
if (p.Unchecked)
sb.Append(")");
sb.Append(", ");
}
sb.Replace(", ", ")", sb.Length - 2, 2);
return sb.ToString();
}
#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()
{
return ToString("");
}
public string ToString(string indentation)
{
StringBuilder sb = new StringBuilder();
sb.Append(indentation + ReturnValue + " " + Name + Parameters.ToString());
if (Body.Count > 0)
{
sb.AppendLine();
sb.Append(Body.ToString(indentation));
}
return sb.ToString();
}
#endregion
}
#endregion
#region class FunctionBody : List<string>
public class FunctionBody : List<string>
{
public FunctionBody()
{
}
public FunctionBody(FunctionBody fb)
{
foreach (string s in fb)
{
this.Add(s);
}
}
public override string ToString()
{
return ToString("");
}
public string ToString(string indentation)
{
if (this.Count == 0)
return String.Empty;
StringBuilder sb = new StringBuilder(this.Count);
sb.AppendLine(indentation + "{");
foreach (string s in this)
{
sb.AppendLine(indentation + " " + s);
}
sb.AppendLine(indentation + "}");
return sb.ToString();
}
}
#endregion
}

View file

@ -0,0 +1,352 @@
#region License
//Copyright (c) 2006 Stephen Apostolopoulos
//See license.txt for license info
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace OpenTK.OpenGL.Bind
{
#region Parameter class
/// <summary>
/// Represents a single parameter of an opengl function.
/// </summary>
public class Parameter
{
#region Constructors
/// <summary>
/// Creates a new Parameter without type and name.
/// </summary>
public Parameter()
{
}
/// <summary>
/// Creates a new parameter from the parameters passed (deep copy).
/// </summary>
/// <param name="p">The parameter to copy from.</param>
public Parameter(Parameter p)
{
if (p == null)
return;
this.Array = p.Array;
this.Flow = p.Flow;
this.Name = new string(p.Name.ToCharArray());
this.NeedsWrapper = p.NeedsWrapper;
this.PreviousType = new string(p.PreviousType.ToCharArray());
this.Type = new string(p.Type.ToCharArray());
this.Unchecked = p.Unchecked;
this.UnmanagedType = p.UnmanagedType;
this.WrapperType = p.WrapperType;
}
#endregion
#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 UnmanagedType 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
{
if (_type != null)
PreviousType = _type;
_type = value;
}
}
#endregion
#region Previous type property
private string _previous_type;
public string PreviousType
{
get { return _previous_type; }
set { _previous_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 Unchecked property
private bool _unchecked;
public bool Unchecked
{
get { return _unchecked; }
set { _unchecked = value; }
}
#endregion
#region NeedsWrapper property
private bool _needs_wrapper;
public bool NeedsWrapper
{
get { return _needs_wrapper; }
set { _needs_wrapper = value; }
}
#endregion
#region WrapperType property
private WrapperTypes _wrapper_type = WrapperTypes.None;
public WrapperTypes WrapperType
{
get { return _wrapper_type; }
set { _wrapper_type = value; }
}
#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 (UnmanagedType == UnmanagedType.LPArray)
sb.Append("[MarshalAs(UnmanagedType.LPArray)] ");
//if (Flow == FlowDirection.Out && !Array && !(Type == "IntPtr"))
// sb.Append("out ");
sb.Append(Type);
if (Array)
sb.Append("[]");
sb.Append(" ");
sb.Append(Name);
return sb.ToString();
}
#endregion
}
#endregion
#region ParameterCollection class
/// <summary>
/// Holds the parameter list of an opengl function.
/// </summary>
public class ParameterCollection : List<Parameter>
{
#region Constructors
public ParameterCollection()
{
}
public ParameterCollection(ParameterCollection pc)
{
foreach (Parameter p in pc)
{
this.Add(new Parameter(p));
}
}
#endregion
#region override public string ToString()
/// <summary>
///
/// </summary>
/// <returns>The parameter list of an opengl function in the form ( [parameters] )</returns>
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;
}
#endregion
#region public ParameterCollection ReplaceAll(Parameter, Parameter)
/// <summary>
/// Replaces all parameters that match the old_param with the new_param.
/// </summary>
/// <param name="old_param"></param>
/// <param name="new_param"></param>
/// <returns></returns>
/// <remarks>The PreviousType property is ignored in parameter matching, and is set to the previous type in case of replacement.</remarks>
public ParameterCollection ReplaceAll(Parameter old_param, Parameter new_param)
{
if (old_param == null || new_param == null)
return null;
ParameterCollection pc = new ParameterCollection(this);
foreach (Parameter p in pc)
{
if (p.Array == old_param.Array &&
p.Flow == old_param.Flow &&
p.Name == old_param.Name &&
//p.PreviousType == old_param.PreviousType &&
p.Type == old_param.Type &&
p.UnmanagedType == old_param.UnmanagedType)
{
p.Array = new_param.Array;
p.Flow = new_param.Flow;
p.Name = new_param.Name;
p.PreviousType = p.Type;
p.Type = new_param.Type;
p.UnmanagedType = new_param.UnmanagedType;
}
}
return pc;
}
#endregion
#region public ParameterCollection Replace(Parameter, Parameter)
/// <summary>
/// Replaces the first parameter that matches old_param with new_param.
/// </summary>
/// <param name="old_param"></param>
/// <param name="new_param"></param>
/// <returns></returns>
/// <remarks>The PreviousType property is ignored in parameter matching, and is set to the previous type in case of replacement.</remarks>
public ParameterCollection Replace(Parameter old_param, Parameter new_param)
{
if (old_param == null || new_param == null)
return null;
ParameterCollection pc = new ParameterCollection(this);
foreach (Parameter p in pc)
{
if (p.Array == old_param.Array &&
p.Flow == old_param.Flow &&
p.Name == old_param.Name &&
//p.PreviousType == old_param.PreviousType &&
p.Type == old_param.Type &&
p.UnmanagedType == old_param.UnmanagedType)
{
p.Array = new_param.Array;
p.Flow = new_param.Flow;
p.Name = new_param.Name;
p.PreviousType = p.Type;
p.Type = new_param.Type;
p.UnmanagedType = new_param.UnmanagedType;
return pc;
}
}
return pc;
}
#endregion
}
#endregion
}

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,86 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
using System;
using System.Drawing;
using System.Globalization;
namespace OpenTK.OpenGL
{
public class ColorDepth
{
public byte Red, Green, Blue, Alpha;
public bool IsIndexed = false;
public int BitsPerPixel;
public ColorDepth(int bpp)
{
Red = Green = Blue = Alpha = 0;
BitsPerPixel = bpp;
switch (bpp)
{
case 32:
Red = Green = Blue = Alpha = 8;
break;
case 24:
Red = Green = Blue = 8;
break;
case 16:
Red = Blue = 5;
Green = 6;
break;
case 15:
Red = Green = Blue = 5;
break;
case 8:
IsIndexed = true;
break;
case 4:
IsIndexed = true;
break;
default:
break;
}
}
public ColorDepth(int red, int green, int blue, int alpha)
{
Red = (byte)red;
Green = (byte)green;
Blue = (byte)blue;
Alpha = (byte)alpha;
BitsPerPixel = red + green + blue + alpha;
}
public override bool Equals(object obj)
{
return (obj is ColorDepth) ? (this == (ColorDepth)obj) : false;
}
public static bool operator ==(ColorDepth left, ColorDepth right)
{
return left.Red == right.Red &&
left.Green == right.Green &&
left.Blue == right.Blue &&
left.Alpha == right.Alpha;
}
public static bool operator !=(ColorDepth left, ColorDepth right)
{
return !(left == right);
}
public override int GetHashCode()
{
return Red ^ Green ^ Blue ^ Alpha;
}
public override string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "{0}", BitsPerPixel + (IsIndexed ? " indexed" : String.Empty) + " bpp");
}
}
}

View file

@ -0,0 +1,237 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos and Erik Ylvisaker.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenTK.OpenGL.Platform;
namespace OpenTK.OpenGL
{
public abstract partial class GLContext : IDisposable
{
#region --- Private Variables ---
private Control control;
private bool isDisposed = false;
private bool isFullScreen = false;
private GLContext fullScreenContext = null;
#endregion
#region --- Creation / Destruction ---
/// <summary>
/// Constructs a GLContext abstract base class.
/// </summary>
/// <param name="control"></param>
protected GLContext(Control control)
{
this.control = control;
}
/// <summary>
/// Finalizes the GLContext object.
/// </summary>
~GLContext()
{
if (isDisposed == false)
Dispose(false);
}
/// <summary>
/// Disposes of the GLContext object. If called on a full-screen context, this
/// will return the display resolution to the desktop settings.
/// </summary>
public void Dispose()
{
if (isDisposed == false)
{
Dispose(true);
isDisposed = true;
GC.SuppressFinalize(this);
}
}
/// <summary>
/// Override to provide platform-specific destruction methods.
/// </summary>
/// <param name="disposing"></param>
protected abstract void Dispose(bool disposing);
/// <summary>
/// Creates an object driving from GLContext which handles the necessary
/// details for interacting with the operating system the application is run on.
/// </summary>
/// <param name="c">The control to which the GLContext is bound. OpenGL rendering
/// will occur within this control.</param>
/// <param name="color">A structure indicating the color depth the application is requesting.</param>
/// <param name="depth">The number of bits the depth buffer should contain.</param>
/// <param name="stencil">The number of bits the stencil buffer should contain.</param>
/// <returns>A GLContext object.</returns>
public static GLContext Create(Control c, ColorDepth color, int depth, int stencil)
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
Environment.OSVersion.Platform == PlatformID.Win32Windows)
{
return new WindowsContext(c, color, depth, stencil);
}
else if (Environment.OSVersion.Platform == PlatformID.Unix ||
Environment.OSVersion.Platform == (PlatformID)128) // some older versions of Mono reported 128.
{
return new X11Context(c, color, depth, stencil);
}
else
{
throw new PlatformNotSupportedException("The platform on which you are trying to run this program is not currently supported. Sorry for the inconvenience.");
}
}
#endregion
#region --- Public Properties ---
/// <summary>
/// Returns the AspectRatio of the control this GLContext object
/// renders to. This is usually used in a call to Glu.Perspective.
/// </summary>
public double AspectRatio
{
get
{
return control.Width / (double)control.Height;
}
}
/// <summary>
/// Gets the width of the render target control in pixels.
/// </summary>
public int Width
{
get { return control.Width; }
}
/// <summary>
/// Gets the height of the render target control in pixels.
/// </summary>
public int Height
{
get { return control.Height; }
}
/// <summary>
/// Gets the size of the render target control.
/// </summary>
public Size Size
{
get { return control.Size; }
}
/// <summary>
/// Returns true if this context is managing a full-screen environment.
/// Only one context can manage a full-screen environment at a time.
/// </summary>
public bool IsFullscreen
{
get { return isFullScreen; }
protected set
{
CheckAnyFullScreen();
if (value)
fullScreenContext = this;
else if (fullScreenContext == this)
fullScreenContext = null;
isFullScreen = value;
}
}
/// <summary>
/// The WinForms Control that this GLContext is bound to.
/// </summary>
public Control Control
{
get { return control; }
}
/// <summary>
/// Returns true if this object has had its Dispose method called.
/// If IsDisposed is true, no calls should be made on the context object.
/// </summary>
public bool IsDisposed
{
get { return isDisposed; }
set { isDisposed = value; }
}
#endregion
#region --- Protected Helper Methods ---
/// <summary>
/// This method checks to see if any context other than the current one is a full-screen
/// context, and throws an exception if it is. This is meant to be called from inside
/// an overriden SetFullScreen function.
/// </summary>
protected void CheckAnyFullScreen()
{
if (fullScreenContext == null || fullScreenContext == this)
return;
throw new Exception("Already have a full screen context!");
}
#endregion
#region --- Public Context Management Methods ---
/// <summary>
/// Swaps buffers on a context. This presents the rendered scene to the user.
/// </summary>
public abstract void SwapBuffers();
/// <summary>
/// Makes this context the current rendering target.
/// </summary>
public abstract void MakeCurrent();
/// <summary>
/// Requests that the GLContext object set the screen to a particular resolution and color
/// depth. Only one context can be set to be a full screen context at a time.
/// </summary>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="color"></param>
public abstract void SetFullScreen(int width, int height, OpenTK.OpenGL.ColorDepth color);
/// <summary>
/// Restores the desktop resolution after a call to SetFullScreen.
/// </summary>
public abstract void SetWindowed();
#endregion
#region --- Display Mode Methods ---
public abstract DisplayMode[] EnumDisplayModes();
#endregion
/// <summary>
/// Gets the address of an OpenGL extension function.
/// </summary>
/// <param name="function_string">The name of the OpenGL function (e.g. "glGetString")</param>
/// <param name="function_type">The function signature.</param>
/// <returns>A Delegate that can be used to call this function, or null if the function is not supported by the drivers.</returns>
protected abstract System.Delegate GetAddress(string function_string, Type function_type);
}
}

View file

@ -0,0 +1,245 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos and Erik Ylvisaker.
*/
#endregion
#region --- Using Directives ---
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Text;
//using OpenTK.OpenGL;
using OpenTK.Platform.Windows;
#endregion
namespace OpenTK.OpenGL.Platform
{
public class WindowsContext : GLContext
{
protected const string _dll_name = "OPENGL32.DLL";
protected int _dll_handle;
protected int _device_context;
protected int _render_context;
protected IntPtr _window_handle;
public WindowsContext(Control c, ColorDepth color, int depth, int stencil)
: base(c)
{
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.WinApi.LoadLibrary(_dll_name);
error_code = Marshal.GetLastWin32Error();
if (error_code != 0)
{
//System.Diagnostics.Debug.WriteLine("LoadLibrary({0}) set error code: {1}. Will not load extensions.", _dll_name, error_code);
}
else
{
//System.Diagnostics.Debug.WriteLine("Loaded dll: {0}", _dll_name);
}
}
_device_context = OpenTK.Platform.Windows.WinApi.GetDC(_window_handle.ToInt32());
OpenTK.Platform.Windows.WinApi.PixelFormatDescriptor pixel_format = new OpenTK.Platform.Windows.WinApi.PixelFormatDescriptor();
pixel_format.ColorBits = (byte)(color.Red + color.Green + color.Blue);
pixel_format.RedBits = (byte)color.Red;
pixel_format.GreenBits = (byte)color.Green;
pixel_format.BlueBits = (byte)color.Blue;
pixel_format.AlphaBits = (byte)color.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.WinApi.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.WinApi.ChoosePixelFormat(_device_context, pixel_format);
if (pixel == 0)
{
throw new Exception("The requested pixel format is not supported by the hardware configuration.");
}
OpenTK.Platform.Windows.WinApi.SetPixelFormat(_device_context, pixel, pixel_format);
_render_context = Wgl.CreateContext(_device_context);
MakeCurrent();
//c.TopLevelControl.Move += new EventHandler(c_Move);
//c.Move += new EventHandler(c_Move);
//c.Resize += new EventHandler(c_Resize);
//GL.ReloadFunctions();
}
void c_Resize(object sender, EventArgs e)
{
if (IsFullscreen)
SetCursorClip();
}
void c_Move(object sender, EventArgs e)
{
if (IsFullscreen)
SetCursorClip();
}
protected override void Dispose(bool disposing)
{
if (IsFullscreen)
SetWindowed();
if (_render_context != 0)
Wgl.DeleteContext(_render_context);
if (_device_context != 0)
OpenTK.Platform.Windows.WinApi.ReleaseDC(_window_handle.ToInt32(), _device_context);
if (_dll_handle != 0)
OpenTK.Platform.Windows.WinApi.FreeLibrary(_dll_handle);
_render_context = 0;
_device_context = 0;
_dll_handle = 0;
}
public override void SwapBuffers()
{
OpenTK.Platform.Windows.WinApi.SwapBuffers(_device_context);
}
protected override Delegate GetAddress(string function_string, Type function_type)
{
IntPtr address = Wgl.GetProcAddress(function_string);
if (address == IntPtr.Zero)
return null;
else
return Marshal.GetDelegateForFunctionPointer(address, function_type);
}
public override void MakeCurrent()
{
Wgl.MakeCurrent(_device_context, _render_context);
}
public override void SetWindowed()
{
WinApi.ChangeDisplaySettings(null, 0);
IsFullscreen = false;
}
public override void SetFullScreen(int width, int height, OpenTK.OpenGL.ColorDepth color)
{
CheckAnyFullScreen();
WinApi.DeviceMode ScreenSettings = new WinApi.DeviceMode();
ScreenSettings.PelsWidth = width; // Selected Screen Width
ScreenSettings.PelsHeight = height; // Selected Screen Height
ScreenSettings.BitsPerPel = color.Alpha + // Selected Bits Per Pixel
color.Red +
color.Green +
color.Blue;
ScreenSettings.Fields = WinApi.Constants.DM_BITSPERPEL
| WinApi.Constants.DM_PELSWIDTH
| WinApi.Constants.DM_PELSHEIGHT;
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
if (WinApi.ChangeDisplaySettings(ScreenSettings,
WinApi.Constants.CDS_FULLSCREEN) == WinApi.Constants.DISP_CHANGE_SUCCESSFUL)
{
IsFullscreen = true;
SetCursorClip();
}
else
{
throw new Exception("Could not change full-screen resolution.");
}
}
/// <summary>
/// Clips the cursor's available positions to within the render target.
/// </summary>
private void SetCursorClip()
{
Cursor.Clip = new Rectangle(this.Control.PointToScreen(Point.Empty), this.Control.Size);
}
public override DisplayMode[] EnumDisplayModes()
{
List<DisplayMode> modes = new List<DisplayMode>();
bool done = false;
int index = 0;
while (!done)
{
WinApi.DeviceMode currentMode = new WinApi.DeviceMode();
IntPtr handle = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(WinApi.DeviceMode)));
Marshal.StructureToPtr(currentMode, handle, true);
done = (WinApi.EnumDisplaySettings(null, index++, handle) != 0) ? false : true;
int error = Marshal.GetLastWin32Error();
Marshal.PtrToStructure(handle, currentMode);
Marshal.FreeHGlobal(handle);
if (error != 0)
{
Console.WriteLine("Error: {0}", error);
continue;
}
if (done)
break;
//DisplayMode mode = new DisplayMode(currentMode.PelsWidth, currentMode.PelsHeight);
DisplayMode mode = new DisplayMode(
currentMode.PelsWidth,
currentMode.PelsHeight,
currentMode.BitsPerPel,
currentMode.DisplayFrequency
);
modes.Add(mode);
}
return modes.ToArray();
}
}
}

View file

@ -0,0 +1,359 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos and Erik Ylvisaker.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;
using OpenTK.Platform.X;
namespace OpenTK.OpenGL.Platform
{
public partial class X11Context : OpenTK.OpenGL.GLContext
{
private IntPtr glxVisualInfo;
private IntPtr x11context;
private IntPtr display;
private IntPtr rootWindow;
private Type xplatui;
private int screenNo;
private Size fullScreenSize;
private IntPtr desktopResolution = IntPtr.Zero;
private int depthBits;
private int stencilBits;
//const string _dll_name = "libGL.so.1";
public X11Context(Control c, ColorDepth color, int depth, int stencil)
: base(c)
{
this.depthBits = depth;
this.stencilBits = stencil;
Console.WriteLine("Creating X11Context.");
xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
if (xplatui != null)
{
Console.WriteLine("Got XplatUIX11 type.");
display = (IntPtr)xplatui.GetField("DisplayHandle",
System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic).GetValue(null);
rootWindow = (IntPtr)xplatui.GetField("RootWindow",
System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic).GetValue(null);
screenNo = (int)xplatui.GetField("ScreenNo",
System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic).GetValue(null);
Console.WriteLine("DisplayHandle: {0} RootWindow: {1} ScreenNo: {2}",
display, rootWindow, screenNo);
int[] dblBuf = new int[]
{
5,
(int)Glx.Enums.GLXAttribute.RGBA,
(int)Glx.Enums.GLXAttribute.RED_SIZE, color.Red,
(int)Glx.Enums.GLXAttribute.GREEN_SIZE, color.Green,
(int)Glx.Enums.GLXAttribute.BLUE_SIZE, color.Blue,
(int)Glx.Enums.GLXAttribute.DEPTH_SIZE, depth,
0
};
IntPtr glxVisualInfo = Glx.ChooseVisual(display, screenNo, dblBuf);
Console.WriteLine("GLXVisualInfo: {0}", glxVisualInfo);
X11Api.VisualInfo xVisualInfo = (X11Api.VisualInfo)
Marshal.PtrToStructure(glxVisualInfo, typeof(X11Api.VisualInfo));
IntPtr visual = xVisualInfo.visual;
IntPtr colormap = X11Api.CreateColormap(display, rootWindow, visual, 0/*AllocNone*/);
xplatui.GetField("CustomVisual", System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic).SetValue(null, visual);
xplatui.GetField("CustomColormap", System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic).SetValue(null, colormap);
Console.WriteLine("colormap: {0}", colormap);
x11context = Glx.CreateContext(display, glxVisualInfo, IntPtr.Zero, true);
Console.WriteLine("x11context: {0}", x11context);
X11Api.XMapRaised(display, Control.TopLevelControl.Handle);
MakeCurrent();
X11Api.Free(glxVisualInfo);
}
//c.MouseDown += new MouseEventHandler(c_MouseDown);
//c.MouseLeave += new EventHandler(c_MouseLeave);
//c.MouseUp += new MouseEventHandler(c_MouseUp);
}
void c_MouseDown(object sender, MouseEventArgs e)
{
if (IsFullscreen)
GrabPointer();
}
void c_MouseMove(object sender, MouseEventArgs e)
{
Console.WriteLine("{0}", Cursor.Position);
if (Cursor.Position.X > fullScreenSize.Width)
Cursor.Position = new Point(fullScreenSize.Width, Cursor.Position.Y);
if (Cursor.Position.Y > fullScreenSize.Height)
Cursor.Position = new Point(Cursor.Position.X, fullScreenSize.Height);
ResetViewport();
}
void c_MouseUp(object sender, MouseEventArgs e)
{
if (IsFullscreen)
GrabPointer();
}
void c_MouseLeave(object sender, EventArgs e)
{
if (IsFullscreen)
GrabPointer();
}
public override void MakeCurrent()
{
bool result = Glx.MakeCurrent(display, this.Control.Handle, x11context);
if (!result)
{
Console.WriteLine("Failed to make context {0} current.", x11context);
// probably need to recreate context here.
}
}
public override void SwapBuffers()
{
Glx.SwapBuffers(display, this.Control.Handle);
}
protected override void Dispose(bool disposing)
{
SetWindowed();
Glx.DestroyContext(display, x11context);
}
protected override Delegate GetAddress(string function_string, Type function_type)
{
IntPtr address = Glx.GetProcAddress(function_string);
if (address == IntPtr.Zero)
return null;
else
return Marshal.GetDelegateForFunctionPointer(address, function_type);
}
public override void SetWindowed()
{
if (desktopResolution != IntPtr.Zero)
{
// set the resolution back to the desktop mode.
X11Api.XUngrabPointer(display, 0);
X11Api.XUngrabKeyboard(display, 0);
X11Api.XF86VidModeSwitchToMode(display, 0, desktopResolution);
Marshal.FreeHGlobal(desktopResolution);
desktopResolution = IntPtr.Zero;
IsFullscreen = false;
}
}
public override void SetFullScreen(int width, int height, ColorDepth color)
{
CheckAnyFullScreen();
// query and output the version of the video mode extension.
int majorVersion, minorVersion;
X11Api.XF86VidModeQueryVersion(display, out majorVersion, out minorVersion);
Console.WriteLine("XFree86 Video Mode Extension version {0}.{1}", majorVersion, minorVersion);
// get the list of display modes
X11Api.XF86VidModeModeInfo[] modeList = GetXDisplayModeList();
int selectedMode = 0;
for (int i = 0; i < modeList.Length; i++)
{
Console.Write(" ");
if (selectedMode == 0 &&
modeList[i].hdisplay == width && modeList[i].vdisplay == height)
{
selectedMode = i;
Console.Write("*");
}
else
Console.Write(" ");
Console.Write("Mode #{0}: {1}x{2}", i,
modeList[i].hdisplay, modeList[i].vdisplay);
if (i % 3 == 0 && i > 0)
Console.WriteLine();
}
// store the resolution of the desktop.
desktopResolution = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(X11Api.XF86VidModeModeInfo)));
Marshal.StructureToPtr(modeList[0], desktopResolution, true);
Console.WriteLine("Attempting to set resolutions to {0}x{1}", width, height);
if (selectedMode == 0)
Console.WriteLine("--- Failed to find an appropriate mode.");
fullScreenSize = new Size(width, height);
SwitchDisplayMode(modeList[selectedMode]);
GrabPointer();
BindColorMap(color, depthBits, stencilBits);
this.IsFullscreen = true;
}
private void BindColorMap(ColorDepth color, int depth, int stencil)
{
int[] dblBuf = new int[]
{
5,
(int)Glx.Enums.GLXAttribute.RGBA,
(int)Glx.Enums.GLXAttribute.RED_SIZE, color.Red,
(int)Glx.Enums.GLXAttribute.GREEN_SIZE, color.Green,
(int)Glx.Enums.GLXAttribute.BLUE_SIZE, color.Blue,
(int)Glx.Enums.GLXAttribute.DEPTH_SIZE, depth,
0
};
glxVisualInfo = Glx.ChooseVisual(display, screenNo, dblBuf);
X11Api.VisualInfo xVisualInfo = (X11Api.VisualInfo)Marshal.PtrToStructure
(glxVisualInfo, typeof(X11Api.VisualInfo));
IntPtr visual = xVisualInfo.visual;
IntPtr colormap = X11Api.CreateColormap(display, rootWindow, visual, 0/*AllocNone*/);
xplatui.GetField("CustomVisual", System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic).SetValue(null, visual);
xplatui.GetField("CustomColormap", System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic).SetValue(null, colormap);
X11Api.Free(glxVisualInfo);
}
private void GrabPointer()
{
Console.Write("Grabbing pointer... ");
X11Api.ErrorCodes retval = X11Api.XGrabPointer(display, this.Control.Handle, true, 0,
X11Api.GrabMode.Async, X11Api.GrabMode.Async,
this.Control.Handle, IntPtr.Zero, 0);
Console.WriteLine(retval.ToString());
Console.Write("Grabbing keyboard... ");
retval = X11Api.XGrabKeyboard(display, this.Control.Handle, true,
X11Api.GrabMode.Async, X11Api.GrabMode.Async, 0);
Console.WriteLine(retval.ToString());
ResetViewport();
}
private void SwitchDisplayMode(X11Api.XF86VidModeModeInfo mode)
{
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(mode));
Marshal.StructureToPtr(mode, ptr, true);
X11Api.XF86VidModeSwitchToMode(display, screenNo, ptr);
Marshal.FreeHGlobal(ptr);
ResetViewport();
}
/// <summary>
/// Resets the viewport for full screen modes.
/// X does this thing where if your screen resolution is smaller than your desktop resolution,
/// you can scroll around. This resets the part of the desktop you're looking at to the
/// upper left.
/// </summary>
private void ResetViewport()
{
X11Api.XF86VidModeSetViewPort(display, screenNo, 0, 0);
}
public override DisplayMode[] EnumDisplayModes()
{
List<DisplayMode> modes = new List<DisplayMode>();
X11Api.XF86VidModeModeInfo[] list= GetXDisplayModeList();
for (int i = 0; i < list.Length; i++)
{
modes.Add(new DisplayMode(list[i].hdisplay, list[i].vdisplay));
}
return modes.ToArray();
}
private X11Api.XF86VidModeModeInfo[] GetXDisplayModeList()
{
// get a list of all the video modes.
int modeCount;
IntPtr modesInfoPtr;
X11Api.XF86VidModeGetAllModeLines(display, screenNo, out modeCount, out modesInfoPtr);
Console.WriteLine("Video mode query returned {0} available modes.", modeCount);
// modesInfo now contains a pointer to an array of pointers to XF86VidModeModeInfo structures.
// first, we need to copy these pointers to an array of intptr's, then we can copy the
// structures pointed to.
IntPtr[] modesInfo = new IntPtr[modeCount];
// Marshal.Copy does not work correctly with Mono 1.1.18.
//Marshal.Copy(modesInfoPtr, (IntPtr[])modesInfo, 0, modeCount);
unsafe
{
IntPtr* ptr = (IntPtr*)modesInfoPtr;
for (int i = 0; i < modeCount; i++)
modesInfo[i] = ptr[i];
}
X11Api.XF86VidModeModeInfo[] modeList = new X11Api.XF86VidModeModeInfo[modeCount];
for (int i = 0; i < modeCount; i++)
{
modeList[i] = (X11Api.XF86VidModeModeInfo)
Marshal.PtrToStructure(modesInfo[i], typeof(X11Api.XF86VidModeModeInfo));
}
X11Api.Free(modesInfoPtr);
return modeList;
}
}
}

View file

@ -0,0 +1,97 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.OpenGL
{
/// <summary>
/// Provides methods to create and render a display list.
/// </summary>
public class DisplayList : IDisposable
{
#region --- Private variables ---
private int id = -1;
#endregion
#region --- Constructors ---
/// <summary>
/// Allocates a new DisplayList.
/// </summary>
public DisplayList()
{
Id = GL.GenLists(1);
}
#endregion
#region --- Public properties ---
/// <summary>
/// Gets the display list number.
/// </summary>
public int Id
{
get { return id; }
private set { id = value; }
}
#endregion
#region --- Public methods ---
/// <summary>
/// Starts recording elements into the display list.
/// </summary>
public void Begin()
{
GL.NewList(Id, Enums.ListMode.COMPILE);
}
/// <summary>
/// Starts recording elements into the display list.
/// </summary>
/// <param name="listMode">Sets if the list is to be compiled or compiled and executed immediately.</param>
public void Begin(Enums.ListMode listMode)
{
GL.NewList(Id, listMode);
}
/// <summary>
/// Stops recording elements into the display list.
/// </summary>
public void End()
{
GL.EndList();
}
/// <summary>
/// Renders the display list elements.
/// </summary>
public void Render()
{
GL.CallList(Id);
}
#region IDisposable Members
public void Dispose()
{
if (Id > 0)
GL.DeleteLists(Id, 1);
Id = -1;
}
#endregion
#endregion
}
}

View file

@ -0,0 +1,82 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
using System;
using System.Drawing;
using System.Globalization;
namespace OpenTK.OpenGL
{
public class DisplayMode
{
#region --- Private Variables ---
private Size size;
private ColorDepth color;
private int displayFrequency;
#endregion
#region --- Public Properties ---
/// <summary>
/// Gets or sets the Size of the DisplayMode.
/// </summary>
public Size Size
{
get { return size; }
set { size = value; }
}
/// <summary>
/// Gets or sets the Height of the DisplayMode. Height is the vertical span measured in pixels.
/// </summary>
public int Height
{
get { return size.Height; }
set { size.Height = value; }
}
/// <summary>
/// Gets or sets the Width of the DisplayMode. Width is the horizontal span measured in pixels.
/// </summary>
public int Width
{
get { return size.Width; }
set { size.Width = value; }
}
/// <summary>
/// Creates a DisplayMode.
/// </summary>
/// <param name="width">The Width of the DisplayMode in pixels.</param>
/// <param name="height">The Height of the DisplayMode in pixels.</param>
public DisplayMode(int width, int height)
:this(width, height, 0, 0, 0, 0, 0)
{
}
public DisplayMode(int width, int height, int bpp, int frequency)
:this(width, height, 0, 0, 0, 0, frequency)
{
color = new ColorDepth(bpp);
}
public DisplayMode(int width, int height, int r, int g, int b, int a, int frequency)
{
size = new Size(width, height);
color = new ColorDepth(r, g, b, a);
displayFrequency = frequency;
}
public override string ToString()
{
return string.Format(CultureInfo.CurrentCulture, "{0}x{1}, {2}, {3}Hz", Width, Height, color, displayFrequency);
}
#endregion
}
}

View file

@ -0,0 +1,460 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
#region --- Using Directives ---
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;
#endregion
namespace OpenTK.OpenGL
{
/// <summary>
/// OpenGL binding for .NET, implementing OpenGL 2.1, plus extensions.
/// </summary>
/// <remarks>
/// <para>
/// OpenTK.OpenGL.GL contains all OpenGL enums and functions defined in the 2.1 specification.
/// The official .spec files can be found at: http://opengl.org/registry/.
/// </para>
/// <para>
/// OpenTK.OpenGL.GL relies on static initialization to obtain the entry points for OpenGL functions.
/// Please ensure that a valid OpenGL context has been made current in the pertinent thread <b>before</b>
/// any OpenGL functions are called (toolkits like GLUT, SDL or GLFW will automatically take care of
/// the context initialization process). Without a valid OpenGL context, OpenTK.OpenGL.GL will only be able
/// to retrieve statically exported entry points (typically corresponding to OpenGL version 1.1 under Windows,
/// 1.3 under Linux and 1.4 under Windows Vista), and extension methods will need to be loaded manually.
/// </para>
/// <para>
/// If you prefer not to rely on static initialisation for the Gl class, you can use the
/// ReloadFunctions or ReloadFunction methods to manually force the initialisation of OpenGL entry points.
/// The ReloadFunctions method should be called whenever you change an existing visual or pixelformat. This
/// generally happens when you change the color/stencil/depth buffer associated with a window (but probably
/// not the resolution). This may or may not be necessary under Linux/MacOS, but is generally required for
/// Windows.
/// </para>
/// <para>
/// You can use the Gl.IsExtensionSupported method to check whether any given category of extension functions
/// exists in the current OpenGL context. The results can be cached to speed up future searches.
/// Keep in mind that different OpenGL contexts may support different extensions, and under different entry
/// points. Always check if all required extensions are still supported when changing visuals or pixel
/// formats.
/// </para>
/// <para>
/// You may retrieve the entry point for an OpenGL extension using the Gl.GetDelegateForExtensionMethod
/// and Gl.GetFunctionPointerForExtensionMethod methods. You may retrieve the entry point for an OpenGL
/// function using the Gl.GetDelegateForMethod method. All three methods are cross-platform.
/// </para>
/// <para>
/// <see href="http://opengl.org/registry/"/>
/// <seealso cref="Gl.IsExtensionSupported(string, bool)"/>
/// <seealso cref="Gl.GetDelegateForExtensionMethod"/>
/// <seealso cref="Gl.GetFunctionPointerForExtensionMethod"/>
/// <seealso cref="Gl.GetDelegateForMethod"/>
/// <seealso cref="Gl.ReloadFunctions"/>
/// <seealso cref="Gl.ReloadFunction"/>
/// </para>
/// </remarks>
public static partial class GL
{
#region private enum Platform
/// <summary>
/// Enumerates the platforms OpenTK can run on.
/// </summary>
private enum Platform
{
Unknown,
Windows,
X11,
X11_ARB,
OSX
};
#endregion private enum Platform
private static Platform platform = Platform.Unknown;
private static System.Collections.Generic.Dictionary<string, bool> AvailableExtensions;
#region internal static extern IntPtr glxGetProcAddressARB(string s);
// also linux, for our ARB-y friends
[DllImport(GL_NATIVE_LIBRARY, EntryPoint = "glXGetProcAddressARB")]
internal static extern IntPtr glxGetProcAddressARB(string s);
#endregion
#region internal static IntPtr aglGetProcAddress(string s)
// osx gets complicated
[DllImport(GL_NATIVE_LIBRARY, EntryPoint = "NSIsSymbolNameDefined")]
internal static extern bool NSIsSymbolNameDefined(string s);
[DllImport(GL_NATIVE_LIBRARY, EntryPoint = "NSLookupAndBindSymbol")]
internal static extern IntPtr NSLookupAndBindSymbol(string s);
[DllImport(GL_NATIVE_LIBRARY, EntryPoint = "NSAddressOfSymbol")]
internal static extern IntPtr NSAddressOfSymbol(IntPtr symbol);
internal static IntPtr aglGetProcAddress(string s)
{
string fname = "_" + s;
if (!NSIsSymbolNameDefined(fname))
return IntPtr.Zero;
IntPtr symbol = NSLookupAndBindSymbol(fname);
if (symbol != IntPtr.Zero)
symbol = NSAddressOfSymbol(symbol);
return symbol;
}
#endregion
#region public static IntPtr GetFunctionPointerForExtensionMethod(string name)
/// <summary>
/// Retrieves the entry point for a dynamically exported OpenGL function.
/// </summary>
/// <param name="name">The function string for the OpenGL function (eg. "glNewList")</param>
/// <returns>
/// An IntPtr contaning the address for the entry point, or IntPtr.Zero if the specified
/// OpenGL function is not dynamically exported.
/// </returns>
/// <remarks>
/// <para>
/// The Marshal.GetDelegateForFunctionPointer method can be used to turn the return value
/// into a call-able delegate.
/// </para>
/// <para>
/// This function is cross-platform. It determines the underlying platform and uses the
/// correct wgl, glx or agl GetAddress function to retrieve the function pointer.
/// </para>
/// <see cref="Marshal.GetDelegateForFunctionPointer"/>
/// <seealso cref="Gl.GetDelegateForExtensionMethod"/>
/// </remarks>
public static IntPtr GetFunctionPointerForExtensionMethod(string name)
{
IntPtr result = IntPtr.Zero;
switch (platform)
{
case Platform.Unknown:
// WGL?
try
{
result = Wgl.GetProcAddress(name);
platform = Platform.Windows;
return result;
}
catch (Exception)
{ }
// AGL? (before X11, since GLX might exist on OSX)
try
{
result = aglGetProcAddress(name);
platform = Platform.OSX;
return result;
}
catch (Exception)
{ }
// X11?
try
{
result = Glx.GetProcAddress(name);
platform = Platform.X11;
return result;
}
catch (Exception)
{ }
// X11 ARB?
try
{
result = glxGetProcAddressARB(name);
platform = Platform.X11_ARB;
return result;
}
catch (Exception)
{ }
// Ack!
throw new NotSupportedException("Unknown platform - cannot get function pointer.");
case Platform.Windows:
return Wgl.GetProcAddress(name);
case Platform.OSX:
return aglGetProcAddress(name);
case Platform.X11:
return Glx.GetProcAddress(name);
case Platform.X11_ARB:
return glxGetProcAddressARB(name);
}
throw new NotSupportedException("Internal error - please report.");
}
#endregion public static IntPtr GetFunctionPointerForExtensionMethod(string s)
#region public static Delegate GetDelegateForExtensionMethod(string name, Type signature)
/// <summary>
/// Creates a System.Delegate that can be used to call a dynamically exported OpenGL function.
/// </summary>
/// <param name="name">The name of the OpenGL function (eg. "glNewList")</param>
/// <param name="signature">The signature of the OpenGL function.</param>
/// <returns>
/// A System.Delegate that can be used to call this OpenGL function or null
/// if the function is not available in the current OpenGL context.
/// </returns>
public static Delegate GetDelegateForExtensionMethod(string name, Type signature)
{
IntPtr address = GetFunctionPointerForExtensionMethod(name);
if (address == IntPtr.Zero)
{
return null;
}
else
{
return Marshal.GetDelegateForFunctionPointer(address, signature);
}
}
#endregion public static Delegate GetAddress(string name, Type signature)
#region public static Delegate GetDelegateForMethod(string name, Type signature)
/// <summary>
/// Creates a System.Delegate that can be used to call an OpenGL function, core or extension.
/// </summary>
/// <param name="name">The name of the OpenGL function (eg. "glNewList")</param>
/// <param name="signature">The signature of the OpenGL function.</param>
/// <returns>
/// A System.Delegate that can be used to call this OpenGL function, or null if the specified
/// function name did not correspond to an OpenGL function.
/// </returns>
public static Delegate GetDelegateForMethod(string name, Type signature)
{
Delegate d;
if (Assembly.Load("OpenTK.OpenGL").GetType("OpenTK.OpenGL.Imports").GetMethod(name.Substring(2)) != null)
{
d = GetDelegateForExtensionMethod(name, signature) ??
Delegate.CreateDelegate(signature, typeof(Imports), name.Substring(2));
}
else
{
d = GetDelegateForExtensionMethod(name, signature);
}
return d;
}
#endregion
#region public static bool IsExtensionSupported(string name)
/// <summary>
/// Determines whether the specified OpenGL extension category is available in
/// the current OpenGL context. Equivalent to IsExtensionSupported(name, true)
/// </summary>
/// <param name="name">The string for the OpenGL extension category (eg. "GL_ARB_multitexture")</param>
/// <returns>True if the specified extension is available, false otherwise.</returns>
public static bool IsExtensionSupported(string name)
{
return IsExtensionSupported(name, true);
}
#endregion
#region public static bool IsExtensionSupported(string name, bool useCache)
/// <summary>
/// Determines whether the specified OpenGL extension category is available in
/// the current OpenGL context.
/// </summary>
/// <param name="name">The string for the OpenGL extension category (eg. "GL_ARB_multitexture")</param>
/// <param name="useCache">If true, the results will be cached to speed up future results.</param>
/// <returns>True if the specified extension is available, false otherwise.</returns>
public static bool IsExtensionSupported(string name, bool useCache)
{
// Use cached results
if (useCache)
{
// Build cache if it is not available
if (AvailableExtensions == null)
{
ParseAvailableExtensions();
}
// Search the cache for the string. Note that the cache substitutes
// strings "1.0" to "2.1" with "GL_VERSION_1_0" to "GL_VERSION_2_1"
if (AvailableExtensions.ContainsKey(name))
return AvailableExtensions[name];
else
return false;
}
// Do not use cached results
string extension_string = GL.GetString(Enums.StringName.EXTENSIONS);
if (String.IsNullOrEmpty(extension_string))
return false; // no extensions are available
// Check if the user searches for GL_VERSION_X_X and search glGetString(GL_VERSION) instead.
if (name.Contains("GL_VERSION_"))
{
return GL.GetString(OpenTK.OpenGL.Enums.StringName.VERSION).Trim().StartsWith(name.Replace("GL_VERSION_", String.Empty).Replace('_', '.'));
}
// Search for the string given.
string[] extensions = extension_string.Split(' ');
foreach (string s in extensions)
{
if (name == s)
return true;
}
return false;
}
#endregion
#region private static void ParseAvailableExtensions()
/// <summary>
/// Builds a cache of the supported extensions to speed up searches.
/// </summary>
private static void ParseAvailableExtensions()
{
// Assumes there is a current context.
AvailableExtensions = new Dictionary<string, bool>();
string version_string = GL.GetString(OpenTK.OpenGL.Enums.StringName.VERSION);
if (String.IsNullOrEmpty(version_string))
return; // this shoudn't happen
string version = version_string.Trim(' ');
if (version.StartsWith("1.2"))
{
AvailableExtensions.Add("GL_VERSION_1_2", true);
}
else if (version.StartsWith("1.3"))
{
AvailableExtensions.Add("GL_VERSION_1_2", true);
AvailableExtensions.Add("GL_VERSION_1_3", true);
}
else if (version.StartsWith("1.4"))
{
AvailableExtensions.Add("GL_VERSION_1_2", true);
AvailableExtensions.Add("GL_VERSION_1_3", true);
AvailableExtensions.Add("GL_VERSION_1_4", true);
}
else if (version.StartsWith("1.5"))
{
AvailableExtensions.Add("GL_VERSION_1_2", true);
AvailableExtensions.Add("GL_VERSION_1_3", true);
AvailableExtensions.Add("GL_VERSION_1_4", true);
AvailableExtensions.Add("GL_VERSION_1_5", true);
}
else if (version.StartsWith("2.0"))
{
AvailableExtensions.Add("GL_VERSION_1_2", true);
AvailableExtensions.Add("GL_VERSION_1_3", true);
AvailableExtensions.Add("GL_VERSION_1_4", true);
AvailableExtensions.Add("GL_VERSION_1_5", true);
AvailableExtensions.Add("GL_VERSION_2_0", true);
}
else if (version.StartsWith("2.1"))
{
AvailableExtensions.Add("GL_VERSION_1_2", true);
AvailableExtensions.Add("GL_VERSION_1_3", true);
AvailableExtensions.Add("GL_VERSION_1_4", true);
AvailableExtensions.Add("GL_VERSION_1_5", true);
AvailableExtensions.Add("GL_VERSION_2_0", true);
AvailableExtensions.Add("GL_VERSION_2_1", true);
}
string extension_string = GL.GetString(OpenTK.OpenGL.Enums.StringName.EXTENSIONS);
if (String.IsNullOrEmpty(extension_string))
return; // no extensions are available
string[] extensions = extension_string.Split(' ');
foreach (string ext in extensions)
{
AvailableExtensions.Add(ext, true);
}
}
#endregion
#region public static void ReloadFunctions()
/// <summary>
/// Reloads all OpenGL functions (core and extensions).
/// </summary>
/// <remarks>
/// <para>
/// Call this function to reload all OpenGL entry points. This should be done
/// whenever you change the pixelformat/visual, or in the case you cannot (or do not want)
/// to use the automatic initialisation.
/// </para>
/// <para>
/// Calling this function before the automatic initialisation has taken place will result
/// in the Gl class being initialised twice. This is harmless, but given the automatic
/// initialisation should be preferred.
/// </para>
/// </remarks>
public static void ReloadFunctions()
{
Assembly asm = Assembly.Load("OpenTK.OpenGL");
Type delegates_class = asm.GetType("OpenTK.OpenGL.Delegates");
Type imports_class = asm.GetType("OpenTK.OpenGL.Imports");
FieldInfo[] v = delegates_class.GetFields();
foreach (FieldInfo f in v)
{
f.SetValue(null, GetDelegateForMethod(f.Name, f.FieldType));
}
ParseAvailableExtensions();
}
#endregion
#region public static bool ReloadFunction(string name)
/// <summary>
/// Tries to reload the given OpenGL function (core or extension).
/// </summary>
/// <param name="name">The name of the OpenGL function (i.e. glShaderSource)</param>
/// <returns>True if the function was found and reloaded, false otherwise.</returns>
/// <remarks>
/// <para>
/// Use this function if you require greater granularity when loading OpenGL entry points.
/// </para>
/// <para>
/// While the automatic initialisation will load all OpenGL entry points, in some cases
/// the initialisation can take place before an OpenGL Context has been established.
/// In this case, use this function to load the entry points for the OpenGL functions
/// you will need, or use ReloadFunctions() to load all available entry points.
/// </para>
/// <para>
/// This function will return true if the given OpenGL function exists, false otherwise.
/// A return value of "true" does not mean that any specific OpenGL function is supported;
/// rather it means that the string passed to this function denotes a known OpenGL function.
/// </para>
/// <para>
/// To query supported extensions use the IsExtensionSupported() function instead.
/// </para>
/// </remarks>
public static bool ReloadFunction(string name)
{
Assembly asm = Assembly.Load("OpenTK.OpenGL");
Type delegates_class = asm.GetType("OpenTK.OpenGL.Delegates");
Type imports_class = asm.GetType("OpenTK.OpenGL.Imports");
FieldInfo f = delegates_class.GetField(name);
if (f == null)
return false;
f.SetValue(null, GetDelegateForMethod(f.Name, f.FieldType));
return true;
}
#endregion
}
}

View file

@ -0,0 +1,68 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
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)
{
return Marshal.PtrToStringAnsi(GetString_(name));
}
public static string ErrorString(int name)
{
return Marshal.PtrToStringAnsi(ErrorString_(name));
}
#endregion
}
}

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

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

View file

@ -0,0 +1,4 @@
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
</configuration>

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")]
[assembly: AssemblyDescription("Provides bindings to the OpenGL functions.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenGL")]
[assembly: AssemblyCopyright("Copyright © 2006 Stefanos Apostolopoulos")]
[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.6.2")]
[assembly: AssemblyFileVersion("0.3.6.2")]

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

@ -0,0 +1,248 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
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 IntPtr GetProcAddress(string funcname);
#endregion
}
}

View file

@ -0,0 +1,35 @@
# Normal types.
GLsizei, Int32
GLsizeiptr, IntPtr
GLintptr, IntPtr
GLenum, Int32
GLboolean, Boolean #Int32 #Boolean
GLbitfield, Int32 #UInt32
# GLvoid*, IntPtr
GLvoid, Object
GLchar, Char
GLbyte, Byte #SByte
GLubyte, Byte
GLshort, Int16
GLushort, Int16 #UInt16
GLint, Int32
GLuint, Int32 #UInt32
GLfloat, Single
GLclampf, Single
GLdouble, Double
GLclampd, Double
GLstring, String
# ARB and NV types.
GLsizeiptrARB, IntPtr
GLintptrARB, IntPtr
GLhandleARB, Int32 #UInt32
GLhalfARB, Int16 #UInt16
GLhalfNV, Int16 #UInt16
GLcharARB, Char
# 64 bit types (introduced in 2.1)
GLint64EXT, Int64
GLuint64EXT, Int64
GLint64, Int64
GLuint64, Int64

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,251 @@
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: This software was created using the
# OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
# not been independently verified as being compliant with the OpenGL(R)
# version 1.2.1 Specification.
###############################################################################
Extensions define:
EXT_object_space_tess = 1
EXT_nurbs_tessellator = 1
###############################################################################
Boolean enum:
FALSE = 0
TRUE = 1
###############################################################################
Version enum:
VERSION_1_1 = 1
VERSION_1_2 = 1
VERSION_1_3 = 1
###############################################################################
StringName enum:
VERSION = 100800
EXTENSIONS = 100801
###############################################################################
ErrorCode enum:
INVALID_ENUM = 100900
INVALID_VALUE = 100901
OUT_OF_MEMORY = 100902
########INCOMPATIBLE_GL_VERSION = 100903
INVALID_OPERATION = 100904
###############################################################################
Filter4TypeSGIS enum:
LAGRANGIAN_SGI = 100300
MITCHELL_NETRAVALI_SGI = 100301
###############################################################################
NurbsDisplay enum:
use QuadricDrawStyle FILL
OUTLINE_POLYGON = 100240
OUTLINE_PATCH = 100241
NurbsCallback enum:
NURBS_ERROR = 100103
ERROR = 100103
NURBS_BEGIN = 100164
NURBS_BEGIN_EXT = 100164
NURBS_VERTEX = 100165
NURBS_VERTEX_EXT = 100165
NURBS_NORMAL = 100166
NURBS_NORMAL_EXT = 100166
NURBS_COLOR = 100167
NURBS_COLOR_EXT = 100167
NURBS_TEXTURE_COORD = 100168
NURBS_TEXTURE_COORD_EXT = 100168
NURBS_END = 100169
NURBS_END_EXT = 100169
NURBS_BEGIN_DATA = 100170
NURBS_BEGIN_DATA_EXT = 100170
NURBS_VERTEX_DATA = 100171
NURBS_VERTEX_DATA_EXT = 100171
NURBS_NORMAL_DATA = 100172
NURBS_NORMAL_DATA_EXT = 100172
NURBS_COLOR_DATA = 100173
NURBS_COLOR_DATA_EXT = 100173
NURBS_TEXTURE_COORD_DATA = 100174
NURBS_TEXTURE_COORD_DATA_EXT = 100174
NURBS_END_DATA = 100175
NURBS_END_DATA_EXT = 100175
NurbsError enum:
NURBS_ERROR1 = 100251
NURBS_ERROR2 = 100252
NURBS_ERROR3 = 100253
NURBS_ERROR4 = 100254
NURBS_ERROR5 = 100255
NURBS_ERROR6 = 100256
NURBS_ERROR7 = 100257
NURBS_ERROR8 = 100258
NURBS_ERROR9 = 100259
NURBS_ERROR10 = 100260
NURBS_ERROR11 = 100261
NURBS_ERROR12 = 100262
NURBS_ERROR13 = 100263
NURBS_ERROR14 = 100264
NURBS_ERROR15 = 100265
NURBS_ERROR16 = 100266
NURBS_ERROR17 = 100267
NURBS_ERROR18 = 100268
NURBS_ERROR19 = 100269
NURBS_ERROR20 = 100270
NURBS_ERROR21 = 100271
NURBS_ERROR22 = 100272
NURBS_ERROR23 = 100273
NURBS_ERROR24 = 100274
NURBS_ERROR25 = 100275
NURBS_ERROR26 = 100276
NURBS_ERROR27 = 100277
NURBS_ERROR28 = 100278
NURBS_ERROR29 = 100279
NURBS_ERROR30 = 100280
NURBS_ERROR31 = 100281
NURBS_ERROR32 = 100282
NURBS_ERROR33 = 100283
NURBS_ERROR34 = 100284
NURBS_ERROR35 = 100285
NURBS_ERROR36 = 100286
NURBS_ERROR37 = 100287
NurbsProperty enum:
AUTO_LOAD_MATRIX = 100200
CULLING = 100201
SAMPLING_TOLERANCE = 100203
DISPLAY_MODE = 100204
PARAMETRIC_TOLERANCE = 100202
SAMPLING_METHOD = 100205
U_STEP = 100206
V_STEP = 100207
NURBS_MODE = 100160
NURBS_MODE_EXT = 100160
NURBS_TESSELLATOR = 100161
NURBS_TESSELLATOR_EXT = 100161
NURBS_RENDERER = 100162
NURBS_RENDERER_EXT = 100162
NurbsSampling enum:
OBJECT_PARAMETRIC_ERROR = 100208
OBJECT_PARAMETRIC_ERROR_EXT = 100208
OBJECT_PATH_LENGTH = 100209
OBJECT_PATH_LENGTH_EXT = 100209
PATH_LENGTH = 100215
PARAMETRIC_ERROR = 100216
DOMAIN_DISTANCE = 100217
NurbsTrim enum:
MAP1_TRIM_2 = 100210
MAP1_TRIM_3 = 100211
###############################################################################
QuadricDrawStyle enum:
POINT = 100010
LINE = 100011
FILL = 100012
SILHOUETTE = 100013
QuadricCallback enum:
use NurbsCallback ERROR
QuadricNormal enum:
SMOOTH = 100000
FLAT = 100001
NONE = 100002
QuadricOrientation enum:
OUTSIDE = 100020
INSIDE = 100021
###############################################################################
TessCallback enum:
TESS_BEGIN = 100100
BEGIN = 100100
TESS_VERTEX = 100101
VERTEX = 100101
TESS_END = 100102
END = 100102
TESS_ERROR = 100103
ERROR = 100103
TESS_EDGE_FLAG = 100104
EDGE_FLAG = 100104
TESS_COMBINE = 100105
TESS_BEGIN_DATA = 100106
TESS_VERTEX_DATA = 100107
TESS_END_DATA = 100108
TESS_ERROR_DATA = 100109
TESS_EDGE_FLAG_DATA = 100110
TESS_COMBINE_DATA = 100111
TessContour enum:
CW = 100120
CCW = 100121
INTERIOR = 100122
EXTERIOR = 100123
UNKNOWN = 100124
TessProperty enum:
TESS_WINDING_RULE = 100140
TESS_BOUNDARY_ONLY = 100141
TESS_TOLERANCE = 100142
TessError enum:
TESS_ERROR1 = 100151
TESS_ERROR2 = 100152
TESS_ERROR3 = 100153
TESS_ERROR4 = 100154
TESS_ERROR5 = 100155
TESS_ERROR6 = 100156
TESS_ERROR7 = 100157
TESS_ERROR8 = 100158
TESS_MISSING_BEGIN_POLYGON = 100151
TESS_MISSING_BEGIN_CONTOUR = 100152
TESS_MISSING_END_POLYGON = 100153
TESS_MISSING_END_CONTOUR = 100154
TESS_COORD_TOO_LARGE = 100155
TESS_NEED_COMBINE_CALLBACK = 100156
TessWinding enum:
TESS_WINDING_ODD = 100130
TESS_WINDING_NONZERO = 100131
TESS_WINDING_POSITIVE = 100132
TESS_WINDING_NEGATIVE = 100133
TESS_WINDING_ABS_GEQ_TWO = 100134
###############################################################################

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,291 @@
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,*,*
FramebufferAttachment,*,*, GLenum,*,*
FramebufferTarget,*,*, 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,*,*
ProgramParameterPName,*,*, GLenum,*,*
QuadricCallback,*,*, GLenum,*,*
QuadricDrawStyle,*,*, GLenum,*,*
QuadricNormal,*,*, GLenum,*,*
QuadricObj,*,*, GLUquadric*,*,*
QuadricOrientation,*,*, GLenum,*,*
ReadBufferMode,*,*, GLenum,*,*
RenderbufferTarget,*,*, 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,*,*
VertexAttribEnum,*,*, GLenum,*,*
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,*,*
ProgramTarget,*,*, 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
BufferOffset,*,*, GLintptr,*,*
BufferSize,*,*, GLsizeiptr,*,*
BufferAccessARB,*,*, GLenum,*,*
BufferOffsetARB,*,*, GLintptrARB,*,*
BufferPNameARB,*,*, GLenum,*,*
BufferPointerNameARB,*,*, GLenum,*,*
BufferSizeARB,*,*, GLsizeiptrARB,*,*
BufferTargetARB,*,*, GLenum,*,*
BufferUsageARB,*,*, 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*,*,*
# EXT_timer_query
Int64EXT,*,*, GLint64EXT,*,*
UInt64EXT,*,*, GLuint64EXT,*,*

View file

@ -0,0 +1,438 @@
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: This software was created using the
# OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
# not been independently verified as being compliant with the OpenGL(R)
# version 1.2.1 Specification.
param: retval retained
version: 1.0
BeginCurve(nurb)
return void
param nurb NurbsObj in value
BeginPolygon(tess)
return void
param tess TesselatorObj in value
BeginSurface(nurb)
return void
param nurb NurbsObj in value
BeginTrim(nurb)
return void
param nurb NurbsObj in value
Build1DMipmapLevels(target, internalFormat, width, format, type, level, base, max, data);
return Int32
param target TextureTarget in value
param internalFormat Int32 in value
param width SizeI in value
param format PixelFormat in value
param type PixelType in value
param level Int32 in value
param base Int32 in value
param max Int32 in value
param data void in reference
Build1DMipmaps(target, internalFormat, width, format, type, data);
return Int32
param target TextureTarget in value
param internalFormat Int32 in value
param width SizeI in value
param format PixelFormat in value
param type PixelType in value
param data void in reference
Build2DMipmapLevels(target, internalFormat, width, height, format, type, level, base, max, data);
return Int32
param target TextureTarget in value
param internalFormat Int32 in value
param width SizeI in value
param height SizeI in value
param format PixelFormat in value
param type PixelType in value
param level Int32 in value
param base Int32 in value
param max Int32 in value
param data void in reference
Build2DMipmaps(target, internalFormat, width, height, format, type, data);
return Int32
param target TextureTarget in value
param internalFormat Int32 in value
param width SizeI in value
param height SizeI in value
param format PixelFormat in value
param type PixelType in value
param data void in reference
Build3DMipmapLevels(target, internalFormat, width, height, depth, format, type, level, base, max, data);
return Int32
param target TextureTarget in value
param internalFormat Int32 in value
param width SizeI in value
param height SizeI in value
param depth SizeI in value
param format PixelFormat in value
param type PixelType in value
param level Int32 in value
param base Int32 in value
param max Int32 in value
param data void in reference
Build3DMipmaps(target, internalFormat, width, height, depth, format, type, data);
return Int32
param target TextureTarget in value
param internalFormat Int32 in value
param width SizeI in value
param height SizeI in value
param depth SizeI in value
param format PixelFormat in value
param type PixelType in value
param data void in reference
CheckExtension(extName, extString)
return Boolean
param extName UInt8 in array [COMPSIZE()]
param extString UInt8 in array [COMPSIZE()]
Cylinder(quad, base, top, height, slices, stacks);
return void
param quad QuadricObj in value
param base Float64 in value
param top Float64 in value
param height Float64 in value
param slices Int32 in value
param stacks Int32 in value
DeleteNurbsRenderer(nurb)
return void
param nurb NurbsObj in value
DeleteQuadric(quad)
return void
param quad QuadricObj in value
DeleteTess(tess)
return void
param tess TesselatorObj in value
Disk(quad, inner, outer, slices, loops)
return void
param quad QuadricObj in value
param inner Float64 in value
param outer Float64 in value
param slices Int32 in value
param loops Int32 in value
EndCurve(nurb)
return void
param nurb NurbsObj in value
EndPolygon(tess)
return void
param tess TesselatorObj in value
EndSurface(nurb)
return void
param nurb NurbsObj in value
EndTrim(nurb)
return void
param nurb NurbsObj in value
ErrorString(error)
return String
param error ErrorCode in value
GetString(name)
return String
param name StringName in value
GetNurbsProperty(nurb, property, data)
return void
param nurb NurbsObj in value
param property NurbsProperty in value
param data Float32Pointer out value
GetTessProperty(tess, which, data)
return void
param tess TesselatorObj in value
param which TessProperty in value
param data Float64Pointer out value
LoadSamplingMatrices(nurb, model, perspective, view)
return void
param nurb NurbsObj in value
param model Float32 in array [16]
param perspective Float32 in array [16]
param view Int32 in array [4]
LookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ)
return void
param eyeX Float64 in value
param eyeY Float64 in value
param eyeZ Float64 in value
param centerX Float64 in value
param centerY Float64 in value
param centerZ Float64 in value
param upX Float64 in value
param upY Float64 in value
param upZ Float64 in value
NewNurbsRenderer()
return NurbsObj
NewQuadric()
return QuadricObj
NewTess()
return TesselatorObj
NextContour(tess, type)
return void
param tess TesselatorObj in value
param type TessContour in value
NurbsCallback(nurb, which, CallBackFunc)
return void
param nurb NurbsObj in value
param which NurbsCallback in value
param CallBackFunc FunctionPointer in value
NurbsCallbackData(nurb, userData)
return void
param nurb NurbsObj in value
param userData VoidPointer in value
NurbsCallbackDataEXT(nurb, userData)
return void
param nurb NurbsObj in value
param userData VoidPointer in value
NurbsCurve(nurb, knotCount, knots, stride, control, order, type)
return void
param nurb NurbsObj in value
param knotCount Int32 in value
param knots Float32 out reference
param stride Int32 in value
param control Float32 out reference
param order Int32 in value
param type MapTarget in value
NurbsProperty(nurb, property, value)
return void
param nurb NurbsObj in value
param property NurbsProperty in value
param value Float32 in value
NurbsSurface(nurb, sKnotCount, sKnots, tKnotCount, tKnots, sStride, tStride, control, sOrder, tOrder, type)
return void
param nurb NurbsObj in value
param sKnotCount Int32 in value
param sKnots Float32Pointer in value
param tKnotCount Int32 in value
param tKnots Float32Pointer in value
param sStride Int32 in value
param tStride Int32 in value
param control Float32Pointer in value
param sOrder Int32 in value
param tOrder Int32 in value
param type MapTarget in value
Ortho2D(left, right, bottom, top)
return void
param left Float64 in value
param right Float64 in value
param bottom Float64 in value
param top Float64 in value
PartialDisk(quad, inner, outer, slices, loops, start, sweep)
return void
param quad QuadricObj in value
param inner Float64 in value
param outer Float64 in value
param slices Int32 in value
param loops Int32 in value
param start Float64 in value
param sweep Float64 in value
Perspective(fovy, aspect, zNear, zFar)
return void
param fovy Float64 in value
param aspect Float64 in value
param zNear Float64 in value
param zFar Float64 in value
PickMatrix(x, y, delX, delY, viewport)
return void
param x Float64 in value
param y Float64 in value
param delX Float64 in value
param delY Float64 in value
param viewport Int32 out array [4]
Project(objX, objY, objZ, model, proj, view, winX, winY, winZ)
return Int32
param objX Float64 in value
param objY Float64 in value
param objZ Float64 in value
param model Float64 in array [16]
param proj Float64 in array [16]
param view Int32 in array [4]
param winX Float64Pointer in value
param winY Float64Pointer in value
param winZ Float64Pointer in value
PwlCurve(nurb, count, data, stride, type)
return void
param nurb NurbsObj in value
param count Int32 in value
param data Float32Pointer in value
param stride Int32 in value
param type NurbsTrim in value
QuadricCallback(quad, which, CallBackFunc)
return void
param quad QuadricObj in value
param which QuadricCallback in value
param CallBackFunc FunctionPointer in value
QuadricDrawStyle(quad, draw)
return void
param quad QuadricObj in value
param draw QuadricDrawStyle in value
QuadricNormals(quad, normal)
return void
param quad QuadricObj in value
param normal QuadricNormal in value
QuadricOrientation(quad, orientation)
return void
param quad QuadricObj in value
param orientation QuadricOrientation in value
QuadricTexture(quad, texture)
return void
param quad QuadricObj in value
param texture Boolean in value
ScaleImage(format, wIn, hIn, typeIn, dataIn, wOut, hOut, typeOut, dataOut)
return Int32
param format PixelFormat in value
param wIn SizeI in value
param hIn SizeI in value
param typeIn PixelType in value
param dataIn void in reference
param wOut SizeI in value
param hOut SizeI in value
param typeOut PixelType in value
param dataOut VoidPointer out value
Sphere(quad, radius, slices, stacks)
return void
param quad QuadricObj in value
param radius Float64 in value
param slices Int32 in value
param stacks Int32 in value
TessBeginContour(tess)
return void
param tess TesselatorObj in value
TessBeginPolygon(tess, data)
return void
param tess TesselatorObj in value
param data VoidPointer in value
TessCallback(tess, which, CallBackFunc)
return void
param tess TesselatorObj in value
param which TessCallback in value
param CallBackFunc FunctionPointer in value
TessEndContour(tess)
return void
param tess TesselatorObj in value
TessEndPolygon(tess)
return void
param tess TesselatorObj in value
TessNormal(tess, valueX, valueY, valueZ)
return void
param tess TesselatorObj in value
param valueX Float64 in value
param valueY Float64 in value
param valueZ Float64 in value
TessProperty(tess, which, data)
return void
param tess TesselatorObj in value
param which TessProperty in value
param data Float64 in value
TessVertex(tess, location, data)
return void
param tess TesselatorObj in value
param location Float64 out array [3]
param data VoidPointer in value
TexFilterFuncSGI(target, filtertype, parms, n, weights)
return Int32 out value
param target TextureTarget in value
param filtertype Filter4TypeSGIS in value
param parms Float32 in array [2]
param n Int32 in value
param weights Float32Pointer out value
UnProject(winX, winY, winZ, model, proj, view, objX, objY, objZ)
return Int32
param winX Float64 in value
param winY Float64 in value
param winZ Float64 in value
param model Float64 in array [16]
param proj Float64 in array [16]
param view Int32 in array [4]
param objX Float64Pointer in value
param objY Float64Pointer in value
param objZ Float64Pointer in value
UnProject4(winX, winY, winZ, clipW, model, proj, view, near, far, objX, objY, objZ, objW)
return Int32
param winX Float64 in value
param winY Float64 in value
param winZ Float64 in value
param clipW Float64 in value
param model Float64 in array [16]
param proj Float64 in array [16]
param view Int32 in array [4]
param near Float64 in value
param far Float64 in value
param objX Float64Pointer in value
param objY Float64Pointer in value
param objZ Float64Pointer in value
param objW Float64Pointer in value

View file

@ -0,0 +1,621 @@
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2005 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: This software was created using the
# OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
# not been independently verified as being compliant with the OpenGL(R)
# version 1.2.1 Specification.
required-props:
param: retval retained
dlflags: notlistable handcode nop
glxflags: client-handcode server-handcode
glxvendorglx: *
vectorequiv: *
category: pixel-rw bgn-end display-list drawing drawing-control feedback framebuf misc modeling pixel-op pixel-rw state-req xform glx glxopcode
glxopcode: *
###############################################################################
#
# GLX1.0 commands
#
###############################################################################
Render()
return void
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 1
RenderLarge()
return void
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 2
CreateContext(gc_id, screen, visual, share_list)
return void
param gc_id Int32 in value
param screen Int32 in value
param visual Int32 in value
param share_list Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxopcode 3
DestroyContext(context)
return void
param context Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxopcode 4
MakeCurrent(drawable, context)
return void
param drawable Int32 in value
param context Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxopcode 5
IsDirect(dpy, context)
return void
param dpy Int32 in value
param context Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxopcode 6
QueryVersion(major, minor)
return void
param major Int32 out reference
param minor Int32 out reference
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 7
WaitGL(context)
return void
param context Int32 in value
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 8
WaitX()
return void
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 9
CopyContext(source, dest, mask)
return void
param source Int32 in value
param dest Int32 in value
param mask Int32 in value
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 10
SwapBuffers(drawable)
return void
param drawable Int32 in value
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 11
UseXFont(font, first, count, list_base)
return void
param font Int32 in value
param first Int32 in value
param count Int32 in value
param list_base Int32 in value
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 12
CreateGLXPixmap(visual, pixmap, glxpixmap)
return void
param visual Int32 in value
param pixmap Int32 in value
param glxpixmap Int32 in value
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 13
GetVisualConfigs()
return void
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 14
DestroyGLXPixmap(pixmap)
return void
param pixmap Int32 in value
glxflags client-handcode
category glx
dlflags notlistable
glxopcode 15
VendorPrivate()
return void
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxopcode 16
VendorPrivateWithReply()
return void
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxopcode 17
###############################################################################
#
# GLX1.1 commands
#
###############################################################################
QueryExtensionsString(screen)
return void
param screen Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxopcode 18
QueryServerString(screen, name)
return void
param screen Int32 in value
param name Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxopcode 19
ClientInfo()
return void
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxopcode 20
###############################################################################
#
# GLX1.3 commands
#
###############################################################################
GetFBConfigs()
return void
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxopcode 21
CreatePixmap(config, pixmap, glxpixmap)
return void
param config Int32 in value
param pixmap Int32 in value
param glxpixmap Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 22
DestroyPixmap(glxpixmap)
return void
param glxpixmap Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 23
CreateNewContext(config, render_type, share_list, direct)
return void
param config Int32 in value
param render_type Int32 in value
param share_list Int32 in value
param direct Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 24
QueryContext()
return void
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 25
MakeContextCurrent(drawable, readdrawable, context)
return void
param drawable Int32 in value
param readdrawable Int32 in value
param context Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 26
CreatePbuffer(config, pbuffer)
return void
param config Int32 in value
param pbuffer Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 27
DestroyPbuffer(pbuffer)
return void
param pbuffer Int32 in value
dlflags notlistable
glxflags client-handcode
category glx
glxopcode 28
GetDrawableAttributes(drawable)
return void
param drawable Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 29
ChangeDrawableAttributes(drawable)
return void
param drawable Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 30
CreateWindow(config, window, glxwindow)
return void
param config Int32 in value
param window Int32 in value
param glxwindow Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 31
DestroyWindow(glxwindow)
return void
param glxwindow Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxopcode 32
###############################################################################
#
# IRIX5.3 extension commands
#
###############################################################################
###############################################################################
#
# SGI_swap_control extension commands
#
###############################################################################
SwapIntervalSGI()
return void
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65536
###############################################################################
#
# IRIX5.3-PATCH154 extension commands
#
###############################################################################
###############################################################################
#
# SGI_make_current_read extension commands
#
###############################################################################
MakeCurrentReadSGI(drawable, readdrawable, context)
return void
param drawable Int32 in value
param readdrawable Int32 in value
param context Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65537
###############################################################################
#
# SGIX_video_source extension commands
#
###############################################################################
CreateGLXVideoSourceSGIX(dpy, screen, server, path, class, node)
return void
param dpy Int32 in value
param screen Int32 in value
param server Int32 in value
param path Int32 in value
param class Int32 in value
param node Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65538
DestroyGLXVideoSourceSGIX(dpy, glxvideosource)
return void
param dpy Int32 in value
param glxvideosource Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65539
###############################################################################
#
# IRIX6.2 extension commands
#
###############################################################################
###############################################################################
#
# EXT_import_context extension commands
#
###############################################################################
QueryContextInfoEXT()
return void
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxvendorglx 1024
###############################################################################
#
# SGIX_fbconfig extension commands
#
###############################################################################
GetFBConfigsSGIX()
return void
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxvendorglx 65540
CreateContextWithConfigSGIX(gc_id, screen, config, share_list)
return void
param gc_id Int32 in value
param screen Int32 in value
param config Int32 in value
param share_list Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65541
CreateGLXPixmapWithConfigSGIX(config, pixmap, glxpixmap)
return void
param config Int32 in value
param pixmap Int32 in value
param glxpixmap Int32 in value
category glx
dlflags notlistable
glxflags client-handcode server-handcode
glxvendorglx 65542
###############################################################################
#
# SGIX_pbuffer extension commands
#
###############################################################################
CreateGLXPbufferSGIX(config, pbuffer)
return void
param config Int32 in value
param pbuffer Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxvendorglx 65543
DestroyGLXPbufferSGIX(pbuffer)
return void
param pbuffer Int32 in value
dlflags notlistable
glxflags client-handcode
category glx
glxvendorglx 65544
ChangeDrawableAttributesSGIX(drawable)
return void
param drawable Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxvendorglx 65545
GetDrawableAttributesSGIX(drawable)
return void
param drawable Int32 in value
dlflags notlistable
glxflags client-handcode server-handcode
category glx
glxvendorglx 65546
###############################################################################
#
# SGIX_swap_group extension commands
#
###############################################################################
JoinSwapGroupSGIX(window,group)
return void
param window Int32 in value
param group Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65547
###############################################################################
#
# SGIX_swap_barrier extension commands
#
###############################################################################
BindSwapBarrierSGIX(window,barrier)
return void
param window Int32 in value
param barrier Int32 in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65548
QueryMaxSwapBarriersSGIX()
return void
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65549
###############################################################################
#
# SGIX_hyperpipe extension commands
#
###############################################################################
QueryHyperpipeNetworkSGIX(dpy, npipes)
return GLXHyperpipeNetworkPointer
param dpy Display out reference
param npipes int out reference
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65550
HyperpipeConfigSGIX(dpy, networkId, npipes, cfg, hpId)
return int
param dpy Display out reference
param networkId int in value
param npipes int in value
param cfg GLXHyperpipeConfig in array[npipes]
param hpId int out reference
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65552
QueryHyperpipeConfigSGIX(dpy, hpId, npipes)
return GLXHyperpipeConfigPointer
param dpy Display out reference
param hpId int in value
param npipes int out reference
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65551
DestroyHyperpipeConfigSGIX(dpy, hpId)
return int
param dpy Display out reference
param hpId int in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx 65553
BindHyperpipeSGIX(dpy, hpId)
return int
param dpy Display out reference
param hpId int in value
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx ???
QueryHyperpipeBestAttribSGIX(dpy, timeSlice, attrib, size, attribList, returnAttribList)
return int
param dpy Display out reference
param timeSlice int in value
param attrib int in value
param size int in value
param attribList Void in array[size]
param returnAttribList Void out array[size]
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx ???
HyperpipeAttribSGIX(dpy, timeSlice, attrib, size, attribList)
return int
param dpy Display out reference
param timeSlice int in value
param attrib int in value
param size int in value
param attribList void in array[size]
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx ???
QueryHyperpipeAttribSGIX(dpy, timeSlice, attrib, size, returnAttribList)
return int
param dpy Display out reference
param timeSlice int in value
param attrib int in value
param size int in value
param returnAttribList void in array[size]
glxflags client-handcode server-handcode
category glx
dlflags notlistable
glxvendorglx ???

View file

@ -0,0 +1,43 @@
Bool,*,*, Bool,*,*
Colormap,*,*, Colormap,*,*
DMbuffer,*,*, DMbuffer,*,*
DMparams,*,*, DMparams,*,*
Display,*,*, Display,*,*
DisplayPointer,*,*, Display *,*,*
FunctionPointer,*,*, __GLXextFuncPtr,*,*
GLXContext,*,*, GLXContext,*,*
constGLXContext,*,*, const GLXContext,*,*
GLXContextID,*,*, GLXContextID,*,*
GLXDrawable,*,*, GLXDrawable,*,*
GLXFBConfig,*,*, GLXFBConfig,*,*
GLXFBConfigPointer,*,*, GLXFBConfig *,*,*
GLXFBConfigSGIX,*,*, GLXFBConfigSGIX,*,*
GLXFBConfigSGIXPointer,*,*, GLXFBConfigSGIX *,*,*
GLXHyperpipeNetworkSGIXPointer,*,*, GLXHyperpipeNetworkSGIX *,*,*
GLXHyperpipeConfigSGIX,*,*, GLXHyperpipeConfigSGIX,*,*
GLXHyperpipeConfigSGIXPointer,*,*, GLXHyperpipeConfigSGIX *,*,*
GLXPbuffer,*,*, GLXPbuffer,*,*
GLXPbufferSGIX,*,*, GLXPbufferSGIX,*,*
GLXPixmap,*,*, GLXPixmap,*,*
GLXVideoSourceSGIX,*,*, GLXVideoSourceSGIX,*,*
GLXWindow,*,*, GLXWindow,*,*
GLenum,*,*, GLenum,*,*
GLfunction,*,*, GLfunction,*,*
GLubyte,*,*, GLubyte,*,*
Pixmap,*,*, Pixmap,*,*
Status,*,*, Status,*,*
Uint,*,*, unsigned int,*,*
VLNode,*,*, VLNode,*,*
VLPath,*,*, VLPath,*,*
VLServer,*,*, VLServer,*,*
Window,*,*, Window,*,*
XVisualInfo,*,*, XVisualInfo,*,*
XVisualInfoPointer,*,*, XVisualInfo *,*,*
float,*,*, float,*,*
int,*,*, int,*,*
uint,*,*, unsigned int,*,*
int32_t,*,*, int32_t,*,*
int64_t,*,*, int64_t,*,*
long,*,*, long,*,*
ulong,*,*, unsigned long,*,*
void,*,*, void,*,*

View file

@ -0,0 +1,324 @@
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2005 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: This software was created using the
# OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
# not been independently verified as being compliant with the OpenGL(R)
# version 1.2.1 Specification.
#
# $Date: 2005/01/20 08:44:12 $ $Revision: 1.6 $
# $Header: /oss/CVS/cvs/projects/ogl-sample/main/doc/registry/specs/glxenum.spec,v 1.6 2005/01/20 08:44:12 ljp Exp $
# This is the GLX enumerant registry.
#
# It is an extremely important file. Do not mess with it unless
# you know what you're doing and have permission to do so.
#
# Rules for modification are the same as the rules for the OpenGL
# enumerant registry (gl.spec). Basically, don't modify this
# file unless you're SGI's ARB Representative.
Extensions define:
VERSION_1_1 = 1
VERSION_1_2 = 1
VERSION_1_3 = 1
VERSION_1_4 = 1
SGIS_multisample = 1
EXT_visual_info = 1
SGI_swap_control = 1
SGI_video_sync = 1
SGI_make_current_read = 1
SGIX_video_source = 1
EXT_visual_rating = 1
EXT_import_context = 1
SGIX_fbconfig = 1
SGIX_pbuffer = 1
SGI_cushion = 1
SGIX_video_resize = 1
SGIX_dmbuffer = 1
SGIX_swap_group = 1
SGIX_swap_barrier = 1
SGIS_blended_overlay = 1
SGIS_shared_multisample = 1
SUN_get_transparent_index = 1
3DFX_multisample = 1
MESA_copy_sub_buffer = 1
MESA_pixmap_colormap = 1
MESA_release_buffers = 1
MESA_set_3dfx_mode = 1
SGIX_visual_select_group = 1
SGIX_hyperpipe = 1
GLXStringName enum:
VENDOR = 0x1
VERSION = 0x2
EXTENSIONS = 0x3
GLXErrorCode enum:
BAD_SCREEN = 1
BAD_ATTRIBUTE = 2
NO_EXTENSION = 3
BAD_VISUAL = 4
BAD_CONTEXT = 5
BAD_VALUE = 6
BAD_ENUM = 7
BAD_HYPERPIPE_CONFIG_SGIX = 91 # SGIX_hyperpipe
BAD_HYPERPIPE_SGIX = 92 # "
GLXDrawableTypeMask enum:
WINDOW_BIT = 0x00000001 # DRAWABLE_TYPE value
PIXMAP_BIT = 0x00000002 # "
PBUFFER_BIT = 0x00000004 # "
WINDOW_BIT_SGIX = 0x00000001 # DRAWABLE_TYPE_SGIX value
PIXMAP_BIT_SGIX = 0x00000002 # "
PBUFFER_BIT_SGIX = 0x00000004 # "
GLXRenderTypeMask enum:
RGBA_BIT = 0x00000001 # RENDER_TYPE value
COLOR_INDEX_BIT = 0x00000002 # "
RGBA_BIT_SGIX = 0x00000001 # RENDER_TYPE_SGIX value
COLOR_INDEX_BIT_SGIX = 0x00000002 # "
RGBA_FLOAT_BIT_ARB = 0x00000004 # RENDER_TYPE value (from ARB_fbconfig_float)
GLXSyncType enum:
SYNC_FRAME_SGIX = 0x00000000 # ChannelRectSyncSGIX synctype
SYNC_SWAP_SGIX = 0x00000001 # "
GLXEventMask enum:
PBUFFER_CLOBBER_MASK = 0x08000000 # SelectEvent mask
BUFFER_CLOBBER_MASK_SGIX = 0x08000000 # SelectEventSGIX mask
GLXPbufferClobberMask enum:
FRONT_LEFT_BUFFER_BIT = 0x00000001 # PbufferClobberEvent mask
FRONT_RIGHT_BUFFER_BIT = 0x00000002 # "
BACK_LEFT_BUFFER_BIT = 0x00000004 # "
BACK_RIGHT_BUFFER_BIT = 0x00000008 # "
AUX_BUFFERS_BIT = 0x00000010 # "
DEPTH_BUFFER_BIT = 0x00000020 # "
STENCIL_BUFFER_BIT = 0x00000040 # "
ACCUM_BUFFER_BIT = 0x00000080 # "
FRONT_LEFT_BUFFER_BIT_SGIX = 0x00000001 # BufferClobberEventSGIX mask
FRONT_RIGHT_BUFFER_BIT_SGIX = 0x00000002 # "
BACK_LEFT_BUFFER_BIT_SGIX = 0x00000004 # "
BACK_RIGHT_BUFFER_BIT_SGIX = 0x00000008 # "
AUX_BUFFERS_BIT_SGIX = 0x00000010 # "
DEPTH_BUFFER_BIT_SGIX = 0x00000020 # "
STENCIL_BUFFER_BIT_SGIX = 0x00000040 # "
ACCUM_BUFFER_BIT_SGIX = 0x00000080 # "
SAMPLE_BUFFERS_BIT_SGIX = 0x00000100 # "
GLXHyperpipeTypeMask enum:
HYPERPIPE_DISPLAY_PIPE_SGIX = 0x00000001 # SGIX_hyperpipe
HYPERPIPE_RENDER_PIPE_SGIX = 0x00000002 # "
GLXHyperpipeAttrib enum:
PIPE_RECT_SGIX = 0x00000001 # SGIX_hyperpipe
PIPE_RECT_LIMITS_SGIX = 0x00000002 # "
HYPERPIPE_STEREO_SGIX = 0x00000003 # "
HYPERPIPE_PIXEL_AVERAGE_SGIX = 0x00000004 # "
GLXHyperpipeMisc enum:
HYPERPIPE_PIPE_NAME_LENGTH_SGIX = 80 # SGIX_hyperpipe
GLXAttribute enum:
USE_GL = 1 # Visual attributes
BUFFER_SIZE = 2 # "
LEVEL = 3 # "
RGBA = 4 # "
DOUBLEBUFFER = 5 # "
STEREO = 6 # "
AUX_BUFFERS = 7 # "
RED_SIZE = 8 # "
GREEN_SIZE = 9 # "
BLUE_SIZE = 10 # "
ALPHA_SIZE = 11 # "
DEPTH_SIZE = 12 # "
STENCIL_SIZE = 13 # "
ACCUM_RED_SIZE = 14 # "
ACCUM_GREEN_SIZE = 15 # "
ACCUM_BLUE_SIZE = 16 # "
ACCUM_ALPHA_SIZE = 17 # "
CONFIG_CAVEAT = 0x20 # "
X_VISUAL_TYPE = 0x22 # "
TRANSPARENT_TYPE = 0x23 # "
TRANSPARENT_INDEX_VALUE = 0x24 # "
TRANSPARENT_RED_VALUE = 0x25 # "
TRANSPARENT_GREEN_VALUE = 0x26 # "
TRANSPARENT_BLUE_VALUE = 0x27 # "
TRANSPARENT_ALPHA_VALUE = 0x28 # "
DONT_CARE = 0xFFFFFFFF # may be specified for ChooseFBConfig attributes
NONE = 0x8000 # several attribute values
SLOW_CONFIG = 0x8001 # CONFIG_CAVEAT attribute value
TRUE_COLOR = 0x8002 # X_VISUAL_TYPE attribute value
DIRECT_COLOR = 0x8003 # "
PSEUDO_COLOR = 0x8004 # "
STATIC_COLOR = 0x8005 # "
GRAY_SCALE = 0x8006 # "
STATIC_GRAY = 0x8007 # "
TRANSPARENT_RGB = 0x8008 # TRANSPARENT_TYPE attribute value
TRANSPARENT_INDEX = 0x8009 # "
VISUAL_ID = 0x800B # Context attribute
SCREEN = 0x800C # "
NON_CONFORMANT_CONFIG = 0x800D # CONFIG_CAVEAT attribute value
DRAWABLE_TYPE = 0x8010 # FBConfig attribute
RENDER_TYPE = 0x8011 # "
X_RENDERABLE = 0x8012 # "
FBCONFIG_ID = 0x8013 # "
RGBA_TYPE = 0x8014 # CreateNewContext render_type value
COLOR_INDEX_TYPE = 0x8015 # "
MAX_PBUFFER_WIDTH = 0x8016 # FBConfig attribute
MAX_PBUFFER_HEIGHT = 0x8017 # "
MAX_PBUFFER_PIXELS = 0x8018 # "
PRESERVED_CONTENTS = 0x801B # CreateGLXPbuffer attribute
LARGEST_PBUFFER = 0x801C # "
WIDTH = 0x801D # Drawable attribute
HEIGHT = 0x801E # "
EVENT_MASK = 0x801F # "
DAMAGED = 0x8020 # PbufferClobber event_type value
SAVED = 0x8021 # "
WINDOW = 0x8022 # PbufferClobber draw_type value
PBUFFER = 0x8023 # "
PBUFFER_HEIGHT = 0x8040 # CreateGLXPbuffer attribute
PBUFFER_WIDTH = 0x8041 # "
VISUAL_CAVEAT_EXT = 0x20 # Visual attribute
X_VISUAL_TYPE_EXT = 0x22 # "
TRANSPARENT_TYPE_EXT = 0x23 # "
TRANSPARENT_INDEX_VALUE_EXT = 0x24 # "
TRANSPARENT_RED_VALUE_EXT = 0x25 # "
TRANSPARENT_GREEN_VALUE_EXT = 0x26 # "
TRANSPARENT_BLUE_VALUE_EXT = 0x27 # "
TRANSPARENT_ALPHA_VALUE_EXT = 0x28 # "
NONE_EXT = 0x8000 # several EXT attribute values
SLOW_VISUAL_EXT = 0x8001 # VISUAL_CAVEAT_EXT attribute value
TRUE_COLOR_EXT = 0x8002 # X_VISUAL_TYPE_EXT attribute value
DIRECT_COLOR_EXT = 0x8003 # "
PSEUDO_COLOR_EXT = 0x8004 # "
STATIC_COLOR_EXT = 0x8005 # "
GRAY_SCALE_EXT = 0x8006 # "
STATIC_GRAY_EXT = 0x8007 # "
TRANSPARENT_RGB_EXT = 0x8008 # TRANSPARENT_TYPE_EXT attribute value
TRANSPARENT_INDEX_EXT = 0x8009 # "
SHARE_CONTEXT_EXT = 0x800A # QueryContextInfoEXT attribute
VISUAL_ID_EXT = 0x800B # "
SCREEN_EXT = 0x800C # "
NON_CONFORMANT_VISUAL_EXT = 0x800D # VISUAL_CAVEAT_EXT attribute value
DRAWABLE_TYPE_SGIX = 0x8010 # FBConfigSGIX attribute
RENDER_TYPE_SGIX = 0x8011 # "
X_RENDERABLE_SGIX = 0x8012 # "
FBCONFIG_ID_SGIX = 0x8013 # "
RGBA_TYPE_SGIX = 0x8014 # CreateContextWithConfigSGIX render_type value
COLOR_INDEX_TYPE_SGIX = 0x8015 # "
MAX_PBUFFER_WIDTH_SGIX = 0x8016 # FBConfigSGIX attribute
MAX_PBUFFER_HEIGHT_SGIX = 0x8017 # "
MAX_PBUFFER_PIXELS_SGIX = 0x8018 # "
OPTIMAL_PBUFFER_WIDTH_SGIX = 0x8019 # "
OPTIMAL_PBUFFER_HEIGHT_SGIX = 0x801A # "
PRESERVED_CONTENTS_SGIX = 0x801B # PbufferSGIX attribute
LARGEST_PBUFFER_SGIX = 0x801C # "
WIDTH_SGIX = 0x801D # "
HEIGHT_SGIX = 0x801E # "
EVENT_MASK_SGIX = 0x801F # "
DAMAGED_SGIX = 0x8020 # BufferClobberSGIX event_type value
SAVED_SGIX = 0x8021 # "
WINDOW_SGIX = 0x8022 # BufferClobberSGIX draw_type value
PBUFFER_SGIX = 0x8023 # "
DIGITAL_MEDIA_PBUFFER_SGIX = 0x8024 # PbufferSGIX attribute
BLENDED_RGBA_SGIS = 0x8025 # TRANSPARENT_TYPE_EXT attribute value
MULTISAMPLE_SUB_RECT_WIDTH_SGIS = 0x8026 # Visual attribute (shared_multisample)
MULTISAMPLE_SUB_RECT_HEIGHT_SGIS = 0x8027 # "
VISUAL_SELECT_GROUP_SGIX = 0x8028 # Visual attribute (visual_select_group)
HYPERPIPE_ID_SGIX = 0x8030 # Associated hyperpipe ID (SGIX_hyperpipe)
SAMPLE_BUFFERS_SGIS = 100000 # Visual attribute (SGIS_multisample)
SAMPLES_SGIS = 100001 # "
SAMPLE_BUFFERS_ARB = 100000 # Visual attribute (ARB_multisample - alias of SGIS_multisample)
SAMPLES_ARB = 100001 # "
SAMPLE_BUFFERS = 100000 # Visual attribute (GLX 1.4 core - alias of SGIS_multisample)
SAMPLES = 100001 # "
###############################################################################
# NVIDIA: 0x20A0 - 0x219F
# NV_float_buffer enum:
FLOAT_COMPONENTS_NV = 0x20B0
# NV_future_use: 0x20B1-0x20B8
# ARB_fbconfig_float enum:
RGBA_FLOAT_TYPE_ARB = 0x20B9
# NV_future_use: 0x20BA-0x219F
###############################################################################
# MESA (not in a reserved block)
# MESA_set_3dfx_mode enum:
# 3DFX_WINDOW_MODE_MESA = 0x1
# 3DFX_FULLSCREEN_MODE_MESA = 0x2
###############################################################################
# SGI_future_use: 0x8029-0x802F
# SGIX_hyperpipe adds attribute name HYPERPIPE_ID_SGIX = 0x8030
# SGI_future_use: 0x8031-0x803F
###############################################################################
# ARB_future_use: 0x8042-0x804F
###############################################################################
# 3DFX: 0x8050-0x805F
# 3DFX_multisample enum:
# SAMPLE_BUFFERS_3DFX = 0x8050
# SAMPLES_3DFX = 0x8051
###############################################################################
# OML: 0x8060-0x806F
# OML_swap_method enum:
# SWAP_METHOD_OML = 0x8060
# SWAP_EXCHANGE_OML = 0x8061
# SWAP_COPY_OML = 0x8062
# SWAP_UNDEFINED_OML = 0x8063
# OML_future_use: 0x8064-0x806F
###############################################################################
# NVIDIA: 0x8070 - 0x816F
###############################################################################
# SUN: 0x8170 - 0x817F
###############################################################################
### PLEASE REMEMBER THAT NEW ENUMERANT ALLOCATIONS MUST BE OBTAINED BY
### REQUEST TO SGI'S ARB REPRESENTATIVE (see comments at the top of this file)
###############################################################################
# Any_vendor_future_use: 0x8180-0xFFFF
#
# This range must be the last range in the file. To generate a new
# range, allocate multiples of 16 from the beginning of the
# Any_vendor_future_use range and update glxenum.spec, glxenumext.spec,
# and extensions.reserved.

View file

@ -0,0 +1,412 @@
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2005 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: This software was created using the
# OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
# not been independently verified as being compliant with the OpenGL(R)
# version 1.2.1 Specification.
#
# $Date: 2005/01/20 08:44:12 $ $Revision: 1.6 $
# $Header: /oss/CVS/cvs/projects/ogl-sample/main/doc/registry/specs/glxenumext.spec,v 1.6 2005/01/20 08:44:12 ljp Exp $
# List of GLX enumerants for glxext.h header
#
# This is NOT the master GLX enumerant registry (glxenum.spec).
#
# Unlike glxenum.spec, glxenumext.spec is
# (1) In order by extension number.
# (2) Includes only GLX extensions and GLX 1.3/1.4 core enumerants,
# since it's assumed all <glx.h> today support at least GLX 1.2.
# (3) Has no 'Extensions' section, since enums are always
# conditionally protected against multiple definition
# by glextenum.pl.
# (4) Is processed by glextenum.pl, which has evolved
# from enum.pl - should merge back into one script.
# glxext.h version number - this should be automatically updated,
# when changing either enum or template spec files.
passthru:
passthru: /* Header file version number, required by OpenGL ABI for Linux */
passthru: /* glxext.h last updated 2005/01/20 */
passthru: /* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */
passthru: #define GLX_GLXEXT_VERSION 10
###############################################################################
#
# GLX 1.3 enums
#
###############################################################################
VERSION_1_3 enum:
WINDOW_BIT = 0x00000001 # DRAWABLE_TYPE value
PIXMAP_BIT = 0x00000002 # "
PBUFFER_BIT = 0x00000004 # "
RGBA_BIT = 0x00000001 # RENDER_TYPE value
COLOR_INDEX_BIT = 0x00000002 # "
PBUFFER_CLOBBER_MASK = 0x08000000 # SelectEvent mask
FRONT_LEFT_BUFFER_BIT = 0x00000001 # PbufferClobberEvent mask
FRONT_RIGHT_BUFFER_BIT = 0x00000002 # "
BACK_LEFT_BUFFER_BIT = 0x00000004 # "
BACK_RIGHT_BUFFER_BIT = 0x00000008 # "
AUX_BUFFERS_BIT = 0x00000010 # "
DEPTH_BUFFER_BIT = 0x00000020 # "
STENCIL_BUFFER_BIT = 0x00000040 # "
ACCUM_BUFFER_BIT = 0x00000080 # "
CONFIG_CAVEAT = 0x20 # "
X_VISUAL_TYPE = 0x22 # "
TRANSPARENT_TYPE = 0x23 # "
TRANSPARENT_INDEX_VALUE = 0x24 # "
TRANSPARENT_RED_VALUE = 0x25 # "
TRANSPARENT_GREEN_VALUE = 0x26 # "
TRANSPARENT_BLUE_VALUE = 0x27 # "
TRANSPARENT_ALPHA_VALUE = 0x28 # "
DONT_CARE = 0xFFFFFFFF # may be specified for ChooseFBConfig attributes
NONE = 0x8000 # several attribute values
SLOW_CONFIG = 0x8001 # CONFIG_CAVEAT attribute value
TRUE_COLOR = 0x8002 # X_VISUAL_TYPE attribute value
DIRECT_COLOR = 0x8003 # "
PSEUDO_COLOR = 0x8004 # "
STATIC_COLOR = 0x8005 # "
GRAY_SCALE = 0x8006 # "
STATIC_GRAY = 0x8007 # "
TRANSPARENT_RGB = 0x8008 # TRANSPARENT_TYPE attribute value
TRANSPARENT_INDEX = 0x8009 # "
VISUAL_ID = 0x800B # Context attribute
SCREEN = 0x800C # "
NON_CONFORMANT_CONFIG = 0x800D # CONFIG_CAVEAT attribute value
DRAWABLE_TYPE = 0x8010 # FBConfig attribute
RENDER_TYPE = 0x8011 # "
X_RENDERABLE = 0x8012 # "
FBCONFIG_ID = 0x8013 # "
RGBA_TYPE = 0x8014 # CreateNewContext render_type value
COLOR_INDEX_TYPE = 0x8015 # "
MAX_PBUFFER_WIDTH = 0x8016 # FBConfig attribute
MAX_PBUFFER_HEIGHT = 0x8017 # "
MAX_PBUFFER_PIXELS = 0x8018 # "
PRESERVED_CONTENTS = 0x801B # CreateGLXPbuffer attribute
LARGEST_PBUFFER = 0x801C # "
WIDTH = 0x801D # Drawable attribute
HEIGHT = 0x801E # "
EVENT_MASK = 0x801F # "
DAMAGED = 0x8020 # PbufferClobber event_type value
SAVED = 0x8021 # "
WINDOW = 0x8022 # PbufferClobber draw_type value
PBUFFER = 0x8023 # "
PBUFFER_HEIGHT = 0x8040 # CreateGLXPbuffer attribute
PBUFFER_WIDTH = 0x8041 # "
###############################################################################
#
# GLX 1.4 enums
#
###############################################################################
VERSION_1_4 enum:
SAMPLE_BUFFERS = 100000
SAMPLES = 100001
###############################################################################
#
# ARB GLX extensions, in ARB extension order
#
###############################################################################
###############################################################################
# No new tokens
# ARB Extension #2
ARB_get_proc_address enum:
###############################################################################
# ARB Extension #5
ARB_multisample enum:
SAMPLE_BUFFERS_ARB = 100000
SAMPLES_ARB = 100001
###############################################################################
# ARB Extension #39
ARB_fbconfig_float enum:
RGBA_FLOAT_TYPE_ARB = 0x20B9
RGBA_FLOAT_BIT_ARB = 0x00000004
###############################################################################
#
# non-ARB GLX extensions, in registry order
#
###############################################################################
###############################################################################
# Unfortunately, the SGIS_multisample specification and the IRIX
# implementation are inconsistent; the spec assigns enums as follows.
# ARB_multisample reuses these enums with ARB suffixes, and it can't
# be changed at this point. So in the interest of supporting both
# extensions on non-IRIX platforms, the SGIS enums will be defined
# here as originally specified.
# Extension #25
SGIS_multisample enum:
SAMPLE_BUFFERS_SGIS = 100000
SAMPLES_SGIS = 100001
###############################################################################
# Extension #28
EXT_visual_info enum:
X_VISUAL_TYPE_EXT = 0x22
TRANSPARENT_TYPE_EXT = 0x23
TRANSPARENT_INDEX_VALUE_EXT = 0x24
TRANSPARENT_RED_VALUE_EXT = 0x25
TRANSPARENT_GREEN_VALUE_EXT = 0x26
TRANSPARENT_BLUE_VALUE_EXT = 0x27
TRANSPARENT_ALPHA_VALUE_EXT = 0x28
NONE_EXT = 0x8000
TRUE_COLOR_EXT = 0x8002
DIRECT_COLOR_EXT = 0x8003
PSEUDO_COLOR_EXT = 0x8004
STATIC_COLOR_EXT = 0x8005
GRAY_SCALE_EXT = 0x8006
STATIC_GRAY_EXT = 0x8007
TRANSPARENT_RGB_EXT = 0x8008
TRANSPARENT_INDEX_EXT = 0x8009
###############################################################################
# No new tokens
# Extension #40
SGI_swap_control enum:
###############################################################################
# No new tokens
# Extension #41
SGI_video_sync enum:
###############################################################################
# No new tokens
# Extension #42
SGI_make_current_read enum:
###############################################################################
# No new tokens
# Extension #43
SGIX_video_source enum:
###############################################################################
# Extension #44
EXT_visual_rating enum:
VISUAL_CAVEAT_EXT = 0x20
SLOW_VISUAL_EXT = 0x8001
NON_CONFORMANT_VISUAL_EXT = 0x800D
use EXT_visual_info NONE_EXT
###############################################################################
# Extension #47
EXT_import_context enum:
SHARE_CONTEXT_EXT = 0x800A
VISUAL_ID_EXT = 0x800B
SCREEN_EXT = 0x800C
###############################################################################
# Extension #49
SGIX_fbconfig enum:
WINDOW_BIT_SGIX = 0x00000001
PIXMAP_BIT_SGIX = 0x00000002
RGBA_BIT_SGIX = 0x00000001
COLOR_INDEX_BIT_SGIX = 0x00000002
DRAWABLE_TYPE_SGIX = 0x8010
RENDER_TYPE_SGIX = 0x8011
X_RENDERABLE_SGIX = 0x8012
FBCONFIG_ID_SGIX = 0x8013
RGBA_TYPE_SGIX = 0x8014
COLOR_INDEX_TYPE_SGIX = 0x8015
use EXT_import_context SCREEN_EXT
###############################################################################
# Extension #50
SGIX_pbuffer enum:
PBUFFER_BIT_SGIX = 0x00000004
BUFFER_CLOBBER_MASK_SGIX = 0x08000000
FRONT_LEFT_BUFFER_BIT_SGIX = 0x00000001
FRONT_RIGHT_BUFFER_BIT_SGIX = 0x00000002
BACK_LEFT_BUFFER_BIT_SGIX = 0x00000004
BACK_RIGHT_BUFFER_BIT_SGIX = 0x00000008
AUX_BUFFERS_BIT_SGIX = 0x00000010
DEPTH_BUFFER_BIT_SGIX = 0x00000020
STENCIL_BUFFER_BIT_SGIX = 0x00000040
ACCUM_BUFFER_BIT_SGIX = 0x00000080
SAMPLE_BUFFERS_BIT_SGIX = 0x00000100
MAX_PBUFFER_WIDTH_SGIX = 0x8016
MAX_PBUFFER_HEIGHT_SGIX = 0x8017
MAX_PBUFFER_PIXELS_SGIX = 0x8018
OPTIMAL_PBUFFER_WIDTH_SGIX = 0x8019
OPTIMAL_PBUFFER_HEIGHT_SGIX = 0x801A
PRESERVED_CONTENTS_SGIX = 0x801B
LARGEST_PBUFFER_SGIX = 0x801C
WIDTH_SGIX = 0x801D
HEIGHT_SGIX = 0x801E
EVENT_MASK_SGIX = 0x801F
DAMAGED_SGIX = 0x8020
SAVED_SGIX = 0x8021
WINDOW_SGIX = 0x8022
PBUFFER_SGIX = 0x8023
###############################################################################
# Extension #62
SGI_cushion enum:
# CUSHION_BUFFERS_SGI ????
###############################################################################
# Extension #83
SGIX_video_resize enum:
SYNC_FRAME_SGIX = 0x00000000
SYNC_SWAP_SGIX = 0x00000001
###############################################################################
# Extension #86
SGIX_dmbuffer enum:
DIGITAL_MEDIA_PBUFFER_SGIX = 0x8024
###############################################################################
# No new tokens
# Extension #91
SGIX_swap_group enum:
###############################################################################
# No new tokens
# Extension #92
SGIX_swap_barrier enum:
###############################################################################
# Extension #142
SGIS_blended_overlay enum:
BLENDED_RGBA_SGIS = 0x8025
###############################################################################
# Extension #143
SGIS_shared_multisample enum:
MULTISAMPLE_SUB_RECT_WIDTH_SGIS = 0x8026
MULTISAMPLE_SUB_RECT_HEIGHT_SGIS = 0x8027
###############################################################################
# No new tokens
# Extension #183
SUN_get_transparent_index enum:
###############################################################################
# Extension #207
3DFX_multisample enum:
SAMPLE_BUFFERS_3DFX = 0x8050
SAMPLES_3DFX = 0x8051
###############################################################################
# No new tokens
# Extension #215
MESA_copy_sub_buffer enum:
###############################################################################
# No new tokens
# Extension #216
MESA_pixmap_colormap enum:
###############################################################################
# No new tokens
# Extension #217
MESA_release_buffers enum:
###############################################################################
# Extension #218
MESA_set_3dfx_mode enum:
3DFX_WINDOW_MODE_MESA = 0x1
3DFX_FULLSCREEN_MODE_MESA = 0x2
###############################################################################
# Extension #234
SGIX_visual_select_group enum:
VISUAL_SELECT_GROUP_SGIX = 0x8028
###############################################################################
# Extension #237
OML_swap_method enum:
SWAP_METHOD_OML = 0x8060
SWAP_EXCHANGE_OML = 0x8061
SWAP_COPY_OML = 0x8062
SWAP_UNDEFINED_OML = 0x8063
###############################################################################
# No new tokens
# Extension #238
OML_sync_control enum:
###############################################################################
# Extension #281
NV_float_buffer enum:
FLOAT_COMPONENTS_NV = 0x20B0
###############################################################################
# Extension #307
SGIX_hyperpipe enum:
HYPERPIPE_PIPE_NAME_LENGTH_SGIX = 80
BAD_HYPERPIPE_CONFIG_SGIX = 91
BAD_HYPERPIPE_SGIX = 92
HYPERPIPE_DISPLAY_PIPE_SGIX = 0x00000001
HYPERPIPE_RENDER_PIPE_SGIX = 0x00000002
PIPE_RECT_SGIX = 0x00000001
PIPE_RECT_LIMITS_SGIX = 0x00000002
HYPERPIPE_STEREO_SGIX = 0x00000003
HYPERPIPE_PIXEL_AVERAGE_SGIX = 0x00000004
HYPERPIPE_ID_SGIX = 0x8030
###############################################################################
# No new tokens
# Extension #308
MESA_agp_offset enum:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,187 @@
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: This software was created using the
# OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
# not been independently verified as being compliant with the OpenGL(R)
# version 1.2.1 Specification.
required-props:
param: retval retained
dlflags: notlistable handcode nop
wglflags: client-handcode server-handcode non-dispatch
vectorequiv: *
category: wgl
CreateContext( hDc )
return HGLRC
param hDc HDC in value
category wgl
dlflags notlistable handcode
wglflags non-dispatch
DeleteContext( oldContext )
return BOOL
param oldContext HGLRC in value
category wgl
dlflags notlistable handcode
wglflags non-dispatch
GetCurrentContext( )
return HGLRC
category wgl
dlflags notlistable handcode
wglflags non-dispatch
MakeCurrent( hDc, newContext )
return BOOL
param hDc HDC in value
param newContext HGLRC in value
category wgl
dlflags notlistable
wglflags non-dispatch
CopyContext( hglrcSrc, hglrcDst, mask )
return BOOL
param hglrcSrc HGLRC in value
param hglrcDst HGLRC in value
param mask UINT in value
category wgl
dlflags notlistable
wglflags non-dispatch
ChoosePixelFormat( hDc, pPfd )
return int
param hDc HDC in value
param pPfd PIXELFORMATDESCRIPTOR in reference
category wgl
dlflags notlistable
wglflags non-dispatch
DescribePixelFormat( hdc, ipfd, cjpfd, ppfd )
return int
param hdc HDC in value
param ipfd int in value
param cjpfd UINT in value
param ppfd PIXELFORMATDESCRIPTOR in reference
GetCurrentDC( )
return HDC
category wgl
GetDefaultProcAddress( lpszProc)
return PROC
param lpszProc LPCSTR in value
category wgl
GetProcAddress( lpszProc)
return PROC
param lpszProc LPCSTR in value
category wgl
GetPixelFormat( hdc )
return int
param hdc HDC in value
category wgl
SetPixelFormat( hdc, ipfd, ppfd )
return BOOL
param hdc HDC in value
param ipfd int in value
param ppfd PIXELFORMATDESCRIPTOR in reference
category wgl
SwapBuffers( hdc )
return BOOL
param hdc HDC in value
category wgl
ShareLists( hrcSrvShare, hrcSrvSource)
return BOOL
param hrcSrvShare HGLRC in value
param hrcSrvSource HGLRC in value
category wgl
CreateLayerContext( hDc, level )
return HGLRC
param hDc HDC in value
param level int in value
category wgl
DescribeLayerPlane( hDc, pixelFormat, layerPlane, nBytes, plpd )
return BOOL
param hDc HDC in value
param pixelFormat int in value
param layerPlane int in value
param nBytes UINT in value
param plpd LAYERPLANEDESCRIPTOR in reference
category wgl
SetLayerPaletteEntries( hdc, iLayerPlane, iStart, cEntries, pcr )
return int
param hdc HDC in value
param iLayerPlane int in value
param iStart int in value
param cEntries int in value
param pcr COLORREF in reference
category wgl
GetLayerPaletteEntries( hdc, iLayerPlane, iStart, cEntries, pcr )
return int
param hdc HDC in value
param iLayerPlane int in value
param iStart int in value
param cEntries int in value
param pcr COLORREF in reference
category wgl
RealizeLayerPalette( hdc, iLayerPlane, bRealize )
return BOOL
param hdc HDC in value
param iLayerPlane int in value
param bRealize BOOL in value
category wgl
SwapLayerBuffers( hdc, fuFlags )
return BOOL
param hdc HDC in value
param fuFlags UINT in value
category wgl
UseFontBitmapsA( hDC, first, count, listBase )
return BOOL
param hDC HDC in value
param first DWORD in value
param count DWORD in value
param listBase DWORD in value
category wgl
dlflags notlistable
UseFontBitmapsW( hDC, first, count, listBase )
return BOOL
param hDC HDC in value
param first DWORD in value
param count DWORD in value
param listBase DWORD in value
category wgl
dlflags notlistable

View file

@ -0,0 +1,24 @@
BOOL,*,*, BOOL,*,*
DWORD,*,*, DWORD,*,*
FLOAT,*,*, FLOAT,*,*
GLboolean,*,*, GLboolean,*,*
GLfloat,*,*, GLfloat,*,*
GLsizei,*,*, GLsizei,*,*
GLuint,*,*, GLuint,*,*
GLushort,*,*, GLushort,*,*
HANDLE,*,*, HANDLE,*,*
HDC,*,*, HDC,*,*
HGLRC,*,*, HGLRC,*,*
HPBUFFERARB,*,*, HPBUFFERARB,*,*
HPBUFFEREXT,*,*, HPBUFFEREXT,*,*
INT32,*,*, INT32,*,*
INT64,*,*, INT64,*,*
LPVOID,*,*, LPVOID,*,*
String,*,*, const char *,*,*
UINT,*,*, UINT,*,*
USHORT,*,*, USHORT,*,*
VOID,*,*, VOID,*,*
VoidPointer,*,*, void*,*,*
float,*,*, float,*,*
int,*,*, int,*,*
void,*,*, *,*,*

View file

@ -0,0 +1,359 @@
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2005 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: This software was created using the
# OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
# not been independently verified as being compliant with the OpenGL(R)
# version 1.2.1 Specification.
#
# $Date: 2005/01/20 08:44:12 $ $Revision: 1.6 $
# $Header: /oss/CVS/cvs/projects/ogl-sample/main/doc/registry/specs/wglenum.spec,v 1.6 2005/01/20 08:44:12 ljp Exp $
# This is the master WGL enumerant registry.
#
# It is an extremely important file. Do not mess with it unless
# you know what you're doing and have permission to do so.
#
# Rules for modification are similar to the rules for the OpenGL
# enumerant registry (gl.spec). Basically, don't modify this file
# unless you're SGI's ARB Representative. In principle Microsoft
# owns the WGL registry, but they have for practical purposes
# ceded administration of it to SGI.
#
# Finally, note that this registry does not currently include
# any core WGL enumerants - only enumerants defined by WGL
# extensions.
###############################################################################
# Bitmasks - not consumed by the registry
WGL_ARB_buffer_region enum:
WGL_FRONT_COLOR_BUFFER_BIT_ARB = 0x00000001
WGL_BACK_COLOR_BUFFER_BIT_ARB = 0x00000002
WGL_DEPTH_BUFFER_BIT_ARB = 0x00000004
WGL_STENCIL_BUFFER_BIT_ARB = 0x00000008
###############################################################################
# SGI: 0x2000-0x203F
WGL_EXT_pixel_format enum:
WGL_NUMBER_PIXEL_FORMATS_EXT = 0x2000
WGL_DRAW_TO_WINDOW_EXT = 0x2001
WGL_DRAW_TO_BITMAP_EXT = 0x2002
WGL_ACCELERATION_EXT = 0x2003
WGL_NEED_PALETTE_EXT = 0x2004
WGL_NEED_SYSTEM_PALETTE_EXT = 0x2005
WGL_SWAP_LAYER_BUFFERS_EXT = 0x2006
WGL_SWAP_METHOD_EXT = 0x2007
WGL_NUMBER_OVERLAYS_EXT = 0x2008
WGL_NUMBER_UNDERLAYS_EXT = 0x2009
WGL_TRANSPARENT_EXT = 0x200A
WGL_TRANSPARENT_VALUE_EXT = 0x200B
WGL_SHARE_DEPTH_EXT = 0x200C
WGL_SHARE_STENCIL_EXT = 0x200D
WGL_SHARE_ACCUM_EXT = 0x200E
WGL_SUPPORT_GDI_EXT = 0x200F
WGL_SUPPORT_OPENGL_EXT = 0x2010
WGL_DOUBLE_BUFFER_EXT = 0x2011
WGL_STEREO_EXT = 0x2012
WGL_PIXEL_TYPE_EXT = 0x2013
WGL_COLOR_BITS_EXT = 0x2014
WGL_RED_BITS_EXT = 0x2015
WGL_RED_SHIFT_EXT = 0x2016
WGL_GREEN_BITS_EXT = 0x2017
WGL_GREEN_SHIFT_EXT = 0x2018
WGL_BLUE_BITS_EXT = 0x2019
WGL_BLUE_SHIFT_EXT = 0x201A
WGL_ALPHA_BITS_EXT = 0x201B
WGL_ALPHA_SHIFT_EXT = 0x201C
WGL_ACCUM_BITS_EXT = 0x201D
WGL_ACCUM_RED_BITS_EXT = 0x201E
WGL_ACCUM_GREEN_BITS_EXT = 0x201F
WGL_ACCUM_BLUE_BITS_EXT = 0x2020
WGL_ACCUM_ALPHA_BITS_EXT = 0x2021
WGL_DEPTH_BITS_EXT = 0x2022
WGL_STENCIL_BITS_EXT = 0x2023
WGL_AUX_BUFFERS_EXT = 0x2024
WGL_NO_ACCELERATION_EXT = 0x2025
WGL_GENERIC_ACCELERATION_EXT = 0x2026
WGL_FULL_ACCELERATION_EXT = 0x2027
WGL_SWAP_EXCHANGE_EXT = 0x2028
WGL_SWAP_COPY_EXT = 0x2029
WGL_SWAP_UNDEFINED_EXT = 0x202A
WGL_TYPE_RGBA_EXT = 0x202B
WGL_TYPE_COLORINDEX_EXT = 0x202C
WGL_ARB_pixel_format enum:
WGL_NUMBER_PIXEL_FORMATS_ARB = 0x2000
WGL_DRAW_TO_WINDOW_ARB = 0x2001
WGL_DRAW_TO_BITMAP_ARB = 0x2002
WGL_ACCELERATION_ARB = 0x2003
WGL_NEED_PALETTE_ARB = 0x2004
WGL_NEED_SYSTEM_PALETTE_ARB = 0x2005
WGL_SWAP_LAYER_BUFFERS_ARB = 0x2006
WGL_SWAP_METHOD_ARB = 0x2007
WGL_NUMBER_OVERLAYS_ARB = 0x2008
WGL_NUMBER_UNDERLAYS_ARB = 0x2009
WGL_TRANSPARENT_ARB = 0x200A
WGL_SHARE_DEPTH_ARB = 0x200C
WGL_SHARE_STENCIL_ARB = 0x200D
WGL_SHARE_ACCUM_ARB = 0x200E
WGL_SUPPORT_GDI_ARB = 0x200F
WGL_SUPPORT_OPENGL_ARB = 0x2010
WGL_DOUBLE_BUFFER_ARB = 0x2011
WGL_STEREO_ARB = 0x2012
WGL_PIXEL_TYPE_ARB = 0x2013
WGL_COLOR_BITS_ARB = 0x2014
WGL_RED_BITS_ARB = 0x2015
WGL_RED_SHIFT_ARB = 0x2016
WGL_GREEN_BITS_ARB = 0x2017
WGL_GREEN_SHIFT_ARB = 0x2018
WGL_BLUE_BITS_ARB = 0x2019
WGL_BLUE_SHIFT_ARB = 0x201A
WGL_ALPHA_BITS_ARB = 0x201B
WGL_ALPHA_SHIFT_ARB = 0x201C
WGL_ACCUM_BITS_ARB = 0x201D
WGL_ACCUM_RED_BITS_ARB = 0x201E
WGL_ACCUM_GREEN_BITS_ARB = 0x201F
WGL_ACCUM_BLUE_BITS_ARB = 0x2020
WGL_ACCUM_ALPHA_BITS_ARB = 0x2021
WGL_DEPTH_BITS_ARB = 0x2022
WGL_STENCIL_BITS_ARB = 0x2023
WGL_AUX_BUFFERS_ARB = 0x2024
WGL_NO_ACCELERATION_ARB = 0x2025
WGL_GENERIC_ACCELERATION_ARB = 0x2026
WGL_FULL_ACCELERATION_ARB = 0x2027
WGL_SWAP_EXCHANGE_ARB = 0x2028
WGL_SWAP_COPY_ARB = 0x2029
WGL_SWAP_UNDEFINED_ARB = 0x202A
WGL_TYPE_RGBA_ARB = 0x202B
WGL_TYPE_COLORINDEX_ARB = 0x202C
WGL_DRAW_TO_PBUFFER_ARB = 0x202D
WGL_MAX_PBUFFER_PIXELS_ARB = 0x202E
WGL_MAX_PBUFFER_WIDTH_ARB = 0x202F
WGL_MAX_PBUFFER_HEIGHT_ARB = 0x2030
WGL_PBUFFER_LARGEST_ARB = 0x2033
WGL_PBUFFER_WIDTH_ARB = 0x2034
WGL_PBUFFER_HEIGHT_ARB = 0x2035
WGL_TRANSPARENT_RED_VALUE_ARB = 0x2037
WGL_TRANSPARENT_GREEN_VALUE_ARB = 0x2038
WGL_TRANSPARENT_BLUE_VALUE_ARB = 0x2039
WGL_TRANSPARENT_ALPHA_VALUE_ARB = 0x203A
WGL_TRANSPARENT_INDEX_VALUE_ARB = 0x203B
###############################################################################
WGL_EXT_pbuffer enum:
WGL_DRAW_TO_PBUFFER_EXT = 0x202D
WGL_MAX_PBUFFER_PIXELS_EXT = 0x202E
WGL_MAX_PBUFFER_WIDTH_EXT = 0x202F
WGL_MAX_PBUFFER_HEIGHT_EXT = 0x2030
WGL_OPTIMAL_PBUFFER_WIDTH_EXT = 0x2031
WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = 0x2032
WGL_PBUFFER_LARGEST_EXT = 0x2033
WGL_PBUFFER_WIDTH_EXT = 0x2034
WGL_PBUFFER_HEIGHT_EXT = 0x2035
WGL_ARB_pbuffer enum:
WGL_DRAW_TO_PBUFFER_ARB = 0x202D
WGL_MAX_PBUFFER_PIXELS_ARB = 0x202E
WGL_MAX_PBUFFER_WIDTH_ARB = 0x202F
WGL_MAX_PBUFFER_HEIGHT_ARB = 0x2030
WGL_PBUFFER_LARGEST_ARB = 0x2033
WGL_PBUFFER_WIDTH_ARB = 0x2034
WGL_PBUFFER_HEIGHT_ARB = 0x2035
WGL_PBUFFER_LOST_ARB = 0x2036
use WGL_ARB_pixel_format WGL_TRANSPARENT_RED_VALUE_ARB
use WGL_ARB_pixel_format WGL_TRANSPARENT_GREEN_VALUE_ARB
use WGL_ARB_pixel_format WGL_TRANSPARENT_BLUE_VALUE_ARB
use WGL_ARB_pixel_format WGL_TRANSPARENT_ALPHA_VALUE_ARB
use WGL_ARB_pixel_format WGL_TRANSPARENT_INDEX_VALUE_ARB
###############################################################################
# SGI_future_use: 0x203C-0x203F
###############################################################################
# Intense3D: 0x2040-0x205F
WGL_EXT_depth_float enum:
WGL_DEPTH_FLOAT_EXT = 0x2040
###############################################################################
WGL_EXT_multisample enum:
WGL_SAMPLE_BUFFERS_EXT = 0x2041
WGL_SAMPLES_EXT = 0x2042
WGL_ARB_multisample enum:
WGL_SAMPLE_BUFFERS_ARB = 0x2041
WGL_SAMPLES_ARB = 0x2042
###############################################################################
WGL_EXT_make_current_read enum:
ERROR_INVALID_PIXEL_TYPE_EXT = 0x2043
WGL_ARB_make_current_read enum:
ERROR_INVALID_PIXEL_TYPE_ARB = 0x2043
ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = 0x2054
###############################################################################
WGL_I3D_genlock enum:
WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = 0x2044
WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D = 0x2045
WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D = 0x2046
WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D = 0x2047
WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = 0x2048
WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = 0x2049
WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = 0x204A
WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = 0x204B
WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = 0x204C
###############################################################################
# Intense3D_future_use: 0x204D
###############################################################################
WGL_I3D_gamma enum:
WGL_GAMMA_TABLE_SIZE_I3D = 0x204E
WGL_GAMMA_EXCLUDE_DESKTOP_I3D = 0x204F
###############################################################################
# Intense3D hasn't spec'ed this extension, but it's in the enum registry
WGL_I3D_digital_video_control enum:
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = 0x2050
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = 0x2051
WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = 0x2052
WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = 0x2053
###############################################################################
# WGL_ARB_make_current_read (additional; see above): 0x2054
###############################################################################
# Intense3D_future_use: 0x2055-0x205F
###############################################################################
# 3DFX: 0x2060-0x206F
WGL_3DFX_multisample enum:
WGL_SAMPLE_BUFFERS_3DFX = 0x2060
WGL_SAMPLES_3DFX = 0x2061
###############################################################################
# ARB: 0x2070-0x209F
WGL_ARB_render_texture enum:
WGL_BIND_TO_TEXTURE_RGB_ARB = 0x2070
WGL_BIND_TO_TEXTURE_RGBA_ARB = 0x2071
WGL_TEXTURE_FORMAT_ARB = 0x2072
WGL_TEXTURE_TARGET_ARB = 0x2073
WGL_MIPMAP_TEXTURE_ARB = 0x2074
WGL_TEXTURE_RGB_ARB = 0x2075
WGL_TEXTURE_RGBA_ARB = 0x2076
WGL_NO_TEXTURE_ARB = 0x2077
WGL_TEXTURE_CUBE_MAP_ARB = 0x2078
WGL_TEXTURE_1D_ARB = 0x2079
WGL_TEXTURE_2D_ARB = 0x207A
WGL_MIPMAP_LEVEL_ARB = 0x207B
WGL_CUBE_MAP_FACE_ARB = 0x207C
WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 0x207D
WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 0x207E
WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 0x207F
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 0x2080
WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 0x2081
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 0x2082
WGL_FRONT_LEFT_ARB = 0x2083
WGL_FRONT_RIGHT_ARB = 0x2084
WGL_BACK_LEFT_ARB = 0x2085
WGL_BACK_RIGHT_ARB = 0x2086
WGL_AUX0_ARB = 0x2087
WGL_AUX1_ARB = 0x2088
WGL_AUX2_ARB = 0x2089
WGL_AUX3_ARB = 0x208A
WGL_AUX4_ARB = 0x208B
WGL_AUX5_ARB = 0x208C
WGL_AUX6_ARB = 0x208D
WGL_AUX7_ARB = 0x208E
WGL_AUX8_ARB = 0x208F
WGL_AUX9_ARB = 0x2090
# ARB_future_use: 0x2091-0x209F
###############################################################################
# NVIDIA: 0x20A0-0x219F
WGL_NV_render_texture_rectangle enum:
WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 0x20A0
WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 0x20A1
WGL_TEXTURE_RECTANGLE_NV = 0x20A2
WGL_NV_render_depth_texture enum:
WGL_BIND_TO_TEXTURE_DEPTH_NV = 0x20A3
WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 0x20A4
WGL_DEPTH_TEXTURE_FORMAT_NV = 0x20A5
WGL_TEXTURE_DEPTH_COMPONENT_NV = 0x20A6
WGL_DEPTH_COMPONENT_NV = 0x20A7
# NV_future_use: 0x20A8-0x20AF
WGL_NV_float_buffer enum:
WGL_FLOAT_COMPONENTS_NV = 0x20B0
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = 0x20B1
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = 0x20B2
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = 0x20B3
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = 0x20B4
WGL_TEXTURE_FLOAT_R_NV = 0x20B5
WGL_TEXTURE_FLOAT_RG_NV = 0x20B6
WGL_TEXTURE_FLOAT_RGB_NV = 0x20B7
WGL_TEXTURE_FLOAT_RGBA_NV = 0x20B8
# NV_future_use: 0x20B9-0x219F
###############################################################################
# ATI: 0x21A0-0x21AF
WGL_ARB_pixel_format_float enum:
WGL_TYPE_RGBA_FLOAT_ARB = 0x21A0
WGL_ATI_pixel_format_float enum:
WGL_TYPE_RGBA_FLOAT_ATI = 0x21A0
# ATI_future_use: 0x21A1-0x21AF
###############################################################################
# Matrox: 0x21B0-0x21BF (tentative, RFC sent to ARB 2002/10/3)
###############################################################################
# Any_vendor_future_use: 0x21C0-0xFFFF

View file

@ -0,0 +1,382 @@
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2005 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: This software was created using the
# OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
# not been independently verified as being compliant with the OpenGL(R)
# version 1.2.1 Specification.
#
# $Date: 2005/01/20 08:44:12 $ $Revision: 1.8 $
# $Header: /oss/CVS/cvs/projects/ogl-sample/main/doc/registry/specs/wglenumext.spec,v 1.8 2005/01/20 08:44:12 ljp Exp $
# List of WGL enumerants for wglext.h header
#
# This is NOT the master WGL enumerant registry. Microsoft used
# to maintain that, but given their limited interest in OpenGL,
# SGI now maintains the registry in wglenum.spec.
#
# Unlike wglenum.spec, wglenumext.spec is
# (1) In order by extension number
# (2) Includes only WGL extensions.
# (3) Has no 'Extensions' section, since enums are always
# conditionally protected against multiple definition
# by glextenum.pl.
# (4) Is processed by glextenum.pl, which has evolved
# from enum.pl - should merge back into one script.
# wglext.h version number - this should be automatically updated,
# when changing either enum or template spec files.
passthru:
passthru: /* Header file version number */
passthru: /* wglext.h last updated 2005/01/07 */
passthru: /* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */
passthru: #define WGL_WGLEXT_VERSION 6
###############################################################################
#
# ARB WGL extensions, in ARB extension order
#
###############################################################################
###############################################################################
# ARB Extension #4
WGL_ARB_buffer_region enum:
WGL_FRONT_COLOR_BUFFER_BIT_ARB = 0x00000001
WGL_BACK_COLOR_BUFFER_BIT_ARB = 0x00000002
WGL_DEPTH_BUFFER_BIT_ARB = 0x00000004
WGL_STENCIL_BUFFER_BIT_ARB = 0x00000008
###############################################################################
# ARB Extension #5
WGL_ARB_multisample enum:
WGL_SAMPLE_BUFFERS_ARB = 0x2041
WGL_SAMPLES_ARB = 0x2042
###############################################################################
# No new tokens
# ARB Extension #8
WGL_ARB_extensions_string enum:
###############################################################################
# ARB Extension #9
WGL_ARB_pixel_format enum:
WGL_NUMBER_PIXEL_FORMATS_ARB = 0x2000
WGL_DRAW_TO_WINDOW_ARB = 0x2001
WGL_DRAW_TO_BITMAP_ARB = 0x2002
WGL_ACCELERATION_ARB = 0x2003
WGL_NEED_PALETTE_ARB = 0x2004
WGL_NEED_SYSTEM_PALETTE_ARB = 0x2005
WGL_SWAP_LAYER_BUFFERS_ARB = 0x2006
WGL_SWAP_METHOD_ARB = 0x2007
WGL_NUMBER_OVERLAYS_ARB = 0x2008
WGL_NUMBER_UNDERLAYS_ARB = 0x2009
WGL_TRANSPARENT_ARB = 0x200A
WGL_TRANSPARENT_RED_VALUE_ARB = 0x2037
WGL_TRANSPARENT_GREEN_VALUE_ARB = 0x2038
WGL_TRANSPARENT_BLUE_VALUE_ARB = 0x2039
WGL_TRANSPARENT_ALPHA_VALUE_ARB = 0x203A
WGL_TRANSPARENT_INDEX_VALUE_ARB = 0x203B
WGL_SHARE_DEPTH_ARB = 0x200C
WGL_SHARE_STENCIL_ARB = 0x200D
WGL_SHARE_ACCUM_ARB = 0x200E
WGL_SUPPORT_GDI_ARB = 0x200F
WGL_SUPPORT_OPENGL_ARB = 0x2010
WGL_DOUBLE_BUFFER_ARB = 0x2011
WGL_STEREO_ARB = 0x2012
WGL_PIXEL_TYPE_ARB = 0x2013
WGL_COLOR_BITS_ARB = 0x2014
WGL_RED_BITS_ARB = 0x2015
WGL_RED_SHIFT_ARB = 0x2016
WGL_GREEN_BITS_ARB = 0x2017
WGL_GREEN_SHIFT_ARB = 0x2018
WGL_BLUE_BITS_ARB = 0x2019
WGL_BLUE_SHIFT_ARB = 0x201A
WGL_ALPHA_BITS_ARB = 0x201B
WGL_ALPHA_SHIFT_ARB = 0x201C
WGL_ACCUM_BITS_ARB = 0x201D
WGL_ACCUM_RED_BITS_ARB = 0x201E
WGL_ACCUM_GREEN_BITS_ARB = 0x201F
WGL_ACCUM_BLUE_BITS_ARB = 0x2020
WGL_ACCUM_ALPHA_BITS_ARB = 0x2021
WGL_DEPTH_BITS_ARB = 0x2022
WGL_STENCIL_BITS_ARB = 0x2023
WGL_AUX_BUFFERS_ARB = 0x2024
WGL_NO_ACCELERATION_ARB = 0x2025
WGL_GENERIC_ACCELERATION_ARB = 0x2026
WGL_FULL_ACCELERATION_ARB = 0x2027
WGL_SWAP_EXCHANGE_ARB = 0x2028
WGL_SWAP_COPY_ARB = 0x2029
WGL_SWAP_UNDEFINED_ARB = 0x202A
WGL_TYPE_RGBA_ARB = 0x202B
WGL_TYPE_COLORINDEX_ARB = 0x202C
###############################################################################
# ARB Extension #10
WGL_ARB_make_current_read enum:
ERROR_INVALID_PIXEL_TYPE_ARB = 0x2043
ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB = 0x2054
###############################################################################
# ARB Extension #11
WGL_ARB_pbuffer enum:
WGL_DRAW_TO_PBUFFER_ARB = 0x202D
WGL_MAX_PBUFFER_PIXELS_ARB = 0x202E
WGL_MAX_PBUFFER_WIDTH_ARB = 0x202F
WGL_MAX_PBUFFER_HEIGHT_ARB = 0x2030
WGL_PBUFFER_LARGEST_ARB = 0x2033
WGL_PBUFFER_WIDTH_ARB = 0x2034
WGL_PBUFFER_HEIGHT_ARB = 0x2035
WGL_PBUFFER_LOST_ARB = 0x2036
WGL_TRANSPARENT_RED_VALUE_ARB = 0x2037
WGL_TRANSPARENT_GREEN_VALUE_ARB = 0x2038
WGL_TRANSPARENT_BLUE_VALUE_ARB = 0x2039
WGL_TRANSPARENT_ALPHA_VALUE_ARB = 0x203A
WGL_TRANSPARENT_INDEX_VALUE_ARB = 0x203B
###############################################################################
# ARB Extension #20
WGL_ARB_render_texture enum:
WGL_BIND_TO_TEXTURE_RGB_ARB = 0x2070
WGL_BIND_TO_TEXTURE_RGBA_ARB = 0x2071
WGL_TEXTURE_FORMAT_ARB = 0x2072
WGL_TEXTURE_TARGET_ARB = 0x2073
WGL_MIPMAP_TEXTURE_ARB = 0x2074
WGL_TEXTURE_RGB_ARB = 0x2075
WGL_TEXTURE_RGBA_ARB = 0x2076
WGL_NO_TEXTURE_ARB = 0x2077
WGL_TEXTURE_CUBE_MAP_ARB = 0x2078
WGL_TEXTURE_1D_ARB = 0x2079
WGL_TEXTURE_2D_ARB = 0x207A
WGL_MIPMAP_LEVEL_ARB = 0x207B
WGL_CUBE_MAP_FACE_ARB = 0x207C
WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB = 0x207D
WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB = 0x207E
WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB = 0x207F
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB = 0x2080
WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB = 0x2081
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB = 0x2082
WGL_FRONT_LEFT_ARB = 0x2083
WGL_FRONT_RIGHT_ARB = 0x2084
WGL_BACK_LEFT_ARB = 0x2085
WGL_BACK_RIGHT_ARB = 0x2086
WGL_AUX0_ARB = 0x2087
WGL_AUX1_ARB = 0x2088
WGL_AUX2_ARB = 0x2089
WGL_AUX3_ARB = 0x208A
WGL_AUX4_ARB = 0x208B
WGL_AUX5_ARB = 0x208C
WGL_AUX6_ARB = 0x208D
WGL_AUX7_ARB = 0x208E
WGL_AUX8_ARB = 0x208F
WGL_AUX9_ARB = 0x2090
###############################################################################
# ARB Extension #39
WGL_ARB_pixel_format_float enum:
WGL_TYPE_RGBA_FLOAT_ARB = 0x21A0
###############################################################################
#
# non-ARB extensions follow, in registry order
#
###############################################################################
###############################################################################
# Extension #169
WGL_EXT_make_current_read enum:
ERROR_INVALID_PIXEL_TYPE_EXT = 0x2043
###############################################################################
# Extension #170
WGL_EXT_pixel_format enum:
WGL_NUMBER_PIXEL_FORMATS_EXT = 0x2000
WGL_DRAW_TO_WINDOW_EXT = 0x2001
WGL_DRAW_TO_BITMAP_EXT = 0x2002
WGL_ACCELERATION_EXT = 0x2003
WGL_NEED_PALETTE_EXT = 0x2004
WGL_NEED_SYSTEM_PALETTE_EXT = 0x2005
WGL_SWAP_LAYER_BUFFERS_EXT = 0x2006
WGL_SWAP_METHOD_EXT = 0x2007
WGL_NUMBER_OVERLAYS_EXT = 0x2008
WGL_NUMBER_UNDERLAYS_EXT = 0x2009
WGL_TRANSPARENT_EXT = 0x200A
WGL_TRANSPARENT_VALUE_EXT = 0x200B
WGL_SHARE_DEPTH_EXT = 0x200C
WGL_SHARE_STENCIL_EXT = 0x200D
WGL_SHARE_ACCUM_EXT = 0x200E
WGL_SUPPORT_GDI_EXT = 0x200F
WGL_SUPPORT_OPENGL_EXT = 0x2010
WGL_DOUBLE_BUFFER_EXT = 0x2011
WGL_STEREO_EXT = 0x2012
WGL_PIXEL_TYPE_EXT = 0x2013
WGL_COLOR_BITS_EXT = 0x2014
WGL_RED_BITS_EXT = 0x2015
WGL_RED_SHIFT_EXT = 0x2016
WGL_GREEN_BITS_EXT = 0x2017
WGL_GREEN_SHIFT_EXT = 0x2018
WGL_BLUE_BITS_EXT = 0x2019
WGL_BLUE_SHIFT_EXT = 0x201A
WGL_ALPHA_BITS_EXT = 0x201B
WGL_ALPHA_SHIFT_EXT = 0x201C
WGL_ACCUM_BITS_EXT = 0x201D
WGL_ACCUM_RED_BITS_EXT = 0x201E
WGL_ACCUM_GREEN_BITS_EXT = 0x201F
WGL_ACCUM_BLUE_BITS_EXT = 0x2020
WGL_ACCUM_ALPHA_BITS_EXT = 0x2021
WGL_DEPTH_BITS_EXT = 0x2022
WGL_STENCIL_BITS_EXT = 0x2023
WGL_AUX_BUFFERS_EXT = 0x2024
WGL_NO_ACCELERATION_EXT = 0x2025
WGL_GENERIC_ACCELERATION_EXT = 0x2026
WGL_FULL_ACCELERATION_EXT = 0x2027
WGL_SWAP_EXCHANGE_EXT = 0x2028
WGL_SWAP_COPY_EXT = 0x2029
WGL_SWAP_UNDEFINED_EXT = 0x202A
WGL_TYPE_RGBA_EXT = 0x202B
WGL_TYPE_COLORINDEX_EXT = 0x202C
###############################################################################
# Extension #171
WGL_EXT_pbuffer enum:
WGL_DRAW_TO_PBUFFER_EXT = 0x202D
WGL_MAX_PBUFFER_PIXELS_EXT = 0x202E
WGL_MAX_PBUFFER_WIDTH_EXT = 0x202F
WGL_MAX_PBUFFER_HEIGHT_EXT = 0x2030
WGL_OPTIMAL_PBUFFER_WIDTH_EXT = 0x2031
WGL_OPTIMAL_PBUFFER_HEIGHT_EXT = 0x2032
WGL_PBUFFER_LARGEST_EXT = 0x2033
WGL_PBUFFER_WIDTH_EXT = 0x2034
WGL_PBUFFER_HEIGHT_EXT = 0x2035
###############################################################################
# Extension #177
WGL_EXT_depth_float enum:
WGL_DEPTH_FLOAT_EXT = 0x2040
###############################################################################
# Extension #207
WGL_3DFX_multisample enum:
WGL_SAMPLE_BUFFERS_3DFX = 0x2060
WGL_SAMPLES_3DFX = 0x2061
###############################################################################
# Extension #209
WGL_EXT_multisample enum:
WGL_SAMPLE_BUFFERS_EXT = 0x2041
WGL_SAMPLES_EXT = 0x2042
###############################################################################
# Extension #250
WGL_I3D_digital_video_control enum:
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D = 0x2050
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D = 0x2051
WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D = 0x2052
WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D = 0x2053
###############################################################################
# Extension #251
WGL_I3D_gamma enum:
WGL_GAMMA_TABLE_SIZE_I3D = 0x204E
WGL_GAMMA_EXCLUDE_DESKTOP_I3D = 0x204F
###############################################################################
# Extension #252
WGL_I3D_genlock enum:
WGL_GENLOCK_SOURCE_MULTIVIEW_I3D = 0x2044
WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D = 0x2045
WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D = 0x2046
WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D = 0x2047
WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D = 0x2048
WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D = 0x2049
WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D = 0x204A
WGL_GENLOCK_SOURCE_EDGE_RISING_I3D = 0x204B
WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D = 0x204C
###############################################################################
# Extension #253
WGL_I3D_image_buffer enum:
WGL_IMAGE_BUFFER_MIN_ACCESS_I3D = 0x00000001
WGL_IMAGE_BUFFER_LOCK_I3D = 0x00000002
###############################################################################
# No new tokens
# Extension #254
WGL_I3D_swap_frame_lock enum:
###############################################################################
# Extension #263
WGL_NV_render_depth_texture enum:
WGL_BIND_TO_TEXTURE_DEPTH_NV = 0x20A3
WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV = 0x20A4
WGL_DEPTH_TEXTURE_FORMAT_NV = 0x20A5
WGL_TEXTURE_DEPTH_COMPONENT_NV = 0x20A6
WGL_DEPTH_COMPONENT_NV = 0x20A7
###############################################################################
# Extension #264
WGL_NV_render_texture_rectangle enum:
WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV = 0x20A0
WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV = 0x20A1
WGL_TEXTURE_RECTANGLE_NV = 0x20A2
###############################################################################
# Extension #278
WGL_ATI_pixel_format_float enum:
WGL_TYPE_RGBA_FLOAT_ATI = 0x21A0
###############################################################################
# Extension #281
WGL_NV_float_buffer enum:
WGL_FLOAT_COMPONENTS_NV = 0x20B0
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV = 0x20B1
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV = 0x20B2
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV = 0x20B3
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV = 0x20B4
WGL_TEXTURE_FLOAT_R_NV = 0x20B5
WGL_TEXTURE_FLOAT_RG_NV = 0x20B6
WGL_TEXTURE_FLOAT_RGB_NV = 0x20B7
WGL_TEXTURE_FLOAT_RGBA_NV = 0x20B8

View file

@ -0,0 +1,746 @@
# wglext.spec file
# DON'T REMOVE PREVIOUS LINE!!! libspec depends on it!
#
# License Applicability. Except to the extent portions of this file are
# made subject to an alternative license as permitted in the SGI Free
# Software License B, Version 1.1 (the "License"), the contents of this
# file are subject only to the provisions of the License. You may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
# Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
#
# http://oss.sgi.com/projects/FreeB
#
# Note that, as provided in the License, the Software is distributed on an
# "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
# DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
# CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
# PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
#
# Original Code. The Original Code is: OpenGL Sample Implementation,
# Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
# Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc.
# Copyright in any portions created by third parties is as indicated
# elsewhere herein. All Rights Reserved.
#
# Additional Notice Provisions: This software was created using the
# OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
# not been independently verified as being compliant with the OpenGL(R)
# version 1.2.1 Specification.
required-props:
param: retval retained
category: wgl ARB_buffer_region ARB_extensions_string ARB_pixel_format ARB_make_current_read ARB_pbuffer ARB_render_texture ARB_pixel_format_float EXT_display_color_table EXT_extensions_string EXT_make_current_read EXT_pbuffer EXT_pixel_format EXT_swap_control OML_sync_control I3D_digital_video_control I3D_gamma I3D_genlock I3D_image_buffer I3D_swap_frame_lock I3D_swap_frame_usage NV_vertex_array_range
# required-props in wgl.spec (which is not used for anything):
# dlflags: notlistable handcode
# wglflags: client-handcode server-handcode non-dispatch
#
# Boilerplate to define types used by some extensions. This is done
# up front, since it involves some complexities in protecting
# the declarations whether or not the -protect flag is given to
# the generator scripts.
#
passthru: #ifndef WGL_ARB_pbuffer
passthru: DECLARE_HANDLE(HPBUFFERARB);
passthru: #endif
passthru: #ifndef WGL_EXT_pbuffer
passthru: DECLARE_HANDLE(HPBUFFEREXT);
passthru: #endif
passthru:
###############################################################################
#
# ARB Extension #4
# ARB_buffer_region commands
#
###############################################################################
CreateBufferRegionARB(hDC, iLayerPlane, uType)
return HANDLE
param hDC HDC in value
param iLayerPlane int in value
param uType UINT in value
category ARB_buffer_region
DeleteBufferRegionARB(hRegion)
return VOID
param hRegion HANDLE in value
category ARB_buffer_region
SaveBufferRegionARB(hRegion, x, y, width, height)
return BOOL
param hRegion HANDLE in value
param x int in value
param y int in value
param width int in value
param height int in value
category ARB_buffer_region
RestoreBufferRegionARB(hRegion, x, y, width, height, xSrc, ySrc)
return BOOL
param hRegion HANDLE in value
param x int in value
param y int in value
param width int in value
param height int in value
param xSrc int in value
param ySrc int in value
category ARB_buffer_region
###############################################################################
#
# ARB Extension #5
# ARB_multisample commands
#
###############################################################################
# (none)
newcategory: ARB_multisample
###############################################################################
#
# ARB Extension #8
# ARB_extensions_string commands
#
###############################################################################
GetExtensionsStringARB(hdc)
return String
param hdc HDC in value
category ARB_extensions_string
###############################################################################
#
# ARB Extension #9
# ARB_pixel_format commands
#
###############################################################################
GetPixelFormatAttribivARB(hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, piValues)
return BOOL
param hdc HDC in value
param iPixelFormat int in value
param iLayerPlane int in value
param nAttributes UINT in value
param piAttributes int in array [nAttributes]
param piValues int out array [nAttributes]
category ARB_pixel_format
GetPixelFormatAttribfvARB(hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, pfValues)
return BOOL
param hdc HDC in value
param iPixelFormat int in value
param iLayerPlane int in value
param nAttributes UINT in value
param piAttributes int in array [nAttributes]
param pfValues FLOAT out array [nAttributes]
category ARB_pixel_format
ChoosePixelFormatARB(hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats)
return BOOL
param hdc HDC in value
param piAttribIList int in array [COMPSIZE()]
param pfAttribFList FLOAT in array [COMPSIZE()]
param nMaxFormats UINT in value
param piFormats int out array [COMPSIZE(nNumFormats)]
param nNumFormats UINT out reference
category ARB_pixel_format
###############################################################################
#
# ARB Extension #10
# ARB_make_current_read commands
#
###############################################################################
MakeContextCurrentARB(hDrawDC, hReadDC, hglrc)
return BOOL
param hDrawDC HDC in value
param hReadDC HDC in value
param hglrc HGLRC in value
category ARB_make_current_read
GetCurrentReadDCARB()
return HDC
category ARB_make_current_read
###############################################################################
#
# ARB Extension #11
# ARB_pbuffer commands
#
###############################################################################
CreatePbufferARB(hDC, iPixelFormat, iWidth, iHeight, piAttribList)
return HPBUFFERARB
param hDC HDC in value
param iPixelFormat int in value
param iWidth int in value
param iHeight int in value
param piAttribList int in array [COMPSIZE()]
category ARB_pbuffer
GetPbufferDCARB(hPbuffer)
return HDC
param hPbuffer HPBUFFERARB in value
category ARB_pbuffer
ReleasePbufferDCARB(hPbuffer, hDC)
return int
param hPbuffer HPBUFFERARB in value
param hDC HDC in value
category ARB_pbuffer
DestroyPbufferARB(hPbuffer)
return BOOL
param hPbuffer HPBUFFERARB in value
category ARB_pbuffer
QueryPbufferARB(hPbuffer, iAttribute, piValue)
return BOOL
param hPbuffer HPBUFFERARB in value
param iAttribute int in value
param piValue int out reference
category ARB_pbuffer
###############################################################################
#
# ARB Extension #20
# ARB_render_texture commands
#
###############################################################################
BindTexImageARB(hPbuffer, iBuffer)
return BOOL
param hPbuffer HPBUFFERARB in value
param iBuffer int in value
category ARB_render_texture
ReleaseTexImageARB(hPbuffer, iBuffer)
return BOOL
param hPbuffer HPBUFFERARB in value
param iBuffer int in value
category ARB_render_texture
SetPbufferAttribARB(hPbuffer, piAttribList)
return BOOL
param hPbuffer HPBUFFERARB in value
param piAttribList int in array [COMPSIZE()]
category ARB_render_texture
###############################################################################
#
# ARB Extension #39
# ARB_pixel_format_float commands
#
###############################################################################
# (none)
newcategory: ARB_pixel_format_float
###############################################################################
#
# Extension #167
# EXT_display_color_table commands
#
###############################################################################
CreateDisplayColorTableEXT(id)
return GLboolean
param id GLushort in value
category EXT_display_color_table
LoadDisplayColorTableEXT(table, length)
return GLboolean
param table GLushort in array [length]
param length GLuint in value
category EXT_display_color_table
BindDisplayColorTableEXT(id)
return GLboolean
param id GLushort in value
category EXT_display_color_table
DestroyDisplayColorTableEXT(id)
return VOID
param id GLushort in value
category EXT_display_color_table
###############################################################################
#
# Extension #168
# EXT_extensions_string commands
#
###############################################################################
GetExtensionsStringEXT()
return String
category EXT_extensions_string
###############################################################################
#
# Extension #169
# EXT_make_current_read commands
#
###############################################################################
MakeContextCurrentEXT(hDrawDC, hReadDC, hglrc)
return BOOL
param hDrawDC HDC in value
param hReadDC HDC in value
param hglrc HGLRC in value
category EXT_make_current_read
GetCurrentReadDCEXT()
return HDC
category EXT_make_current_read
###############################################################################
#
# Extension #171
# EXT_pbuffer commands
#
###############################################################################
CreatePbufferEXT(hDC, iPixelFormat, iWidth, iHeight, piAttribList)
return HPBUFFEREXT
param hDC HDC in value
param iPixelFormat int in value
param iWidth int in value
param iHeight int in value
param piAttribList int in array [COMPSIZE()]
category EXT_pbuffer
GetPbufferDCEXT(hPbuffer)
return HDC
param hPbuffer HPBUFFEREXT in value
category EXT_pbuffer
ReleasePbufferDCEXT(hPbuffer, hDC)
return int
param hPbuffer HPBUFFEREXT in value
param hDC HDC in value
category EXT_pbuffer
DestroyPbufferEXT(hPbuffer)
return BOOL
param hPbuffer HPBUFFEREXT in value
category EXT_pbuffer
QueryPbufferEXT(hPbuffer, iAttribute, piValue)
return BOOL
param hPbuffer HPBUFFEREXT in value
param iAttribute int in value
param piValue int out reference
category EXT_pbuffer
###############################################################################
#
# Extension #170
# EXT_pixel_format commands
#
###############################################################################
GetPixelFormatAttribivEXT(hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, piValues)
return BOOL
param hdc HDC in value
param iPixelFormat int in value
param iLayerPlane int in value
param nAttributes UINT in value
param piAttributes int out array [nAttributes]
param piValues int out array [nAttributes]
category EXT_pixel_format
GetPixelFormatAttribfvEXT(hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, pfValues)
return BOOL
param hdc HDC in value
param iPixelFormat int in value
param iLayerPlane int in value
param nAttributes UINT in value
param piAttributes int out array [nAttributes]
param pfValues FLOAT out array [nAttributes]
category EXT_pixel_format
ChoosePixelFormatEXT(hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats)
return BOOL
param hdc HDC in value
param piAttribIList int in array [COMPSIZE()]
param pfAttribFList FLOAT in array [COMPSIZE()]
param nMaxFormats UINT in value
param piFormats int out array [COMPSIZE(nNumFormats)]
param nNumFormats UINT out reference
category EXT_pixel_format
###############################################################################
#
# Extension #172
# EXT_swap_control commands
#
###############################################################################
SwapIntervalEXT(interval)
return BOOL
param interval int in value
category EXT_swap_control
GetSwapIntervalEXT()
return int
category EXT_swap_control
###############################################################################
#
# Extension #177
# EXT_depth_float commands
#
###############################################################################
# (none)
newcategory: EXT_depth_float
###############################################################################
#
# Extension #190
# NV_vertex_array_range commands
#
###############################################################################
AllocateMemoryNV(size, readfreq, writefreq, priority)
return VoidPointer
param size GLsizei in value
param readfreq GLfloat in value
param writefreq GLfloat in value
param priority GLfloat in value
category NV_vertex_array_range
FreeMemoryNV(pointer)
return void
param pointer void out array [1]
category NV_vertex_array_range
###############################################################################
#
# Extension #207
# 3DFX_multisample commands
#
###############################################################################
# (none)
newcategory: 3DFX_multisample
###############################################################################
#
# Extension #209
# EXT_multisample commands
#
###############################################################################
# (none)
newcategory: EXT_multisample
###############################################################################
#
# Extension #242
# OML_sync_control commands
#
###############################################################################
GetSyncValuesOML(hdc, ust, msc, sbc)
return BOOL
param hdc HDC in value
param ust INT64 out array [1]
param msc INT64 out array [1]
param sbc INT64 out array [1]
category OML_sync_control
GetMscRateOML(hdc, numerator, denominator)
return BOOL
param hdc HDC in value
param numerator INT32 out array [1]
param denominator INT32 out array [1]
category OML_sync_control
SwapBuffersMscOML(hdc, target_msc, divisor, remainder)
return INT64
param hdc HDC in value
param target_msc INT64 in value
param divisor INT64 in value
param remainder INT64 in value
category OML_sync_control
SwapLayerBuffersMscOML(hdc, fuPlanes, target_msc, divisor, remainder)
return INT64
param hdc HDC in value
param fuPlanes int in value
param target_msc INT64 in value
param divisor INT64 in value
param remainder INT64 in value
category OML_sync_control
WaitForMscOML(hdc, target_msc, divisor, remainder , ust, msc, sbc)
return BOOL
param hdc HDC in value
param target_msc INT64 in value
param divisor INT64 in value
param remainder INT64 in value
param ust INT64 out array [1]
param msc INT64 out array [1]
param sbc INT64 out array [1]
category OML_sync_control
WaitForSbcOML(hdc, target_sbc, ust, msc, sbc)
return BOOL
param hdc HDC in value
param target_sbc INT64 in value
param ust INT64 out array [1]
param msc INT64 out array [1]
param sbc INT64 out array [1]
category OML_sync_control
###############################################################################
#
# Extension #250
# I3D_digital_video_control commands
#
###############################################################################
GetDigitalVideoParametersI3D(hDC, iAttribute, piValue)
return BOOL
param hDC HDC in value
param iAttribute int in value
param piValue int out array [COMPSIZE(iAttribute)]
category I3D_digital_video_control
SetDigitalVideoParametersI3D(hDC, iAttribute, piValue)
return BOOL
param hDC HDC in value
param iAttribute int in value
param piValue int in array [COMPSIZE(iAttribute)]
category I3D_digital_video_control
###############################################################################
#
# Extension #251
# I3D_gamma commands
#
###############################################################################
GetGammaTableParametersI3D(hDC, iAttribute, piValue)
return BOOL
param hDC HDC in value
param iAttribute int in value
param piValue int out array [COMPSIZE(iAttribute)]
category I3D_gamma
SetGammaTableParametersI3D(hDC, iAttribute, piValue)
return BOOL
param hDC HDC in value
param iAttribute int in value
param piValue int in array [COMPSIZE(iAttribute)]
category I3D_gamma
GetGammaTableI3D(hDC, iEntries, puRed, puGreen, puBlue)
return BOOL
param hDC HDC in value
param iEntries int in value
param puRed USHORT out array [iEntries]
param puGreen USHORT out array [iEntries]
param puBlue USHORT out array [iEntries]
category I3D_gamma
SetGammaTableI3D(hDC, iEntries, puRed, puGreen, puBlue)
return BOOL
param hDC HDC in value
param iEntries int in value
param puRed USHORT in array [iEntries]
param puGreen USHORT in array [iEntries]
param puBlue USHORT in array [iEntries]
category I3D_gamma
###############################################################################
#
# Extension #252
# I3D_genlock commands
#
###############################################################################
EnableGenlockI3D(hDC)
return BOOL
param hDC HDC in value
category I3D_genlock
DisableGenlockI3D(hDC)
return BOOL
param hDC HDC in value
category I3D_genlock
IsEnabledGenlockI3D(hDC, pFlag)
return BOOL
param hDC HDC in value
param pFlag BOOL out reference
category I3D_genlock
GenlockSourceI3D(hDC, uSource)
return BOOL
param hDC HDC in value
param uSource UINT in value
category I3D_genlock
GetGenlockSourceI3D(hDC, uSource)
return BOOL
param hDC HDC in value
param uSource UINT out reference
category I3D_genlock
GenlockSourceEdgeI3D(hDC, uEdge)
return BOOL
param hDC HDC in value
param uEdge UINT in value
category I3D_genlock
GetGenlockSourceEdgeI3D(hDC, uEdge)
return BOOL
param hDC HDC in value
param uEdge UINT out reference
category I3D_genlock
GenlockSampleRateI3D(hDC, uRate)
return BOOL
param hDC HDC in value
param uRate UINT in value
category I3D_genlock
GetGenlockSampleRateI3D(hDC, uRate)
return BOOL
param hDC HDC in value
param uRate UINT out reference
category I3D_genlock
GenlockSourceDelayI3D(hDC, uDelay)
return BOOL
param hDC HDC in value
param uDelay UINT in value
category I3D_genlock
GetGenlockSourceDelayI3D(hDC, uDelay)
return BOOL
param hDC HDC in value
param uDelay UINT out reference
category I3D_genlock
QueryGenlockMaxSourceDelayI3D(hDC, uMaxLineDelay, uMaxPixelDelay)
return BOOL
param hDC HDC in value
param uMaxLineDelay UINT out reference
param uMaxPixelDelay UINT out reference
category I3D_genlock
###############################################################################
#
# Extension #253
# I3D_image_buffer commands
#
###############################################################################
CreateImageBufferI3D(hDC, dwSize, uFlags)
return LPVOID
param hDC HDC in value
param dwSize DWORD in value
param uFlags UINT in value
category I3D_image_buffer
DestroyImageBufferI3D(hDC, pAddress)
return BOOL
param hDC HDC in value
param pAddress LPVOID in value
category I3D_image_buffer
AssociateImageBufferEventsI3D(hDC, pEvent, pAddress, pSize, count)
return BOOL
param hDC HDC in value
param pEvent HANDLE in array [count]
param pAddress LPVOID in array [count]
param pSize DWORD in array [count]
param count UINT in value
category I3D_image_buffer
ReleaseImageBufferEventsI3D(hDC, pAddress, count)
return BOOL
param hDC HDC in value
param pAddress LPVOID in array [count]
param count UINT in value
category I3D_image_buffer
###############################################################################
#
# Extension #254
# I3D_swap_frame_lock commands
#
###############################################################################
EnableFrameLockI3D()
return BOOL
category I3D_swap_frame_lock
DisableFrameLockI3D()
return BOOL
category I3D_swap_frame_lock
IsEnabledFrameLockI3D(pFlag)
return BOOL
param pFlag BOOL out reference
category I3D_swap_frame_lock
QueryFrameLockMasterI3D(pFlag)
return BOOL
param pFlag BOOL out reference
category I3D_swap_frame_lock
###############################################################################
#
# Extension #255
# I3D_swap_frame_usage commands
#
###############################################################################
GetFrameUsageI3D(pUsage)
return BOOL
param pUsage float out reference
category I3D_swap_frame_usage
BeginFrameTrackingI3D()
return BOOL
category I3D_swap_frame_usage
EndFrameTrackingI3D()
return BOOL
category I3D_swap_frame_usage
QueryFrameTrackingI3D(pFrameCount, pMissedFrames, pLastMissedUsage)
return BOOL
param pFrameCount DWORD out reference
param pMissedFrames DWORD out reference
param pLastMissedUsage float out reference
category I3D_swap_frame_usage
###############################################################################
#
# Extension #278
# ATI_pixel_format_float commands
#
###############################################################################
# (none)
newcategory: ATI_pixel_format_float
###############################################################################
#
# Extension #281
# NV_float_buffer commands
#
###############################################################################
# (none)
newcategory: NV_float_buffer

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 API bindings")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Windows API bindings")]
[assembly: AssemblyCopyright("Copyright © 2006 Stephen Apostolopoulos")]
[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("0.1.2.0")]
[assembly: AssemblyFileVersion("0.1.2.0")]

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