This commit is contained in:
the_fiddler 2006-11-05 11:50:08 +00:00
parent 5d71876f8e
commit 24c3a6b290
31 changed files with 539 additions and 557 deletions

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

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

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

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

View file

@ -1,7 +1,3 @@
cd..
Build\Prebuild /target nant /file prebuild.xml
NAnt.exe
rem Copying files to output directory
xcopy Source\OpenGL\Bind\bin\Release\*.exe Binaries\Release\Exe\*.* /Q /Y
@ -14,6 +10,7 @@ xcopy Source\Platform\X11\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y
xcopy Source\Framework\bin\Release\*.dll Binaries\Release\Libraries\*.* /Q /Y
xcopy Source\Examples\OpenGL\Basic\Lesson01\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y
xcopy Source\Examples\OpenGL\Basic\DisplayLists\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y
xcopy Source\Examples\OpenGL\Basic\NoFramework\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y
xcopy Source\Examples\OpenGL\Basic\QueryDisplayModes\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y
xcopy Source\Examples\OpenGL\GLSL\Lesson01\bin\Release\*.exe Binaries\Release\Examples\*.* /Q /Y

View file

@ -1,14 +1,15 @@
================================================================================
OpenTK 0.3.5 alpha Release notes
OpenTK 0.3.6 WIP alpha Release notes
IMPORTANT: This release is not only intended for testing and experimentation, NOT for development. Use at your own risk! (see below for the reasons)
--------------------------------------------------------------------------------
This release introduces Linux support. Thanks to Erik's code you can now write a project under Linux/Mono and run it under Windows/.Net without changing a single line of code!
This is the first release to implement High-level OpenGL bindings. Highlights:
Moreover, the structure of the OpenTK.OpenGL.GL class has been changed. Only the OpenGL core functions (versions 1.0-2.1) are directly exposed now in the GL class - the extension functions will reside in new structures named after the extension categories (for example GL.Arb, GL.Ext, GL.NV, GL.Ati etc). This change will make extension functions more discoverable. Extensions are currently disabled, until some internal changes are complete in OpenTK.OpenGL.Bind to allow for this change.
OpenTK.OpenGL (High level): DisplayList.
OpenTK.Examples: OpenGL.Basic.DisplayLists
--------------------------------------------------------------------------------
@ -23,25 +24,25 @@ For the bleeding edge code, do a svn checkout at https://svn.sourceforge.net/svn
The version number for this release is
Major: 0
Minor: 3
Release: 5
Revision: 0
Release: 6
Revision: 1
The odd minor version number denotes that this is a WIP (Work In Progress). This means that the source and the public API (APplication Interface) changes rapidly from release to release.
This is an alpha release. This means it is not feature complete - more features are planned or are in currently in development. When all planned features are ready for testing, this package will move to the beta phase, were the focus will change to testing and bug-fixing.
Missing features include Linux support and more fine-grained window and context management. Also expect the naming scheme to change over the next few versions.
Missing features include more fine-grained window and context management, several High-level OpenGL bindings and several other things. Also expect the naming scheme to change over the next few versions.
================================================================================
This package contains the source for:
OpenTK.OpenGL (0.3.5)
OpenTK.OpenGL (0.3.6.1)
OpenTK.OpenGL.Bind (0.7.7.0)
OpenTK.Framework (0.3.2.0)
OpenTK.Framework (0.3.3.1)
OpenTK.Platform.Windows (0.1.1.0)
OpenTK.Platform.X11 (0.1.1.0)
OpenTK.OpenGL.Examples.Basic (Lesson01, NoFramework, QueryDisplayModes)
OpenTK.OpenGL.Examples.Basic (Lesson01, DisplayLists, NoFramework, QueryDisplayModes)
OpenTK.OpenGL.Examples.GLSL (Lesson01)
================================================================================

View file

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

View file

