mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 16:35:28 +00:00
Updated examples to reflect namespace change of DisplayMode and ColorMode.
Renamed T03_RotatingCube.cs to T03_Immediate_Mode_Cube.cs. Renamed T07_DisplayLists_Cube.cs to T07_Display_Lists_Flower.cs. Renamed Cube.cs to W02_Immediate_Mode_Cube.cs Updated colors in T10_GLSL_Cube and T03_Immediate_Mode_Cube Add S03_Stack_Imbalance.cs test. Add T01_Simple_Window.cs and T02_Resizable_Window.cs tutorials.
This commit is contained in:
parent
ac4bde2a2d
commit
e8ec478237
|
@ -59,7 +59,7 @@ namespace Examples.Tests
|
||||||
|
|
||||||
public S02_RawInput_Logger()
|
public S02_RawInput_Logger()
|
||||||
{
|
{
|
||||||
this.CreateWindow(new OpenTK.Platform.DisplayMode(100, 100));
|
this.CreateWindow(new DisplayMode(100, 100));
|
||||||
|
|
||||||
foreach (OpenTK.Input.Keyboard k in this.Keyboard)
|
foreach (OpenTK.Input.Keyboard k in this.Keyboard)
|
||||||
{
|
{
|
||||||
|
|
67
Source/Examples/Tests/S03_Stack_Imbalance.cs
Normal file
67
Source/Examples/Tests/S03_Stack_Imbalance.cs
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.OpenGL;
|
||||||
|
|
||||||
|
namespace Examples.Tests
|
||||||
|
{
|
||||||
|
public class S03_Stack_Imbalance : GameWindow//, IExample
|
||||||
|
{
|
||||||
|
public S03_Stack_Imbalance()
|
||||||
|
{
|
||||||
|
this.CreateWindow(new DisplayMode(800, 600));
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IExample Members
|
||||||
|
|
||||||
|
public void Launch()
|
||||||
|
{
|
||||||
|
this.Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected override void OnResize(OpenTK.Platform.ResizeEventArgs e)
|
||||||
|
{
|
||||||
|
GL.Ortho(-1.0, 1.0, -1.0, 1.0, 1.0, 32.0);
|
||||||
|
|
||||||
|
base.OnResize(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
float[] proj = new float[16];
|
||||||
|
public override void OnRenderFrame(EventArgs e)
|
||||||
|
{
|
||||||
|
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
GL.GetFloatv(GL.Enums.GetPName.PROJECTION_MATRIX, proj);
|
||||||
|
|
||||||
|
float sum = 0.0f;
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
sum += proj[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sum == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("GetFloatv did not return anything!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GL.Begin(GL.Enums.BeginMode.TRIANGLES);
|
||||||
|
|
||||||
|
GL.Color3(System.Drawing.Color.Chartreuse);
|
||||||
|
GL.Vertex3(-1.0, -1.0, 2.0);
|
||||||
|
GL.Color3(System.Drawing.Color.Crimson);
|
||||||
|
GL.Vertex3( 1.0, -1.0, 2.0);
|
||||||
|
GL.Color3(System.Drawing.Color.DarkGoldenrod);
|
||||||
|
GL.Vertex3( 0.0, 1.0, 2.0);
|
||||||
|
|
||||||
|
GL.End();
|
||||||
|
|
||||||
|
Context.SwapBuffers();
|
||||||
|
|
||||||
|
base.OnRenderFrame(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
59
Source/Examples/Tutorial/T01_Simple_Window.cs
Normal file
59
Source/Examples/Tutorial/T01_Simple_Window.cs
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#region --- License ---
|
||||||
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||||
|
* See license.txt for license info
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.OpenGL;
|
||||||
|
|
||||||
|
namespace Examples.Tutorial
|
||||||
|
{
|
||||||
|
public class T01_Simple_Window : GameWindow, IExample
|
||||||
|
{
|
||||||
|
public T01_Simple_Window()
|
||||||
|
{
|
||||||
|
this.CreateWindow(new DisplayMode(800, 600));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override the OnRenderFrame method to add your drawing code.
|
||||||
|
/// Do not forget to call base.OnRenderFrame() so that event listeners
|
||||||
|
/// will be notified every time a frame is drawn!
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">Not used.</param>
|
||||||
|
public override void OnRenderFrame(EventArgs e)
|
||||||
|
{
|
||||||
|
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
GL.Begin(GL.Enums.BeginMode.TRIANGLES);
|
||||||
|
|
||||||
|
GL.Color3(Color.SpringGreen);
|
||||||
|
GL.Vertex2(-1.0f, 1.0f);
|
||||||
|
GL.Color3(Color.SteelBlue);
|
||||||
|
GL.Vertex2(0.0f, -1.0f);
|
||||||
|
GL.Color3(Color.PeachPuff);
|
||||||
|
GL.Vertex2(1.0f, 1.0f);
|
||||||
|
|
||||||
|
GL.End();
|
||||||
|
|
||||||
|
Context.SwapBuffers();
|
||||||
|
|
||||||
|
base.OnRenderFrame(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IExample Members
|
||||||
|
|
||||||
|
public void Launch()
|
||||||
|
{
|
||||||
|
this.Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
76
Source/Examples/Tutorial/T02_Resizable_Window.cs
Normal file
76
Source/Examples/Tutorial/T02_Resizable_Window.cs
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
#region --- License ---
|
||||||
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||||
|
* See license.txt for license info
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.OpenGL;
|
||||||
|
|
||||||
|
namespace Examples.Tutorial
|
||||||
|
{
|
||||||
|
class T02_Resizable_Window : GameWindow, IExample
|
||||||
|
{
|
||||||
|
public T02_Resizable_Window()
|
||||||
|
{
|
||||||
|
this.CreateWindow(new DisplayMode(800, 600));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override the OnResize method to respond to window resize events.
|
||||||
|
/// Do not forget to call base.OnResize() so that event listeners
|
||||||
|
/// will be notified of window resize events!
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
protected override void OnResize(OpenTK.Platform.ResizeEventArgs e)
|
||||||
|
{
|
||||||
|
GL.Viewport(0, 0, e.Width, e.Height);
|
||||||
|
|
||||||
|
GL.MatrixMode(GL.Enums.MatrixMode.PROJECTION);
|
||||||
|
GL.LoadIdentity();
|
||||||
|
GL.Ortho(-1.0, 1.0, -1.0, 1.0, 0.0, 4.0);
|
||||||
|
|
||||||
|
base.OnResize(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override the OnRenderFrame method to add your drawing code.
|
||||||
|
/// Do not forget to call base.OnRenderFrame() so that event listeners
|
||||||
|
/// will be notified of frame rendering events!
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">Not used.</param>
|
||||||
|
public override void OnRenderFrame(EventArgs e)
|
||||||
|
{
|
||||||
|
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
GL.Begin(GL.Enums.BeginMode.TRIANGLES);
|
||||||
|
|
||||||
|
GL.Color3(Color.SpringGreen);
|
||||||
|
GL.Vertex2(-1.0f, 1.0f);
|
||||||
|
GL.Color3(Color.SteelBlue);
|
||||||
|
GL.Vertex2(0.0f, -1.0f);
|
||||||
|
GL.Color3(Color.PeachPuff);
|
||||||
|
GL.Vertex2(1.0f, 1.0f);
|
||||||
|
|
||||||
|
GL.End();
|
||||||
|
|
||||||
|
Context.SwapBuffers();
|
||||||
|
|
||||||
|
base.OnRenderFrame(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IExample Members
|
||||||
|
|
||||||
|
public void Launch()
|
||||||
|
{
|
||||||
|
this.Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,18 +9,18 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.OpenGL;
|
using OpenTK.OpenGL;
|
||||||
using OpenTK.Platform;
|
using OpenTK.Platform;
|
||||||
using Enums = OpenTK.OpenGL.GL.Enums;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
namespace Examples.Tutorial
|
namespace Examples.Tutorial
|
||||||
{
|
{
|
||||||
public class T03_RotatingCube : OpenTK.GameWindow, IExample
|
public class T03_Immediate_Mode_Cube : OpenTK.GameWindow, IExample
|
||||||
{
|
{
|
||||||
#region --- Fields ---
|
#region --- Fields ---
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace Examples.Tutorial
|
||||||
|
|
||||||
#region --- Constructors ---
|
#region --- Constructors ---
|
||||||
|
|
||||||
public T03_RotatingCube()
|
public T03_Immediate_Mode_Cube()
|
||||||
{
|
{
|
||||||
CreateWindow(new DisplayMode(800, 600));
|
CreateWindow(new DisplayMode(800, 600));
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ namespace Examples.Tutorial
|
||||||
base.OnLoad(e);
|
base.OnLoad(e);
|
||||||
|
|
||||||
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
|
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
|
||||||
GL.Enable(Enums.EnableCap.DEPTH_TEST);
|
GL.Enable(GL.Enums.EnableCap.DEPTH_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -69,7 +69,7 @@ namespace Examples.Tutorial
|
||||||
|
|
||||||
double ratio = e.Width / (double)e.Height;
|
double ratio = e.Width / (double)e.Height;
|
||||||
|
|
||||||
GL.MatrixMode(Enums.MatrixMode.PROJECTION);
|
GL.MatrixMode(GL.Enums.MatrixMode.PROJECTION);
|
||||||
GL.LoadIdentity();
|
GL.LoadIdentity();
|
||||||
Glu.Perspective(45.0, ratio, 1.0, 64.0);
|
Glu.Perspective(45.0, ratio, 1.0, 64.0);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ namespace Examples.Tutorial
|
||||||
Fullscreen = !Fullscreen;
|
Fullscreen = !Fullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL.MatrixMode(Enums.MatrixMode.MODELVIEW);
|
GL.MatrixMode(GL.Enums.MatrixMode.MODELVIEW);
|
||||||
GL.LoadIdentity();
|
GL.LoadIdentity();
|
||||||
Glu.LookAt(
|
Glu.LookAt(
|
||||||
0.0, 5.0, 5.0,
|
0.0, 5.0, 5.0,
|
||||||
|
@ -120,7 +120,7 @@ namespace Examples.Tutorial
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void OnRenderFrame(EventArgs e)
|
public override void OnRenderFrame(EventArgs e)
|
||||||
{
|
{
|
||||||
GL.Clear(Enums.ClearBufferMask.COLOR_BUFFER_BIT | Enums.ClearBufferMask.DEPTH_BUFFER_BIT);
|
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT | GL.Enums.ClearBufferMask.DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
DrawCube();
|
DrawCube();
|
||||||
|
|
||||||
|
@ -136,37 +136,38 @@ namespace Examples.Tutorial
|
||||||
{
|
{
|
||||||
GL.Begin(GL.Enums.BeginMode.QUADS);
|
GL.Begin(GL.Enums.BeginMode.QUADS);
|
||||||
|
|
||||||
GL.Color3(1.0f, 0.0f, 0.0f);
|
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.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(1.0f, 1.0f, 0.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.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(1.0f, 0.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.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(0.0f, 1.0f, 0.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.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(0.0f, 0.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.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(0.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.Vertex3(1.0f, 1.0f, 1.0f);
|
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
|
@ -23,7 +23,7 @@ using System.Threading;
|
||||||
|
|
||||||
namespace Examples.Tutorial
|
namespace Examples.Tutorial
|
||||||
{
|
{
|
||||||
public partial class T07_DisplayLists_Cube : GameWindow, IExample
|
public partial class T07_Display_Lists_Flower : GameWindow, IExample
|
||||||
{
|
{
|
||||||
#region --- Variables ---
|
#region --- Variables ---
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ namespace Examples.Tutorial
|
||||||
|
|
||||||
#region --- Constructors ---
|
#region --- Constructors ---
|
||||||
|
|
||||||
public T07_DisplayLists_Cube()
|
public T07_Display_Lists_Flower()
|
||||||
{
|
{
|
||||||
this.CreateWindow(new OpenTK.Platform.DisplayMode(800, 600));
|
this.CreateWindow(new DisplayMode(800, 600));
|
||||||
//Text =
|
//Text =
|
||||||
// "DisplayLists example (" +
|
// "DisplayLists example (" +
|
||||||
// GL.GetString(Enums.StringName.RENDERER) + " " +
|
// GL.GetString(Enums.StringName.RENDERER) + " " +
|
|
@ -50,40 +50,7 @@ namespace Examples.Tutorial
|
||||||
|
|
||||||
public T10_GLSL_Cube()
|
public T10_GLSL_Cube()
|
||||||
{
|
{
|
||||||
this.CreateWindow(new OpenTK.Platform.DisplayMode(800, 600));
|
this.CreateWindow(new DisplayMode(800, 600));
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region public void Launch()
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Launches this example.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Provides a simple way for the example launcher to launch the examples.
|
|
||||||
/// </remarks>
|
|
||||||
public void Launch()
|
|
||||||
{
|
|
||||||
Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region OnCreate
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This is the place to change window parameters.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="e">Not used.</param>
|
|
||||||
public override void OnCreate(EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnCreate(e);
|
|
||||||
|
|
||||||
//Text =
|
|
||||||
// GL.GetString(Enums.StringName.VENDOR) + " " +
|
|
||||||
// GL.GetString(Enums.StringName.RENDERER) + " " +
|
|
||||||
// GL.GetString(Enums.StringName.VERSION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -224,37 +191,38 @@ namespace Examples.Tutorial
|
||||||
{
|
{
|
||||||
GL.Begin(GL.Enums.BeginMode.QUADS);
|
GL.Begin(GL.Enums.BeginMode.QUADS);
|
||||||
|
|
||||||
GL.Color3(1.0f, 0.0f, 0.0f);
|
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.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(1.0f, 1.0f, 0.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.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(1.0f, 0.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.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(0.0f, 1.0f, 0.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.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(0.0f, 0.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.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(0.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.Vertex3(1.0f, 1.0f, 1.0f);
|
GL.Vertex3(1.0f, 1.0f, 1.0f);
|
||||||
|
@ -264,5 +232,20 @@ namespace Examples.Tutorial
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region public void Launch()
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Launches this example.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Provides a simple way for the example launcher to launch the examples.
|
||||||
|
/// </remarks>
|
||||||
|
public void Launch()
|
||||||
|
{
|
||||||
|
Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,6 @@ namespace Examples.WinForms
|
||||||
System.Diagnostics.Trace.WriteLine("Exception during initialization, aborting: {0}", e.ToString());
|
System.Diagnostics.Trace.WriteLine("Exception during initialization, aborting: {0}", e.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ShowDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
protected override void OnLoad(EventArgs e)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace Examples.WinForms
|
namespace Examples.WinForms
|
||||||
{
|
{
|
||||||
partial class Cube
|
partial class W02_Immediate_Mode_Cube
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
|
@ -24,28 +24,51 @@ using System.Threading;
|
||||||
|
|
||||||
namespace Examples.WinForms
|
namespace Examples.WinForms
|
||||||
{
|
{
|
||||||
public partial class Cube : Form, IExample
|
public partial class W02_Immediate_Mode_Cube : Form, IExample
|
||||||
{
|
{
|
||||||
static float angle;
|
static float angle;
|
||||||
|
|
||||||
#region --- Constructor ---
|
#region --- Constructor ---
|
||||||
|
|
||||||
public Cube()
|
public W02_Immediate_Mode_Cube()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.ShowDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Closing event
|
#region OnLoad
|
||||||
|
|
||||||
|
protected override void OnLoad(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLoad(e);
|
||||||
|
|
||||||
|
glControl.KeyDown += new KeyEventHandler(glControl_KeyDown);
|
||||||
|
glControl.Resize += new EventHandler(glControl_Resize);
|
||||||
|
glControl.Paint += new PaintEventHandler(glControl_Paint);
|
||||||
|
|
||||||
|
glControl.CreateContext();
|
||||||
|
|
||||||
|
Text =
|
||||||
|
GL.GetString(GL.Enums.StringName.VENDOR) + " " +
|
||||||
|
GL.GetString(GL.Enums.StringName.RENDERER) + " " +
|
||||||
|
GL.GetString(GL.Enums.StringName.VERSION);
|
||||||
|
|
||||||
|
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
|
||||||
|
GL.Enable(GL.Enums.EnableCap.DEPTH_TEST);
|
||||||
|
|
||||||
|
Application.Idle += Application_Idle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region OnClosing
|
||||||
|
|
||||||
protected override void OnClosing(CancelEventArgs e)
|
protected override void OnClosing(CancelEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnClosing(e);
|
|
||||||
|
|
||||||
Application.Idle -= Application_Idle;
|
Application.Idle -= Application_Idle;
|
||||||
|
|
||||||
|
base.OnClosing(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -86,31 +109,6 @@ namespace Examples.WinForms
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Load event handler
|
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnLoad(e);
|
|
||||||
|
|
||||||
glControl.KeyDown += new KeyEventHandler(glControl_KeyDown);
|
|
||||||
glControl.Resize += new EventHandler(glControl_Resize);
|
|
||||||
glControl.Paint += new PaintEventHandler(glControl_Paint);
|
|
||||||
|
|
||||||
glControl.CreateContext();
|
|
||||||
|
|
||||||
Text =
|
|
||||||
GL.GetString(GL.Enums.StringName.VENDOR) + " " +
|
|
||||||
GL.GetString(GL.Enums.StringName.RENDERER) + " " +
|
|
||||||
GL.GetString(GL.Enums.StringName.VERSION);
|
|
||||||
|
|
||||||
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
|
|
||||||
GL.Enable(GL.Enums.EnableCap.DEPTH_TEST);
|
|
||||||
|
|
||||||
Application.Idle += Application_Idle;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region GLControl.Resize event handler
|
#region GLControl.Resize event handler
|
||||||
|
|
||||||
void glControl_Resize(object sender, EventArgs e)
|
void glControl_Resize(object sender, EventArgs e)
|
Loading…
Reference in a new issue