Moved OpenTK.Graphics.GL class to the OpenTK.Graphics.OpenGL namespace (reason: necessary for OpenGL|ES support; necessary for support of different OpenGL profiles). OpenTK.Graphics.GL has been moved to the OpenTK.Compatibility library.

Removed OpenTK.Graphics.Glu class (reason: deprecated upstream; most functionality provided by OpenTK math; not compatible with OpenGL 3.0+.) OpenTK.Graphics.Glu can be accessed through OpenTK.Compatibility.
Added OpenGL|ES-specific ErrorHelper classes.
Moved OpenTK.Graphics.DisplayDevice and OpenTK.Graphics.DisplayResolution to the root OpenTK namespace (reason: their functionality is not specific and does not depend on OpenTK.Graphics).
Split Graphics*Exception classes into different files.
Made GraphicsErrorException public (reason: necessary for OpenTK.Compatibility).
This commit is contained in:
the_fiddler 2009-08-14 13:13:28 +00:00
parent 1965ab96fd
commit 0e02f67749
74 changed files with 46140 additions and 50483 deletions

View file

@ -178,7 +178,7 @@ namespace Examples
if (available_samples * SampleToByte > buffer.Length * BlittableValueType.StrideOf(buffer))
{
buffer = new short[OpenTK.Functions.NextPowerOfTwo(
buffer = new short[MathHelper.NextPowerOfTwo(
(int)(available_samples * SampleToByte / (double)BlittableValueType.StrideOf(buffer) + 0.5))];
}

View file

@ -37,7 +37,7 @@ using System.Windows.Forms;
using System.Threading;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
#endregion --- Using Directives ---
@ -147,12 +147,9 @@ namespace Examples.Tutorial
protected override void OnRenderFrame(FrameEventArgs e)
{
Matrix4 lookat = Matrix4.LookAt(0, 0, 16, 0, 0, 0, 0, 1, 0);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
Glu.LookAt(
0.0, 0.0, 16.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
GL.LoadMatrix(ref lookat);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
GL.CallLists(num_lists, ListNameType.Int, lists);

View file

@ -69,17 +69,9 @@ namespace Examples.Tutorial
double aspect_ratio = Width / (double)Height;
OpenTK.Matrix4 perspective = OpenTK.Matrix4.CreatePerspectiveFieldOfView(45, (float)aspect_ratio, 1, 64);
GL.MatrixMode(MatrixMode.Projection);
if (Keyboard[OpenTK.Input.Key.Space])
{
OpenTK.Matrix4 perspective = OpenTK.Matrix4.Perspective(45, (float)aspect_ratio, 1, 64);
GL.LoadMatrix(ref perspective);
}
else
{
GL.LoadIdentity();
Glu.Perspective(45, (float)aspect_ratio, 1, 64);
}
GL.LoadMatrix(ref perspective);
}
#endregion
@ -113,11 +105,9 @@ namespace Examples.Tutorial
{
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
Matrix4 lookat = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
GL.MatrixMode(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.LoadMatrix(ref lookat);
angle += rotation_speed * (float)e.Time;
GL.Rotate(angle, 0.0f, 1.0f, 0.0f);

View file

@ -16,7 +16,6 @@ using System.Drawing.Imaging;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL.Enums;
namespace Examples.Tutorial
{
@ -51,7 +50,7 @@ namespace Examples.Tutorial
ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, data.Width, data.Height, 0,
OpenTK.Graphics.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, data.Scan0);
bitmap.UnlockBits(data);

View file

@ -11,11 +11,10 @@ using System.Drawing;
using System.Threading;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using System.Diagnostics;
using OpenTK.Input;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL.Enums;
using OpenTK.Graphics.OpenGL;
namespace Examples.Tutorial
{
@ -90,11 +89,11 @@ namespace Examples.Tutorial
GL.Viewport(0, 0, Width, Height);
double ratio = Width / (double)Height;
double aspect_ratio = Width / (double)Height;
OpenTK.Matrix4 perspective = OpenTK.Matrix4.CreatePerspectiveFieldOfView(45, (float)aspect_ratio, 1, 64);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
Glu.Perspective(45.0, ratio, 1.0, 64.0);
GL.LoadMatrix(ref perspective);
}
#endregion
@ -147,13 +146,9 @@ namespace Examples.Tutorial
{
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
Matrix4 lookat = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
GL.MatrixMode(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.LoadMatrix(ref lookat);
angle += rotation_speed * (float)e.Time;

View file

@ -10,7 +10,7 @@ using System.Text;
using System.Drawing;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using Examples.Shapes;
namespace Examples.Tutorial
@ -83,11 +83,10 @@ namespace Examples.Tutorial
GL.Viewport(0, 0, Width, Height);
double ratio = Width / (double)Height;
float aspect_ratio = Width / (float)Height;
Matrix4 perpective = Matrix4.CreatePerspectiveFieldOfView(45, aspect_ratio, 1, 64);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
Glu.Perspective(45.0, ratio, 1.0, 64.0);
GL.LoadMatrix(ref perpective);
}
#endregion
@ -141,11 +140,10 @@ namespace Examples.Tutorial
{
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
Matrix4 lookat = Matrix4.LookAt(0, 0, -7.5f + zoom, 0, 0, 0, 0, 1, 0);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
Glu.LookAt(0.0, 0.0, -7.5 + zoom,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
GL.LoadMatrix(ref lookat);
GL.Rotate(x_angle, 0.0f, 1.0f, 0.0f);
GL.Begin(BeginMode.Triangles);

View file

@ -14,6 +14,7 @@ using System.Threading;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Platform;
#endregion
@ -76,11 +77,10 @@ namespace Examples.Tutorial
{
GL.Viewport(0, 0, Width, Height);
double ratio = Width / (double)Height;
float aspect_ratio = Width / (float)Height;
Matrix4 perpective = Matrix4.CreatePerspectiveFieldOfView(45, aspect_ratio, 1, 64);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
Glu.Perspective(45.0, ratio, 1.0, 64.0);
GL.LoadMatrix(ref perpective);
}
#endregion
@ -110,11 +110,9 @@ namespace Examples.Tutorial
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
Matrix4 lookat = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
GL.MatrixMode(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.LoadMatrix(ref lookat);
GL.Color4(System.Drawing.Color.Black);
Draw(vbo[0]);

View file

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

View file

@ -218,13 +218,16 @@ namespace Examples.Tutorial
protected override void OnResize(EventArgs e)
{
GL.Viewport(0, 0, Width, Height);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
Glu.Perspective(60.0, Width / (double)Height, 1.0, 5.0);
double aspect_ratio = Width / (double)Height;
OpenTK.Matrix4 perspective = OpenTK.Matrix4.CreatePerspectiveFieldOfView(45, (float)aspect_ratio, 1, 64);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadMatrix(ref perspective);
Matrix4 lookat = Matrix4.LookAt(0, 0, 3, 0, 0, 0, 0, 1, 0);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
Glu.LookAt(0.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
GL.LoadMatrix(ref lookat);
base.OnResize(e);
}
@ -233,12 +236,6 @@ namespace Examples.Tutorial
{
base.OnUpdateFrame(e);
if (Keyboard[Key.Space])
{
ErrorCode err = GL.GetError();
Console.WriteLine(err + " " + Glu.ErrorString((GluErrorCode)err));
}
if (Keyboard[Key.Escape])
this.Exit();
}

View file

@ -17,6 +17,7 @@ using System.IO;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace Examples.Tutorial
{
@ -160,7 +161,7 @@ namespace Examples.Tutorial
{
BitmapData data = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
GL.TexImage1D(TextureTarget.Texture1D, 0, PixelInternalFormat.Rgb8, data.Width, 0, OpenTK.Graphics.PixelFormat.Bgr,
GL.TexImage1D(TextureTarget.Texture1D, 0, PixelInternalFormat.Rgb8, data.Width, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgr,
PixelType.UnsignedByte, data.Scan0);
bitmap.UnlockBits(data);
}
@ -180,8 +181,8 @@ namespace Examples.Tutorial
System.Drawing.Imaging.ImageLockMode.WriteOnly,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
GL.ReadPixels(0, 0, this.Width, this.Height,
OpenTK.Graphics.PixelFormat.Bgr,
OpenTK.Graphics.PixelType.UnsignedByte,
OpenTK.Graphics.OpenGL.PixelFormat.Bgr,
OpenTK.Graphics.OpenGL.PixelType.UnsignedByte,
data.Scan0);
bmp.UnlockBits(data);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);

View file

@ -196,11 +196,10 @@ namespace Examples.Tutorial
{
GL.Viewport(0, 0, Width, Height);
double ratio = Width / (double)Height;
float aspect_ratio = Width / (float)Height;
Matrix4 perpective = Matrix4.CreatePerspectiveFieldOfView(45, aspect_ratio, 1, 64);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
Glu.Perspective(45.0, ratio, 1.0, 64.0);
GL.LoadMatrix(ref perpective);
}
#endregion
@ -239,11 +238,9 @@ namespace Examples.Tutorial
GL.Clear(ClearBufferMask.ColorBufferBit |
ClearBufferMask.DepthBufferBit);
Matrix4 lookat = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
GL.MatrixMode(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.LoadMatrix(ref lookat);
angle += rotation_speed * (float)e.Time;
GL.Rotate(angle, 0.0f, 1.0f, 0.0f);

View file

@ -1,272 +0,0 @@
#region --- License ---
/* Licensed under the MIT/X11 license.
* Copyright (c) 2006-2008 the OpenTK Team.
* This notice may not be removed from any source distribution.
* See license.txt for licensing details.
*/
#endregion
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
namespace Examples
{
[Example("GLU Tesselation Functions Test", ExampleCategory.OpenGL, "GLU", Visible = false)]
public class Test : GameWindow
{
int startList;
IntPtr tess;
// Define the signatures for the callback functions, and declare the callbacks.
delegate void BeginCallbackDelegate(BeginMode mode);
delegate void EndCallbackDelegate();
delegate void VertexCallbackDelegate(IntPtr v);
delegate void ErrorCallbackDelegate(GluErrorCode code);
unsafe delegate void CombineCallbackDelegate(
[MarshalAs(UnmanagedType.LPArray, SizeConst = 3)]double[] coordinates,
[MarshalAs(UnmanagedType.LPArray, SizeConst = 4)]double*[] vertexData,
[MarshalAs(UnmanagedType.LPArray, SizeConst = 4)]float[] weight,
double** dataOut);
BeginCallbackDelegate tessBegin;
EndCallbackDelegate tessEnd;
ErrorCallbackDelegate tessError;
VertexCallbackDelegate tessVertex;
CombineCallbackDelegate tessCombine;
public Test() : base()
{
Keyboard.KeyDown += KeyDownHandler;
}
#region --- GLU Tessellation callbacks ---
#region BeginHandler
void BeginHandler(BeginMode mode)
{
GL.Begin(mode);
}
#endregion
#region EndHandler
void EndHandler()
{
GL.End();
}
#endregion
#region VertexHandler
void VertexHandler(IntPtr v)
{
unsafe { GL.Vertex3((double*)v); }
}
#endregion
#region ErrorHandler
void ErrorHandler(GluErrorCode code)
{
System.Windows.Forms.MessageBox.Show(
String.Format("GLU Error {0}: {1}", code.ToString(), Glu.ErrorString(code)),
"An error occured while tesselating.");
this.Exit();
}
#endregion
#region CombineHandler
unsafe double*[] combineData;
int data_index = 0;
unsafe void CombineHandler(double[] coordinates, double*[] data, float[] weight, double** dataOut)
{
// Workaround Mono 1.2.6 bug with unsafe inline initializers
if (combineData == null)
combineData = new double*[16];
double* out_data = combineData[data_index] = (double*)Marshal.AllocHGlobal(6 * sizeof(double));
int i;
out_data[0] = coordinates[0];
out_data[1] = coordinates[1];
out_data[2] = coordinates[2];
for (i = 3; i < 6; i++)
{
double* real_data = (double*)data[i-3];
out_data[i] = weight[0] * real_data[0] +
weight[1] * real_data[1] +
weight[2] * real_data[2] +
weight[3] * real_data[3];
}
data_index++;
*dataOut = out_data;
}
#endregion
#endregion
#region KeyDownHandler
public void KeyDownHandler(KeyboardDevice sender, Key key)
{
switch (key)
{
case Key.Escape:
this.Exit();
return;
}
}
#endregion
#region OnResize
protected override void OnResize(EventArgs e)
{
GL.Viewport(0, 0, Width, Height);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
Glu.Ortho2D(0.0, (double)Width, 0.0, (double)Height);
}
#endregion
#region OnLoad
public override void OnLoad(EventArgs e)
{
double[][] rect = new double[4][] {
new double[] {50.0, 50.0, 0.0},
new double[] {200.0, 50.0, 0.0},
new double[] {200.0, 200.0, 0.0},
new double[] {50.0, 200.0, 0.0}
};
double[][] tri = new double[3][] {
new double[] {75.0, 75.0, 0.0},
new double[] {125.0, 175.0, 0.0},
new double[] {175.0, 75.0, 0.0}
};
double[][] star = new double[5][] {
new double[] {250.0, 50.0, 0.0, 1.0, 0.0, 1.0},
new double[] {325.0, 200.0, 0.0, 1.0, 1.0, 0.0},
new double[] {400.0, 50.0, 0.0, 0.0, 1.0, 1.0},
new double[] {250.0, 150.0, 0.0, 1.0, 0.0, 0.0},
new double[] {400.0, 150.0, 0.0, 0.0, 1.0, 0.0}
};
GL.ClearColor(System.Drawing.Color.MidnightBlue);
tess = Glu.NewTess();
startList = GL.GenLists(3);
tessVertex = this.VertexHandler;
tessBegin = this.BeginHandler;
tessEnd = this.EndHandler;
tessError = this.ErrorHandler;
unsafe { tessCombine = this.CombineHandler; }
Trace.Assert(tessVertex != null, "Failed to load tesselator callback function.");
Trace.Assert(tessBegin != null, "Failed to load tesselator begin callback function.");
Trace.Assert(tessEnd != null, "Failed to load tesselator end callback function.");
Trace.Assert(tessError != null, "Failed to load tesselator error callback function.");
Trace.Assert(tessCombine != null, "Failed to load tesselator combine callback function.");
Glu.TessCallback(tess, TessCallback.TessVertex, tessVertex);
Glu.TessCallback(tess, TessCallback.TessBegin, tessBegin);
Glu.TessCallback(tess, TessCallback.TessEnd, tessEnd);
Glu.TessCallback(tess, TessCallback.TessError, tessError);
// rectangle with triangular hole inside
GL.NewList(startList, ListMode.Compile);
GL.ShadeModel(ShadingModel.Flat);
Glu.TessBeginPolygon(tess, IntPtr.Zero);
Glu.TessBeginContour(tess);
Glu.TessVertex(tess, rect[0], rect[0]);
Glu.TessVertex(tess, rect[1], rect[1]);
Glu.TessVertex(tess, rect[2], rect[2]);
Glu.TessVertex(tess, rect[3], rect[3]);
Glu.TessEndContour(tess);
Glu.TessBeginContour(tess);
Glu.TessVertex(tess, tri[0], tri[0]);
Glu.TessVertex(tess, tri[1], tri[1]);
Glu.TessVertex(tess, tri[2], tri[2]);
Glu.TessEndContour(tess);
Glu.TessEndPolygon(tess);
GL.EndList();
Glu.TessCallback(tess, TessCallback.TessVertex, tessVertex);
Glu.TessCallback(tess, TessCallback.TessBegin, tessBegin);
Glu.TessCallback(tess, TessCallback.TessEnd, tessEnd);
Glu.TessCallback(tess, TessCallback.TessError, tessError);
Glu.TessCallback(tess, TessCallback.TessCombine, tessCombine);
// smooth shaded, self-intersecting star
GL.NewList(startList + 1, ListMode.Compile);
GL.ShadeModel(ShadingModel.Smooth);
Glu.TessWindingRuleProperty(tess, TessWinding.TessWindingPositive);
Glu.TessBeginPolygon(tess, IntPtr.Zero);
Glu.TessBeginContour(tess);
Glu.TessVertex(tess, star[0], star[0]);
Glu.TessVertex(tess, star[1], star[1]);
Glu.TessVertex(tess, star[2], star[2]);
Glu.TessVertex(tess, star[3], star[3]);
Glu.TessVertex(tess, star[4], star[4]);
Glu.TessEndContour(tess);
Glu.TessEndPolygon(tess);
GL.EndList();
}
#endregion
#region OnUnload
public override void OnUnload(EventArgs e)
{
if (tess != IntPtr.Zero)
Glu.DeleteTess(tess);
GL.DeleteLists(startList, 3);
while (data_index != 0)
unsafe { Marshal.FreeHGlobal((IntPtr)combineData[data_index--]); }
}
#endregion
#region OnRenderFrame
protected override void OnRenderFrame(FrameEventArgs e)
{
GL.Clear(ClearBufferMask.ColorBufferBit);
GL.Color3(1.0f, 1.0f, 1.0f);
GL.CallList(startList);
GL.CallList(startList + 1);
GL.Flush();
this.SwapBuffers();
}
#endregion
public static void Main()
{
using (Test test = new Test())
{
Utilities.SetWindowTitle(test);
test.Run(30.0, 0.0);
}
}
}
}

View file

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

View file

@ -13,6 +13,7 @@ using System.Diagnostics;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Input;
namespace Examples.Tutorial

View file

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

View file

@ -7,7 +7,7 @@ using System.Text;
using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace Examples.WinForms
{

View file

@ -16,8 +16,9 @@ using System.Windows.Forms;
using System.Diagnostics;
using System.Threading;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Platform;
using OpenTK;
#endregion
@ -104,12 +105,10 @@ namespace Examples.WinForms
GL.Viewport(0, 0, c.ClientSize.Width, c.ClientSize.Height);
double ratio = 0.0;
ratio = c.ClientSize.Width / (double)c.ClientSize.Height;
float aspect_ratio = Width / (float)Height;
Matrix4 perpective = Matrix4.CreatePerspectiveFieldOfView(45, aspect_ratio, 1, 64);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
Glu.Perspective(45.0, ratio, 1.0, 64.0);
GL.LoadMatrix(ref perpective);
}
#endregion
@ -141,13 +140,10 @@ namespace Examples.WinForms
private void Render()
{
Matrix4 lookat = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0);
GL.MatrixMode(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.LoadMatrix(ref lookat);
GL.Rotate(angle, 0.0f, 1.0f, 0.0f);
angle += 0.5f;

View file

@ -15,7 +15,7 @@ using System.Text;
using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
#endregion

View file

@ -31,6 +31,7 @@ using System.Text;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Input;
using System.Drawing;

View file

@ -11,7 +11,7 @@ using System.Drawing;
using System.Diagnostics;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Input;
namespace Examples.Tutorial

View file

@ -28,6 +28,8 @@
using System;
using System.IO;
using System.Xml.Serialization;
using OpenTK;
using OpenTK.Graphics;
namespace Examples.Tests

View file

@ -15,9 +15,8 @@ using System.Threading;
using System.Reflection;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using OpenTK.Graphics.OpenGL.Enums;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using System.Text.RegularExpressions;
namespace Examples.WinForms

View file

@ -13,6 +13,7 @@ using System.Threading;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Input;
namespace Examples.Tests
@ -23,41 +24,6 @@ namespace Examples.Tests
Font font = new Font(FontFamily.GenericSansSerif, 16.0f);
TextPrinter printer = new TextPrinter();
#region GetNext and GetPrevious methods for enums.
T GetNext<T>(T t)
{
if (!(t is Enum))
throw new ArgumentException(String.Format("Should be an Enum type (is {0}).", t.GetType().ToString()), "t");
string[] names = Enum.GetNames(t.GetType());
T[] values = (T[])Enum.GetValues(t.GetType());
int current_index = Array.IndexOf(names, t.ToString());
if (current_index >= values.Length - 1)
return values[0];
else
return values[current_index + 1];
}
T GetPrevious<T>(T t)
{
if (!(t is Enum))
throw new ArgumentException(String.Format("Should be an Enum type (is {0}).", t.GetType().ToString()), "t");
string[] names = Enum.GetNames(t.GetType());
T[] values = (T[])Enum.GetValues(t.GetType());
int current_index = Array.IndexOf(names, t.ToString());
if (current_index <= 0)
return values[values.Length - 1];
else
return values[current_index - 1];
}
#endregion
public GameWindowStates()
: base(800, 600)
{
@ -76,35 +42,27 @@ namespace Examples.Tests
this.Exit();
break;
case OpenTK.Input.Key.Number1:
if (sender[Key.ShiftLeft] || sender[Key.ShiftRight])
WindowState = GetPrevious(WindowState);
else if (sender[Key.AltLeft] || sender[Key.AltRight])
WindowState = GetNext(GetNext(WindowState));
else if (sender[Key.ControlLeft] || sender[Key.ControlRight])
WindowState = GetPrevious(GetPrevious(WindowState));
else
WindowState = GetNext(WindowState);
case Key.Number1:
WindowState = WindowState.Normal;
break;
case Key.Number2:
WindowState = WindowState.Maximized;
break;
case Key.Number3:
WindowState = WindowState.Fullscreen;
break;
case Key.Number4:
WindowState = WindowState.Minimized;
break;
case OpenTK.Input.Key.Number2:
if (sender[Key.ShiftLeft] || sender[Key.ShiftRight])
WindowBorder = GetPrevious(WindowBorder);
else
WindowBorder = GetNext(WindowBorder);
case Key.Number5:
WindowBorder = WindowBorder.Resizable;
break;
case OpenTK.Input.Key.Number3:
if (this.WindowState == WindowState.Fullscreen)
this.WindowState = WindowState.Normal;
else
this.WindowState = WindowState.Fullscreen;
case Key.Number6:
WindowBorder = WindowBorder.Fixed;
break;
case Key.Number7:
WindowBorder = WindowBorder.Hidden;
break;
}
}
@ -122,13 +80,9 @@ namespace Examples.Tests
printer.Print("Instructions:", font, Color.White);
GL.Translate(0, font.Height, 0);
printer.Print(String.Format("1 - cycle through window styles (current: {0}).", this.WindowState), font, Color.White, RectangleF.Empty);
printer.Print(String.Format("[1 - 4]: change WindowState (current: {0}).", this.WindowState), font, Color.White, RectangleF.Empty);
GL.Translate(0, font.Height, 0);
printer.Print(String.Format("2 - cycle through window borders (current: {0}).", this.WindowBorder), font, Color.White, RectangleF.Empty);
GL.Translate(0, font.Height, 0);
printer.Print(String.Format("3 - toggle fullscreen (current: {0}).",
this.WindowState == WindowState.Fullscreen ? "enabled" : "disabled"), font, Color.White, RectangleF.Empty);
printer.Print(String.Format("[5 - 7]: change WindowBorder (current: {0}).", this.WindowBorder), font, Color.White, RectangleF.Empty);
printer.End();

View file

@ -1,169 +0,0 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Text;
using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Windows.Forms;
using System.Security;
using OpenTK.Graphics.OpenGL;
using OpenTK.Graphics.OpenGL.Enums;
using OpenTK.Graphics;
namespace Examples.Tests
{
// This test is obsolete.
public class S01_Call_Performance
{
const int num_calls = 1000000;
float[] v = new float[] { 0.0f, 0.0f };
public static int dummy_variable = 0;
public void Launch()
{
using (OpenTK.GLControl control = new OpenTK.GLControl(GraphicsMode.Default))
{
Trace.WriteLine(String.Format("Number of calls: {0}", num_calls));
Stopwatch timer = new Stopwatch();
#region Managed functions
Trace.Write("Timing empty loop: ");
timer.Start();
for (int i = 0; ++i < num_calls; )
{
}
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
Trace.Write("Timing inline .Net functions: ");
timer.Start();
for (int i = 0; ++i < num_calls; )
{
InlineFunction();
}
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
Trace.Write("Timing virtual .Net functions: ");
timer.Start();
for (int i = 0; ++i < num_calls; )
{
VirtualFunction();
}
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
#endregion
#region OpenTK.Graphics.OpenGL
Trace.Write("Timing OpenTK.Graphics.OpenGL core functions: ");
timer.Start();
for (int i = 0; ++i < num_calls; )
{
GL.Vertex2(0.0f, 0.0f);
}
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
Trace.Write("Timing OpenTK.Graphics.OpenGL core functions (array): ");
timer.Start();
for (int i = 0; ++i < num_calls; )
{
GL.Vertex2(v);
}
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
Trace.Write("Timing OpenTK.Graphics.OpenGL core functions (void*): ");
timer.Start();
for (int i = 0; ++i < num_calls; )
GL.CallLists(v.Length, ListNameType.Float, v);
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
Trace.Write("Timing OpenTK.Graphics.OpenGL extension functions: ");
timer.Start();
for (int i = 0; ++i < num_calls; )
GL.ActiveTexture(TextureUnit.Texture0);
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
#endregion
#region DllImports
Trace.Write("Timing direct DllImport: ");
timer.Start();
for (int i = 0; ++i < num_calls; )
{
glVertex2f(0.0f, 0.0f);
}
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
Trace.Write("Timing direct DllImport (array): ");
timer.Start();
for (int i = 0; ++i < num_calls; )
{
glVertex2fv(v);
}
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
GL.GenLists(1);
Trace.Write("Timing direct DllImport (void*): ");
timer.Start();
for (int i = 0; ++i < num_calls; )
{
glCallLists(v.Length, ListNameType.Float, v);
}
timer.Stop();
Trace.WriteLine(String.Format("{0} ns", timer.Elapsed.TotalMilliseconds * (1000000.0 / (double)num_calls)));
timer.Reset();
#endregion
}
}
public static readonly int order = 1;
public void InlineFunction()
{
++dummy_variable;
}
public virtual void VirtualFunction()
{
++dummy_variable;
}
[DllImport("opengl32.dll", EntryPoint = "glVertex2f"), SuppressUnmanagedCodeSecurity]
extern static void glVertex2f(float a, float b);
[DllImport("opengl32.dll", EntryPoint = "glVertex2fv"), SuppressUnmanagedCodeSecurity]
extern static void glVertex2fv(float[] v);
[DllImport("opengl32.dll", EntryPoint = "glCallLists"), SuppressUnmanagedCodeSecurity]
extern static void glCallLists(int count, ListNameType type, object lists);
}
}

View file

@ -11,10 +11,10 @@ using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using OpenTK.Graphics;
using System.Threading;
using OpenTK;
namespace Examples.Tests
{
[Example("Test Resolution Changes", ExampleCategory.OpenTK, "Test", Documentation="TestResolutionChanges")]

View file

@ -135,12 +135,13 @@ namespace Examples.Properties {
///using System.Reflection;
///
///using OpenTK;
///using OpenTK.Graphics.OpenGL;
///using OpenTK.Graphics.OpenGL.Enums;
///using OpenTK.Graphics;
///using OpenTK.Graphics.OpenGL;
///using System.Text.RegularExpressions;
///
///names [rest of string was truncated]&quot;;.
///namespace Examples.WinForms
///{
/// [Examp [rest of string was truncated]&quot;;.
/// </summary>
internal static string Extensions {
get {
@ -609,34 +610,6 @@ namespace Examples.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to #region --- License ---
////* Licensed under the MIT/X11 license.
/// * Copyright (c) 2006-2008 the OpenTK Team.
/// * This notice may not be removed from any source distribution.
/// * See license.txt for licensing details.
/// */
///#endregion
///
///using System;
///using System.Diagnostics;
///using System.Runtime.InteropServices;
///
///using OpenTK;
///using OpenTK.Graphics;
///using OpenTK.Input;
///
///namespace Examples
///{
/// [Example(&quot;GLU Tesselation Functions Test&quot;, ExampleCategory.OpenGL, &quot;GLU&quot;, Visible = false)]
/// public [rest of string was truncated]&quot;;.
/// </summary>
internal static string Tessellation {
get {
return ResourceManager.GetString("Tessellation", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to #region --- License ---
////* Licensed under the MIT/X11 license.
@ -681,13 +654,13 @@ namespace Examples.Properties {
///using System.Text;
///using System.Windows.Forms;
///using System.Diagnostics;
///
///using OpenTK.Graphics;
///using System.Threading;
///
///using OpenTK;
///
///namespace Examples.Tests
///{
/// [Example(&quot;Test Resolution Changes&quot;, ExampleCategory.OpenTK, &quot;Test&quot;, Docum [rest of string was truncated]&quot;;.
/// [Example(&quot;Test Resolution Changes&quot;, ExampleCategory.OpenTK, &quot;Test&quot;, Documentation= [rest of string was truncated]&quot;;.
/// </summary>
internal static string TestResolutionChanges {
get {
@ -714,12 +687,13 @@ namespace Examples.Properties {
///using OpenTK;
///using OpenTK.Graphics.OpenGL;
///using OpenTK.Graphics;
///using OpenTK.Graphics.OpenGL.Enums;
///
///namespace Examples.Tutorial
///{
/// /// &lt;summary&gt;
/// /// Demonstrates simple OpenGL Texturing. [rest of string was truncated]&quot;;.
/// /// Demonstrates simple OpenGL Texturing.
/// /// &lt;/summary&gt;
/// [Example(&quot;T [rest of string was truncated]&quot;;.
/// </summary>
internal static string Textures {
get {
@ -741,16 +715,15 @@ namespace Examples.Properties {
///using System.Threading;
///
///using OpenTK;
///using OpenTK.Graphics.OpenGL;
///using System.Diagnostics;
///using OpenTK.Input;
///using OpenTK.Graphics;
///using OpenTK.Graphics.OpenGL.Enums;
///using OpenTK.Graphics.OpenGL;
///
///namespace Examples.Tutorial
///{
/// /// &lt;summary&gt;
/// /// Demonstrates Vertex Arrays (in system memo [rest of string was truncated]&quot;;.
/// /// Demonstrates Vertex Arrays (in system memory). Example is incomplete (document [rest of string was truncated]&quot;;.
/// </summary>
internal static string VertexArrays {
get {

View file

@ -178,9 +178,6 @@
<data name="StreamingPlayback" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\OpenAL\1.1\StreamingPlayback.cs;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="Tessellation" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\OpenGL\GLU\Tessellation.cs;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="TestAudioContext" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\OpenAL\Test\TestAudioContext.cs;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>

View file

@ -13,7 +13,7 @@ using System.Diagnostics;
using System.Threading;
using System.Drawing;
namespace OpenTK.Graphics
namespace OpenTK
{
/// <summary>
/// Defines a display device on the underlying system, and provides
@ -38,7 +38,7 @@ namespace OpenTK.Graphics
static DisplayDevice primary_display;
//static FadeEffect effect = new FadeEffect();
static IDisplayDeviceDriver implementation;
static Platform.IDisplayDeviceDriver implementation;
#endregion
@ -196,7 +196,7 @@ namespace OpenTK.Graphics
original_resolution = current_resolution;
current_resolution = resolution;
}
else throw new GraphicsModeException(String.Format("Device {0}: Failed to change resolution to {1}.",
else throw new Graphics.GraphicsModeException(String.Format("Device {0}: Failed to change resolution to {1}.",
this, resolution));
//effect.FadeIn();
@ -234,7 +234,7 @@ namespace OpenTK.Graphics
current_resolution = original_resolution;
original_resolution = null;
}
else throw new GraphicsModeException(String.Format("Device {0}: Failed to restore resolution.", this));
else throw new Graphics.GraphicsModeException(String.Format("Device {0}: Failed to restore resolution.", this));
//effect.FadeIn();
}

View file

@ -12,7 +12,7 @@ using System.Text;
using System.Diagnostics;
using System.Drawing;
namespace OpenTK.Graphics
namespace OpenTK
{
/// <summary>Contains information regarding a monitor's display resolution.</summary>
public class DisplayResolution

View file

@ -16,7 +16,6 @@ using System.Windows.Forms;
using OpenTK.Platform;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using System.Diagnostics;
namespace OpenTK
@ -270,17 +269,19 @@ namespace OpenTK
/// <exception cref="OpenTK.Graphics.GraphicsContextException">
/// Occurs when no OpenTK.Graphics.GraphicsContext is current in the calling thread.
/// </exception>
[Obsolete]
public Bitmap GrabScreenshot()
{
Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
System.Drawing.Imaging.BitmapData data =
bmp.LockBits(this.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
GL.ReadPixels(0, 0, this.ClientSize.Width, this.ClientSize.Height, PixelFormat.Bgr, PixelType.UnsignedByte,
data.Scan0);
bmp.UnlockBits(data);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
return bmp;
throw new NotImplementedException();
//Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
//System.Drawing.Imaging.BitmapData data =
// bmp.LockBits(this.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly,
// System.Drawing.Imaging.PixelFormat.Format24bppRgb);
//GL.ReadPixels(0, 0, this.ClientSize.Width, this.ClientSize.Height, PixelFormat.Bgr, PixelType.UnsignedByte,
// data.Scan0);
//bmp.UnlockBits(data);
//bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
//return bmp;
}
#endregion

View file

@ -824,12 +824,6 @@ namespace OpenTK
/// <param name="e"></param>
private void OnLoadInternal(EventArgs e)
{
Debug.Print("{0}.Load", this.GetType().Name);
Debug.WriteLine(String.Format("OpenGL driver information: {0}, {1}, {2}",
GL.GetString(StringName.Renderer),
GL.GetString(StringName.Vendor),
GL.GetString(StringName.Version)));
OnResizeInternal(EventArgs.Empty);
Load(this, e);
OnLoad(e);

View file

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

View file

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

View file

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

View file

@ -28,8 +28,9 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace OpenTK.Graphics
namespace OpenTK.Graphics.OpenGL
{
// Used in debug-mode only, for automatic OpenGL error-checking.
//
@ -45,6 +46,9 @@ namespace OpenTK.Graphics
{
#region Fields
static readonly object SyncRoot = new object();
static readonly Dictionary<GraphicsContext, List<ErrorCode>> ContextErrors =
new Dictionary<GraphicsContext, List<ErrorCode>>();
readonly GraphicsContext Context;
#endregion
@ -57,7 +61,63 @@ namespace OpenTK.Graphics
throw new GraphicsContextMissingException();
Context = (GraphicsContext)context;
Context.ResetErrors();
lock (SyncRoot)
{
if (!ContextErrors.ContainsKey(Context))
ContextErrors.Add(Context, new List<ErrorCode>());
}
ResetErrors();
}
#endregion
#region Public Members
// Retrieve all OpenGL errors to clear the error list.
// See http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html
[Conditional("DEBUG")]
internal void ResetErrors()
{
if (Context.ErrorChecking)
{
while (GL.GetError() != ErrorCode.NoError)
{ }
}
}
// Retrieve all OpenGL errors and throw an exception if anything other than NoError is returned.
[Conditional("DEBUG")]
internal void CheckErrors()
{
if (Context.ErrorChecking)
{
List<ErrorCode> error_list = ContextErrors[Context];
error_list.Clear();
ErrorCode error;
do
{
error = GL.GetError();
error_list.Add(error);
} while (error != ErrorCode.NoError);
if (error_list.Count != 1)
{
StringBuilder sb = new StringBuilder();
foreach (ErrorCode e in error_list)
{
if (e != ErrorCode.NoError)
{
sb.Append(e.ToString());
sb.Append(", ");
}
else
break;
}
sb.Remove(sb.Length - 2, 2); // Remove the last comma
throw new GraphicsErrorException(sb.ToString());
}
}
}
#endregion
@ -66,7 +126,7 @@ namespace OpenTK.Graphics
public void Dispose()
{
Context.CheckErrors();
CheckErrors();
}
#endregion

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,7 @@
using System;
namespace OpenTK.Graphics
namespace OpenTK.Graphics.OpenGL
{
#pragma warning disable 1591

View file

@ -19,13 +19,7 @@ using System.Reflection.Emit;
#endregion
// Add a dummy namespace to keep old code compiling.
namespace OpenTK.Graphics.OpenGL.Enums
{
internal static class Dummy { }
}
namespace OpenTK.Graphics
namespace OpenTK.Graphics.OpenGL
{
/// <summary>
/// OpenGL bindings for .NET, implementing OpenGL 3.1, plus extensions.
@ -967,7 +961,7 @@ namespace OpenTK.Graphics
unsafe
{
int length;
GL.GetProgram(program, OpenTK.Graphics.ProgramParameter.InfoLogLength, out length); if (length == 0)
GL.GetProgram(program, OpenTK.Graphics.OpenGL.ProgramParameter.InfoLogLength, out length); if (length == 0)
{
info = String.Empty;
return;

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

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

View file

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

View file

@ -244,58 +244,6 @@ namespace OpenTK.Graphics
#endregion
#region --- Internal Members ---
List<ErrorCode> error_list = new List<ErrorCode>();
// Retrieve all OpenGL errors to clear the error list.
// See http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html
[Conditional("DEBUG")]
internal void ResetErrors()
{
if (check_errors)
{
while (GL.GetError() != ErrorCode.NoError)
{ }
}
}
// Retrieve all OpenGL errors and throw an exception if anything other than NoError is returned.
[Conditional("DEBUG")]
internal void CheckErrors()
{
if (check_errors)
{
error_list.Clear();
ErrorCode error;
do
{
error = GL.GetError();
error_list.Add(error);
} while (error != ErrorCode.NoError);
if (error_list.Count != 1)
{
StringBuilder sb = new StringBuilder();
foreach (ErrorCode e in error_list)
{
if (e != ErrorCode.NoError)
{
sb.Append(e.ToString());
sb.Append(", ");
}
else
break;
}
sb.Remove(sb.Length - 2, 2); // Remove the last comma
throw new OpenGLErrorException(sb.ToString());
}
}
}
#endregion
#region --- Private Members ---
#region void ContextDestroyed(IGraphicsContext context, EventArgs e)
@ -526,32 +474,4 @@ namespace OpenTK.Graphics
#endregion
}
#region public class GraphicsException : Exception
/// <summary>Represents errors related to Graphics operations.</summary>
public class GraphicsException : Exception
{
/// <summary>Constructs a new GraphicsException.</summary>
public GraphicsException() : base() { }
/// <summary>Constructs a new GraphicsException with the specified excpetion message.</summary>
/// <param name="message"></param>
public GraphicsException(string message) : base(message) { }
}
#endregion
#region class GraphicsErrorException : GraphicsException
// This is private by design. These exceptions are only thrown in debug builds of
// OpenTK and the user should *not* handle them.
// If some specific OpenGL error is generated by design, the user should
// turn off automatic error checking for that portion of the code, using
// 'GraphicsContext.ErrorChecking = false'.
class OpenGLErrorException : GraphicsException
{
public OpenGLErrorException(string message) : base(message) { }
}
#endregion
}

View file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Graphics
{
/// <summary>
/// Represents errors related to a GraphicsContext.
/// </summary>
public class GraphicsContextException : Exception
{
/// <summary>
/// Constructs a new GraphicsContextException.
/// </summary>
public GraphicsContextException() : base() { }
/// <summary>
/// Constructs a new GraphicsContextException with the given error message.
/// </summary>
public GraphicsContextException(string message) : base(message) { }
}
}

View file

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Graphics
{
/// <summary>
/// Thrown when an operation that required GraphicsContext is performed, when no
/// GraphicsContext is current in the calling thread.
/// </summary>
public class GraphicsContextMissingException : GraphicsContextException
{
/// <summary>
/// Constructs a new GraphicsContextMissingException.
/// </summary>
public GraphicsContextMissingException()
: base(String.Format(
"No context is current in the calling thread (ThreadId: {0}).",
System.Threading.Thread.CurrentThread.ManagedThreadId))
{ }
}
}

View file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Graphics
{
/// <summary>
/// Identifies a specific OpenGL or OpenGL|ES error. Such exceptions are only thrown
/// when OpenGL or OpenGL|ES automatic error checking is enabled -
/// <see cref="GraphicsContext.ErrorChecking"/> property.
/// Important: Do *not* catch this exception. Rather, fix the underlying issue that caused the error.
/// </summary>
public class GraphicsErrorException : GraphicsException
{
/// <summary>
/// Constructs a new GraphicsErrorException instance with the specified error message.
/// </summary>
/// <param name="message"></param>
public GraphicsErrorException(string message) : base(message) { }
}
}

View file

@ -10,37 +10,15 @@ using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Graphics
namespace OpenTK
{
/// <summary>Represents errors related to unavailable graphics parameters..</summary>
public class GraphicsModeException : Exception
/// <summary>Represents errors related to Graphics operations.</summary>
public class GraphicsException : Exception
{
/// <summary>Constructs a new GraphicsModeException.</summary>
public GraphicsModeException() : base() { }
/// <summary>Constructs a new GraphicsModeException with the given error message.</summary>
public GraphicsModeException(string message) : base(message) { }
}
/// <summary>Represents errors related to a GraphicsContext.</summary>
public class GraphicsContextException : Exception
{
/// <summary>Constructs a new GraphicsContextException.</summary>
public GraphicsContextException() : base() { }
/// <summary>Constructs a new GraphicsContextException with the given error message..</summary>
public GraphicsContextException(string message) : base(message) { }
}
/// <summary>
/// Thrown when an operation that required GraphicsContext is performed, when no
/// GraphicsContext is current in the calling thread.
/// </summary>
public class GraphicsContextMissingException : GraphicsContextException
{
/// <summary>Constructs a new GraphicsContextMissingException.</summary>
public GraphicsContextMissingException()
: base(String.Format(
"No context is current in the calling thread (ThreadId: {0}).",
System.Threading.Thread.CurrentThread.ManagedThreadId))
{ }
/// <summary>Constructs a new GraphicsException.</summary>
public GraphicsException() : base() { }
/// <summary>Constructs a new GraphicsException with the specified excpetion message.</summary>
/// <param name="message"></param>
public GraphicsException(string message) : base(message) { }
}
}

View file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Graphics
{
/// <summary>
/// Represents errors related to unavailable graphics parameters.
/// </summary>
public class GraphicsModeException : Exception
{
/// <summary>
/// Constructs a new GraphicsModeException.
/// </summary>
public GraphicsModeException() : base() { }
/// <summary>
/// Constructs a new GraphicsModeException with the given error message.
/// </summary>
public GraphicsModeException(string message) : base(message) { }
}
}

View file

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using OpenTK.Graphics;
namespace OpenTK.Platform
{
// Provides the foundation for all desktop IGraphicsContext implementations.
abstract class DesktopGraphicsContext : IGraphicsContext
{
#region IGraphicsContext Members
public abstract void SwapBuffers();
public abstract void MakeCurrent(IWindowInfo window);
public abstract bool IsCurrent { get; }
public abstract event DestroyEvent<IGraphicsContext> Destroy;
public abstract bool VSync { get; set; }
public abstract void Update(IWindowInfo window);
public abstract GraphicsMode GraphicsMode { get; }
public abstract bool ErrorChecking { get; set; }
#endregion
#region IDisposable Members
public abstract void Dispose();
#endregion
}
}

View file

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

View file

@ -28,6 +28,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Graphics;
using OpenTK.Platform.Windows;
namespace OpenTK.Platform.Egl
@ -35,14 +37,14 @@ namespace OpenTK.Platform.Egl
// EGL factory for the Windows platform.
class EglWinPlatformFactory : WinFactory
{
public override OpenTK.Graphics.IGraphicsContext CreateGLContext(OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, OpenTK.Graphics.IGraphicsContext shareContext, bool directRendering, int major, int minor, OpenTK.Graphics.GraphicsContextFlags flags)
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
{
WinWindowInfo win_win = (WinWindowInfo)window;
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(win_win.WindowHandle, new EGLDisplay(win_win.DeviceContext));
return new EglContext(mode, egl_win, shareContext, major, minor, flags);
}
public override OpenTK.Graphics.IGraphicsMode CreateGraphicsMode()
public override IGraphicsMode CreateGraphicsMode()
{
return new EglGraphicsMode();
}

View file

@ -10,7 +10,7 @@ using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Graphics
namespace OpenTK.Platform
{
internal interface IDisplayDeviceDriver
{

View file

@ -43,9 +43,9 @@ namespace OpenTK.Platform
IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags);
OpenTK.Graphics.GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext();
GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext();
OpenTK.Graphics.IGraphicsMode CreateGraphicsMode();
IGraphicsMode CreateGraphicsMode();
OpenTK.Input.IKeyboardDriver CreateKeyboardDriver();
}

View file

@ -17,7 +17,6 @@ namespace OpenTK.Platform.MacOS
{
using Carbon;
using Graphics;
using Graphics.OpenGL;
using AGLRendererInfo = IntPtr;
using AGLPixelFormat = IntPtr;
@ -412,8 +411,7 @@ namespace OpenTK.Platform.MacOS
void IGraphicsContextInternal.LoadAll()
{
GL.LoadAll();
Glu.LoadAll();
OpenTK.Graphics.OpenGL.GL.LoadAll();
}
ContextHandle IGraphicsContextInternal.Context

View file

@ -20,7 +20,7 @@ namespace OpenTK.Platform.MacOS
#region IGLControl Members
public OpenTK.Graphics.GraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
public GraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{
return new GraphicsContext(mode, WindowInfo, major, minor, flags);
}

View file

@ -605,14 +605,14 @@ namespace OpenTK.Platform.MacOS
#region INativeGLWindow Members
public void CreateWindow(int width, int height, OpenTK.Graphics.GraphicsMode mode, int major, int minor, GraphicsContextFlags flags, out OpenTK.Graphics.IGraphicsContext context)
public void CreateWindow(int width, int height, GraphicsMode mode, int major, int minor, GraphicsContextFlags flags, out IGraphicsContext context)
{
Rect r = new Rect(0, 0, (short)width, (short)height);
CreateNativeWindow(mWindowClass, mWindowAttrib, r);
Show();
this.context = new Graphics.GraphicsContext(mode, window, major, minor, flags);
this.context = new GraphicsContext(mode, window, major, minor, flags);
this.context.MakeCurrent(window);
context = this.context;

View file

@ -91,7 +91,7 @@ namespace OpenTK.Platform.MacOS
}
OpenTK.Graphics.DisplayDevice opentk_dev =
DisplayDevice opentk_dev =
new DisplayDevice(opentk_dev_current_res, primary, opentk_dev_available_res);
displayMap.Add(opentk_dev, currentDisplay);

View file

@ -13,6 +13,7 @@ using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Diagnostics;
using OpenTK.Graphics;
#endregion
@ -225,14 +226,14 @@ namespace OpenTK.Platform
/// <param name="minor">The minor OpenGL version number for this IGraphicsContext.</param>
/// <param name="flags">A bitwise collection of GraphicsContextFlags with specific options for this IGraphicsContext.</param>
/// <returns>A new IGraphicsContext instance.</returns>
public static Graphics.IGraphicsContext CreateGraphicsContext(
Graphics.GraphicsMode mode, IWindowInfo window,
int major, int minor, Graphics.GraphicsContextFlags flags)
public static IGraphicsContext CreateGraphicsContext(
GraphicsMode mode, IWindowInfo window,
int major, int minor, GraphicsContextFlags flags)
{
Graphics.GraphicsContext context = new Graphics.GraphicsContext(mode, window, major, minor, flags);
GraphicsContext context = new GraphicsContext(mode, window, major, minor, flags);
context.MakeCurrent(window);
(context as OpenTK.Graphics.IGraphicsContextInternal).LoadAll();
(context as IGraphicsContextInternal).LoadAll();
return context;
}
@ -245,8 +246,8 @@ namespace OpenTK.Platform
/// <param name="context">A new IGraphicsContext instance.</param>
/// <param name="info">An IWindowInfo instance for the specified cntrl.</param>
[Obsolete("Create the IWindowInfo object first by calling CreateWindowInfo, then use the CreateGraphicsContext overload which takes major, minor and flags parameters.")]
public static void CreateGraphicsContext(Graphics.GraphicsMode mode, Control cntrl,
out Graphics.IGraphicsContext context, out IWindowInfo info)
public static void CreateGraphicsContext(GraphicsMode mode, Control cntrl,
out IGraphicsContext context, out IWindowInfo info)
{
CreateGraphicsContext(mode, cntrl.Handle, out context, out info);
}
@ -259,15 +260,15 @@ namespace OpenTK.Platform
/// <param name="context">A new IGraphicsContext instance.</param>
/// <param name="info">An IWindowInfo instance for the specified ctrl.</param>
[Obsolete("Create the IWindowInfo object first by calling CreateWindowInfo, then use the CreateGraphicsContext overload which takes major, minor and flags parameters.")]
public static void CreateGraphicsContext(Graphics.GraphicsMode mode, IntPtr cntrlHandle,
out Graphics.IGraphicsContext context, out IWindowInfo info)
public static void CreateGraphicsContext(GraphicsMode mode, IntPtr cntrlHandle,
out IGraphicsContext context, out IWindowInfo info)
{
info = CreateWindowInfo(mode, cntrlHandle);
context = new Graphics.GraphicsContext(mode, info);
context = new GraphicsContext(mode, info);
context.MakeCurrent(info);
(context as OpenTK.Graphics.IGraphicsContextInternal).LoadAll();
(context as IGraphicsContextInternal).LoadAll();
}
#region --- CreateWindowInfo ---
@ -280,7 +281,7 @@ namespace OpenTK.Platform
/// <param name="mode">The desired GraphicsMode for this window.</param>
/// <param name="cntrl">A <see cref="System.Windows.Forms.Control"/> to get the IWindowInfo from.</param>
/// <returns></returns>
public static IWindowInfo CreateWindowInfo(Graphics.GraphicsMode mode, Control cntrl)
public static IWindowInfo CreateWindowInfo(GraphicsMode mode, Control cntrl)
{
return CreateWindowInfo(mode, cntrl.Handle);
}
@ -291,7 +292,7 @@ namespace OpenTK.Platform
/// <param name="mode">The desired GraphicsMode for this window.</param>
/// <param name="controlHandle">The handle to the control, obtained from Control.Handle.</param>
/// <returns></returns>
public static IWindowInfo CreateWindowInfo(Graphics.GraphicsMode mode, IntPtr controlHandle)
public static IWindowInfo CreateWindowInfo(GraphicsMode mode, IntPtr controlHandle)
{
if (Configuration.RunningOnWindows) return CreateWinWindowInfo(controlHandle);
else if (Configuration.RunningOnX11) return CreateX11WindowInfo(mode, controlHandle);
@ -304,7 +305,7 @@ namespace OpenTK.Platform
#region --- X11 Platform-specific implementation ---
private static IWindowInfo CreateX11WindowInfo(Graphics.GraphicsMode mode, IntPtr controlHandle)
private static IWindowInfo CreateX11WindowInfo(GraphicsMode mode, IntPtr controlHandle)
{
Platform.X11.X11WindowInfo window = new OpenTK.Platform.X11.X11WindowInfo();

View file

@ -19,8 +19,8 @@ namespace OpenTK.Platform.Windows
internal class WinDisplayDeviceDriver : IDisplayDeviceDriver
{
static object display_lock = new object();
static Dictionary<OpenTK.Graphics.DisplayDevice, string> available_device_names =
new Dictionary<OpenTK.Graphics.DisplayDevice, string>(); // Needed for ChangeDisplaySettingsEx
static Dictionary<DisplayDevice, string> available_device_names =
new Dictionary<DisplayDevice, string>(); // Needed for ChangeDisplaySettingsEx
#region --- Constructors ---
@ -35,7 +35,7 @@ namespace OpenTK.Platform.Windows
// and construct the device when every needed detail is available.
// The main DisplayDevice constructor adds the newly constructed device
// to the list of available devices.
OpenTK.Graphics.DisplayDevice opentk_dev;
DisplayDevice opentk_dev;
DisplayResolution opentk_dev_current_res = null;
List<DisplayResolution> opentk_dev_available_res = new List<DisplayResolution>();
bool opentk_dev_primary = false;
@ -78,7 +78,7 @@ namespace OpenTK.Platform.Windows
// Construct the OpenTK DisplayDevice through the accumulated parameters.
// The constructor will automatically add the DisplayDevice to the list
// of available devices.
opentk_dev = new OpenTK.Graphics.DisplayDevice(
opentk_dev = new DisplayDevice(
opentk_dev_current_res,
opentk_dev_primary,
opentk_dev_available_res);
@ -98,7 +98,7 @@ namespace OpenTK.Platform.Windows
#region public bool TryChangeResolution(OpenTK.Graphics.DisplayDevice device, DisplayResolution resolution)
public bool TryChangeResolution(OpenTK.Graphics.DisplayDevice device, DisplayResolution resolution)
public bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
{
DeviceMode mode = null;
@ -124,7 +124,7 @@ namespace OpenTK.Platform.Windows
#region public TryRestoreResolution TryRestoreResolution(OpenTK.Graphics.DisplayDevice device)
public bool TryRestoreResolution(OpenTK.Graphics.DisplayDevice device)
public bool TryRestoreResolution(DisplayDevice device)
{
return TryChangeResolution(device, null);
}

View file

@ -13,8 +13,8 @@ using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
#endregion
@ -254,7 +254,6 @@ namespace OpenTK.Platform.Windows
{
Wgl.LoadAll();
GL.LoadAll();
Glu.LoadAll();
vsync_supported = Wgl.Arb.SupportsExtension(this, "WGL_EXT_swap_control") &&
Wgl.Load("wglGetSwapIntervalEXT") && Wgl.Load("wglSwapIntervalEXT");

View file

@ -30,7 +30,7 @@ namespace OpenTK.Platform.X11
return new X11GLContext(mode, window, shareContext, directRendering, major, minor, flags);
}
public virtual OpenTK.Graphics.GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
public virtual GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext()
{
return (GraphicsContext.GetCurrentContextDelegate)delegate
{

View file

@ -327,8 +327,7 @@ namespace OpenTK.Platform.X11
void IGraphicsContextInternal.LoadAll()
{
GL.LoadAll();
Glu.LoadAll();
OpenTK.Graphics.OpenGL.GL.LoadAll();
Glx.LoadAll();
vsync_supported = this.GetAddress("glXSwapIntervalSGI") != IntPtr.Zero;
Debug.Print("Context supports vsync: {0}.", vsync_supported);

View file

@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("The Open Toolkit Library")]
[assembly: AssemblyDescription("Open source game development toolkit for .Net/Mono.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("The Open Toolkit Library")]
[assembly: AssemblyProduct("The Open Toolkit Library")]
[assembly: AssemblyCopyright("Copyright © 2006-2009 the Open Toolkit team")]
[assembly: AssemblyTrademark("OpenTK")]

View file

@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Graphics.OpenGL;
namespace OpenTK.Graphics

View file

@ -13,13 +13,13 @@ using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Diagnostics;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Platform;
namespace OpenTK.Graphics
{
using Graphics = System.Drawing.Graphics;
using PixelFormat = OpenTK.Graphics.PixelFormat;
using PixelFormat = OpenTK.Graphics.OpenGL.PixelFormat;
using System.Text.RegularExpressions;
[Obsolete("Use System.Drawing.Font instead")]
@ -382,7 +382,7 @@ namespace OpenTK.Graphics
}
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Alpha, texture_width, texture_height, 0,
OpenTK.Graphics.PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
OpenTK.Graphics.OpenGL.PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
}
#endregion
@ -426,7 +426,7 @@ namespace OpenTK.Graphics
GL.PixelStore(PixelStoreParameter.UnpackRowLength, bmp.Width);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, (int)rect.Left, (int)rect.Top,
rect.Width, rect.Height,
OpenTK.Graphics.PixelFormat.Rgba,
OpenTK.Graphics.OpenGL.PixelFormat.Rgba,
PixelType.UnsignedByte, bitmap_data.Scan0);
}
finally

View file

@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using OpenTK.Graphics.OpenGL;
namespace OpenTK.Graphics
{

View file

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Graphics.OpenGL;
namespace OpenTK.Graphics
{

View file

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using OpenTK.Graphics.OpenGL;
namespace OpenTK.Graphics.Text
{

View file

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Text;
using System.Drawing;
using OpenTK.Graphics.OpenGL;
namespace OpenTK.Graphics.Text
{
sealed class GL12TextOutputProvider : GL1TextOutputProvider

View file

@ -25,10 +25,11 @@
//
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System;
using OpenTK.Graphics.OpenGL;
namespace OpenTK.Graphics.Text
{

View file

@ -31,6 +31,7 @@ using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Diagnostics;
using OpenTK.Graphics.OpenGL;
namespace OpenTK.Graphics
{
@ -136,7 +137,7 @@ namespace OpenTK.Graphics
GL.TexSubImage2D(TextureTarget.Texture2D, mipLevel,
target.Left, target.Top,
target.Width, target.Height,
OpenTK.Graphics.PixelFormat.Bgra,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra,
PixelType.UnsignedByte, data.Scan0);
}
finally
@ -158,7 +159,7 @@ namespace OpenTK.Graphics
TextureRegion2D<int> region = new TextureRegion2D<int>(rect);
GL.GetTexImage(TextureTarget.Texture2D, mipLevel, PixelFormat.Bgra, PixelType.UnsignedByte, region.Data);
GL.GetTexImage(TextureTarget.Texture2D, mipLevel, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, region.Data);
return region;
}
@ -222,7 +223,7 @@ namespace OpenTK.Graphics
SetDefaultTextureParameters(id);
GL.TexImage2D(TextureTarget.Texture2D, 0, InternalFormat, Width, Height, 0,
OpenTK.Graphics.PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
OpenTK.Graphics.OpenGL.PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero);
return id;
}