@ -1,3 +1,9 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Erik Ylvisaker and Stephen Apostolopoulos.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Windows.Forms;
@ -5,11 +11,25 @@ using OpenTK.OpenGL;
namespace Lesson01
{
public class Cube : OpenTK.Frameworks.Framework
public class Cube : OpenTK.Framework
{
static float angle;
#region Entry point
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
new Cube().Run();
}
#endregion
#region Load event handler
protected override void OnLoad(object sender, EventArgs e)
{
@ -134,24 +154,11 @@ namespace Lesson01
GL.Color3f(0, 1, 1);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.End();
}
#endregion
#region Entry point
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
new Cube().Run();
}
#endregion
}
}

View file

@ -1,9 +1,11 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
#region --- Using Directives ---
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -11,13 +13,17 @@ using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using OpenTK;
using OpenTK.OpenGL;
#endregion --- Using Directives ---
namespace OpenTK.Examples.OpenGL.GLSL
{
public class Cube : OpenTK.Frameworks.Framework
public class Cube : Framework
{
#region --- Variables ---
#region Shaders
string[] vertex_shader_source =
@ -37,7 +43,73 @@ namespace OpenTK.Examples.OpenGL.GLSL
static float angle;
#region Load event handler
#endregion --- Variables ---
#region --- Methods ---
#region Entry point
[STAThread]
static void Main()
{
new Cube().Run();
}
#endregion
#region DrawCube
public void DrawCube()
{
GL.Begin(Enums.BeginMode.QUADS);
GL.Color3f(1, 0, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Color3f(1, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Color3f(1, 0, 1);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Color3f(0, 0, 1);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 1);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.End();
}
#endregion
#endregion --- Methods ---
#region --- Event Handlers ---
#region OnLoad
protected override void OnLoad(object sender, EventArgs e)
{
base.OnLoad(sender, e);
@ -88,16 +160,15 @@ namespace OpenTK.Examples.OpenGL.GLSL
OnResize(sender, e);
}
#endregion
#region Resize event handler
#region OnResize
protected override void OnResize(object sender, EventArgs e)
{
base.OnResize(sender, e);
// if (this.Context == null)
// return;
if (ClientSize.Height == 0)
ClientSize = new System.Drawing.Size(ClientSize.Width, 1);
@ -105,18 +176,15 @@ namespace OpenTK.Examples.OpenGL.GLSL
double ratio = 0.0;
ratio = ClientSize.Width / (double)ClientSize.Height;
//if (ClientSize.Width > ClientSize.Height)
// ratio = ClientSize.Width / (double)ClientSize.Height;
//else
// ratio = ClientSize.Height / (double)ClientSize.Width;
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
Glu.Perspective(45.0, ratio, 1.0, 64.0);
}
#endregion
#region Paint event handler
#region OnPaint
protected override void OnPaint()
{
@ -141,7 +209,7 @@ namespace OpenTK.Examples.OpenGL.GLSL
#endregion
#region KeyDown event handler
#region OnKeyDown
protected override void OnKeyDown(object sender, KeyEventArgs e)
{
@ -161,62 +229,6 @@ namespace OpenTK.Examples.OpenGL.GLSL
#endregion
#region DrawCube
public void DrawCube()
{
GL.Begin(Enums.BeginMode.QUADS);
GL.Color3f(1, 0, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Color3f(1, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Color3f(1, 0, 1);
GL.Vertex3f(-1.0f, -1.0f, -1.0f);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 0);
GL.Vertex3f(-1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Color3f(0, 0, 1);
GL.Vertex3f(-1.0f, 1.0f, -1.0f);
GL.Vertex3f(-1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Color3f(0, 1, 1);
GL.Vertex3f(1.0f, -1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, -1.0f);
GL.Vertex3f(1.0f, 1.0f, 1.0f);
GL.Vertex3f(1.0f, -1.0f, 1.0f);
GL.End();
}
#endregion
#region Entry point
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
new Cube().Run();
}
#endregion
#endregion --- Event Handlers ---
}
}

View file

@ -1,7 +1,6 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* Contributions from Erik Ylvisaker
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos and Erik Ylvisaker.
*/
#endregion
@ -13,22 +12,29 @@ using System.Drawing;
using System.Threading;
using OpenTK.Platform.Windows;
using System.Runtime.InteropServices;
using OpenTK.OpenGL.Platform;
using OpenTK.OpenGL;
namespace OpenTK.Frameworks
namespace OpenTK
{
public class Framework : IDisposable
{
#region --- Private variables ---
private Form activeForm;
private GLContext activeContext;
private PlatformSpecific platform;
private OpenGL.ColorDepth _color_depth;
private int _z_depth;
private int _stencil_depth;
private OpenGL.ColorDepth colorDepth;
private int zDepth;
private int stencilDepth;
private string text = "OpenTK Windows application";
private string text = "OpenTK application";
#endregion
Application.MessageLoopCallback MessageLoop;
#region --- Public Properties ---
@ -37,11 +43,13 @@ namespace OpenTK.Frameworks
get { return activeForm; }
}
public GLContext ActiveContext
{
get { return activeContext; }
private set { activeContext = value; }
}
public string Text
{
get { return text; }
@ -53,21 +61,25 @@ namespace OpenTK.Frameworks
activeForm.Text = value;
}
}
public Size ClientSize
{
get { return ActiveForm.ClientSize; }
set { activeForm.ClientSize = value; }
}
public int Width
{
get { return ClientSize.Width; }
set { ClientSize = new Size(value, ClientSize.Height); }
}
public int Height
{
get { return ClientSize.Height; }
set { ClientSize = new Size(ClientSize.Width, value); }
}
public bool IsFullscreen
{
get
@ -78,18 +90,20 @@ namespace OpenTK.Frameworks
public OpenGL.ColorDepth ColorDepth
{
get { return _color_depth; }
private set { _color_depth = value; }
get { return colorDepth; }
private set { colorDepth = value; }
}
public int ZDepth
{
get { return _z_depth; }
set { _z_depth = value; }
get { return zDepth; }
set { zDepth = value; }
}
public int StencilDepth
{
get { return _stencil_depth; }
set { _stencil_depth = value; }
get { return stencilDepth; }
set { stencilDepth = value; }
}
#endregion
@ -97,11 +111,22 @@ namespace OpenTK.Frameworks
#region --- Creation and Destruction ---
/// <summary>
/// Constructs a Framework object.
/// Constructs a Framework object with default (safe) parameters.
/// </summary>
public Framework()
: this(null, 800, 600, new OpenTK.OpenGL.ColorDepth(8, 8, 8, 8), 16, 0, false)
: this(null, 640, 480, new OpenTK.OpenGL.ColorDepth(8, 8, 8, 8), 16, 0, false)
{ }
/// <summary>
/// Construcs a Framework object with the given parameters.
/// </summary>
/// <param name="title">The Title of the Form.</param>
/// <param name="width">The Width of the Form.</param>
/// <param name="height">The Height of the Form.</param>
/// <param name="color">The ColorDepth of the OpenGL Context.</param>
/// <param name="depth">The ZDepth of the OpenGL Context.</param>
/// <param name="stencil">The StencilDepth of the OpenGL Context.</param>
/// <param name="fullscreen">The Fullscreen property of the Form.</param>
public Framework(string title, int width, int height, OpenTK.OpenGL.ColorDepth color,
int depth, int stencil, bool fullscreen)
{
@ -132,6 +157,7 @@ namespace OpenTK.Frameworks
activeContext.Dispose();
activeContext = null;
}
if (activeForm != null)
{
activeForm.Dispose();
@ -161,6 +187,10 @@ namespace OpenTK.Frameworks
else
CreateWindowedDisplay(width, height);
//Application.Idle += this.OnIdle;
//MessageLoop = new Application.MessageLoopCallback(MainLoop);
//Application.RegisterMessageLoop(MessageLoop);
System.Console.WriteLine("Done Initializing.");
}
@ -177,9 +207,12 @@ namespace OpenTK.Frameworks
AttachEvents(activeForm);
activeForm.Show();
activeForm.ClientSize = new Size(width, height);
activeForm.TopMost = true;
activeForm.Enabled = true;
activeForm.Show();
}
private void CreateFullScreenDisplay(int width, int height)
@ -194,93 +227,119 @@ namespace OpenTK.Frameworks
AttachEvents(activeForm);
activeForm.Show();
activeForm.FormBorderStyle = FormBorderStyle.None;
activeForm.ClientSize = new Size(width, height);
activeForm.Location = Point.Empty;
activeContext.SetFullScreen(width, height, ColorDepth);
activeForm.TopMost = true;
activeForm.Enabled = true;
activeForm.Show();
activeContext.SetFullScreen(width, height, ColorDepth);
}
private void AttachEvents(Form frm)
{
frm.Load += new EventHandler(OnLoad);
frm.Resize += new EventHandler(OnResize);
frm.Paint += new PaintEventHandler(OnPaint);
frm.KeyDown += new KeyEventHandler(OnKeyDown);
frm.KeyUp += new KeyEventHandler(OnKeyUp);
frm.KeyPress += new KeyPressEventHandler(OnKeyPress);
frm.Click += new EventHandler(OnClick);
frm.MouseDown += new MouseEventHandler(OnMouseDown);
frm.MouseEnter += new EventHandler(OnMouseEnter);
frm.MouseHover += new EventHandler(OnMouseHover);
frm.MouseLeave += new EventHandler(OnMouseLeave);
frm.MouseMove += new MouseEventHandler(OnMouseMove);
frm.MouseUp += new MouseEventHandler(OnMouseUp);
frm.MouseWheel += new MouseEventHandler(OnMouseWheel);
frm.Load += this.OnLoad;
frm.Resize += this.OnResize;
frm.Paint += this.OnPaint;
frm.KeyDown += this.OnKeyDown;
frm.KeyUp += this.OnKeyUp;
frm.KeyPress += this.OnKeyPress;
frm.Click += this.OnClick;
frm.MouseDown += this.OnMouseDown;
frm.MouseEnter += this.OnMouseEnter;
frm.MouseHover += this.OnMouseHover;
frm.MouseLeave += this.OnMouseLeave;
frm.MouseMove += this.OnMouseMove;
frm.MouseUp += this.OnMouseUp;
frm.MouseWheel += this.OnMouseWheel;
}
#endregion
#region Events
#region --- Events ---
virtual protected void OnIdle(object sender, EventArgs e)
{
while (ActiveForm != null && platform.IsIdle())
{
if (!ActiveForm.Focused)
{
Thread.Sleep(100);
}
this.OnPaint();
}
}
virtual protected void OnMouseWheel(object sender, MouseEventArgs e)
{
if (MouseWheel != null)
MouseWheel(sender, e);
}
virtual protected void OnMouseUp(object sender, MouseEventArgs e)
{
if (MouseUp != null)
MouseUp(sender, e);
}
virtual protected void OnMouseMove(object sender, MouseEventArgs e)
{
if (MouseMove != null)
MouseMove(sender, e);
}
virtual protected void OnMouseLeave(object sender, EventArgs e)
{
if (MouseLeave != null)
MouseLeave(sender, e);
}
virtual protected void OnMouseHover(object sender, EventArgs e)
{
if (MouseHover != null)
MouseHover(sender, e);
}
virtual protected void OnMouseEnter(object sender, EventArgs e)
{
if (MouseEnter != null)
MouseEnter(sender, e);
}
virtual protected void OnMouseDown(object sender, MouseEventArgs e)
{
if (MouseDown != null)
MouseDown(sender, e);
}
virtual protected void OnClick(object sender, EventArgs e)
{
if (Click != null)
Click(sender, e);
}
virtual protected void OnKeyPress(object sender, KeyPressEventArgs e)
{
if (KeyPress != null)
KeyPress(sender, e);
}
virtual protected void OnKeyUp(object sender, KeyEventArgs e)
{
if (KeyUp != null)
KeyUp(sender, e);
}
virtual protected void OnKeyDown(object sender, KeyEventArgs e)
{
if (KeyDown != null)
KeyDown(sender, e);
}
private void OnPaint(object sender, PaintEventArgs e)
{
OnPaint();
@ -288,6 +347,7 @@ namespace OpenTK.Frameworks
if (Paint != null)
Paint(sender, e);
}
virtual protected void OnPaint()
{
}
@ -297,6 +357,7 @@ namespace OpenTK.Frameworks
if (Resize != null)
Resize(sender, e);
}
virtual protected void OnLoad(object sender, EventArgs e)
{
if (Load != null)
@ -322,7 +383,7 @@ namespace OpenTK.Frameworks
#endregion
#region Window Management
#region --- Window Management ---
private void DisposeForm()
{
@ -330,7 +391,7 @@ namespace OpenTK.Frameworks
activeContext.Dispose();
if (activeForm != null)
activeForm.Dispose();
activeContext = null;
activeForm = null;
}
@ -356,22 +417,29 @@ namespace OpenTK.Frameworks
#endregion
#region Render Loop
#region --- Main Loop ---
/// <summary>
/// Enters the Framework's main loop, updating state and rendering.
/// </summary>
public void Run()
{
// TODO: Find a better main loop. This is evil! (Probably a custom main loop or something based on the Idle event).
while (ActiveForm != null && ActiveForm.IsDisposed == false)
{
OnPaint(this, null);
if (platform.IsIdle() == false)
Application.DoEvents();
}
}
#endregion
}
#region Old Code
/*
public partial class Framework : Form, IDisposable
{
@ -621,4 +689,6 @@ namespace OpenTK.Frameworks
#endregion
}
* */
#endregion
}

View file

@ -1,22 +0,0 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
namespace OpenTK.Frameworks
{
internal abstract class FrameworkImplementation
{
public abstract void OnHandleCreated(object sender, EventArgs args);
public abstract bool IsIdle();
public abstract void Setup();
//abstract public void CloseWindow();
public abstract void SetResolution(int width, int height, OpenTK.OpenGL.ColorDepth color, bool fullscreen);
}
}

View file

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

View file

@ -17,8 +17,6 @@ namespace OpenTK
//this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // Buffer Control
//this.SetStyle(ControlStyles.ResizeRedraw, true); // Redraw On Resize
this.SetStyle(ControlStyles.UserPaint, true); // We'll Handle Painting Ourselves
InitializeComponent();
}
}
}

View file

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

View file

@ -35,5 +35,10 @@ namespace OpenTK
{
return false;
}
public virtual bool ProcessEvents()
{
return false;
}
}
}

View file

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

View file

@ -17,8 +17,6 @@ namespace OpenTK
//this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // Buffer Control
//this.SetStyle(ControlStyles.ResizeRedraw, true); // Redraw On Resize
this.SetStyle(ControlStyles.UserPaint, true); // We'll Handle Painting Ourselves
InitializeComponent();
}
}
}

View file

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

View file

@ -13,5 +13,12 @@ namespace OpenTK
WinApi.Message msg;
return !WinApi.PeekMessage(out msg, IntPtr.Zero, 0, 0, 0);
}
public override bool ProcessEvents()
{
return base.ProcessEvents();
}
}
}

View file

@ -1,9 +1,8 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
using System;
using System.Drawing;
using System.Globalization;

View file

@ -1,7 +1,6 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* Contributions from Erik Ylvisaker
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos and Erik Ylvisaker.
*/
#endregion

View file

@ -1,7 +1,6 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* Contributions from Erik Ylvisaker
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos and Erik Ylvisaker.
*/
#endregion

View file

@ -1,7 +1,6 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* Contributions from Erik Ylvisaker
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos and Erik Ylvisaker.
*/
#endregion

View file

@ -1,6 +1,6 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
@ -78,6 +78,5 @@ namespace OpenTK.OpenGL
}
#endregion
}
}

View file

@ -1,3 +1,9 @@
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
@ -27,7 +33,7 @@ namespace OpenTK.OpenGL
private static Delegate MacOSGetAddress(string function_string, Type function_type)
{
throw new NotImplementedException("THis platform is not supported yet. Sorry for the inconvenience.");
throw new NotImplementedException("This platform is not supported yet. Sorry for the inconvenience.");
}
}
}

View file

@ -1,6 +1,8 @@
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion
using System;
using System.Collections.Generic;

View file

@ -1,7 +1,6 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* Contributions from Erik Ylvisaker
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos and Erik Ylvisaker.
*/
#endregion

View file

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

View file

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.3.4.0")]
[assembly: AssemblyFileVersion("0.3.4.0")]
[assembly: AssemblyVersion("0.3.4.1")]
[assembly: AssemblyFileVersion("0.3.4.1")]

View file

@ -1,6 +1,6 @@
#region License
/* Copyright (c) 2006 Stephen Apostolopoulos
* See license.txt for license info
#region --- License ---
/* This source file is released under the MIT license. See License.txt for more information.
* Coded by Stephen Apostolopoulos.
*/
#endregion

View file

@ -1,16 +1,44 @@
Todo:
+ + + [In progress] Restore the Extensions.
+ + + Fully implement Framework class.
+ + + [In progress] Correct the Dispose methods to correctly clean resources (they should also call GC.SupressFinalize(true))
+ + + Add the CLS compliant attribute to the GL class.
+ + Document projects (source and manuals).
+ + [In progress] Add more constructors to the Context classes.
+ [In progress] Add more examples.
+ Find out what is needed for the MacOS platform (how to do function loading and window management without X11).
+ Add full bindings for glu, wgl, glx and agl (probably generated automatically).
+ Add the Math module.
+ Research and add the Input module.
+ Review and add the Timer module.
+ Review and add the OpenAL module.
+ [In progress] Clean up the code.
+ Add more platform bindings.
Generic Todos:
+ Check if resources are correctly cleaned.
OpenTK.OpenGL todos:
(High level)
+ VertexBufferObject class.
+ Error class.
+ Device class.
+ OpenGL function overloads.
(Low level)
+ Restore the Extensions.
+ Mark the GL class as CLS compliant.
+ Inline XML documentation.
+ Add support for the MacOS X platform.
+ Add complete Wgl, Glx, Agl and Glu bindings.
Context class:
+ Add more constructors.
+ Add support for the MacOS X platform.
Examples:
+ Homogenize the example layout.
+ Add comments were needed.
OpenTK.Math todos:
+ Start implementing the Math module.
OpenTK.Input todos:
+ Start researching the Input module.
OpenTK.Timer todos:
+ Start researching the Timer module.
OpenTK.OpenAL todos:
+ Start researching the OpenAL module.
+ Take a look at the OpenALDotNet wrapper.

View file

@ -1,3 +1,10 @@
OpenTK 0.3.5 -> 0.3.6
+ OpenTK.OpenGL (High level)
+ Added the DisplayList class.
+ OpenTK.Examples.OpenGL
+ Added the Basic.DisplayLists example.
OpenTK 0.3.4 -> 0.3.5
+ Thanks to Erik Ylvisaker's hard work, OpenTK now works under both Windows and X11.
+ The GLContext class now contains all needed code for mode switching.

View file

@ -164,6 +164,34 @@
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project name="OpenTK.Examples.OpenGL.Basic.DisplayLists" path=".\Source\Examples\OpenGL\Basic\DisplayLists" language="C#" type="WinExe">
<Configuration name="Debug">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Debug\Examples</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\..\..\..\..\Binaries\Release\Examples</OutputPath>
</Options>
</Configuration>
<Reference name="OpenTK.Framework"/>
<Reference name="OpenTK.OpenGL"/>
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
@ -190,6 +218,7 @@
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
@ -216,6 +245,7 @@
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
@ -242,6 +272,7 @@
<Reference name="System"/>
<Reference name="System.Drawing"/>
<Reference name="System.Windows.Forms"/>
<Reference name="System.Data"/>
<Files>
<Match path="." pattern="*.cs" recurse="true"/>