Updated examples to use GraphicsFormat instead of DisplayMode.
Improved S04_Input_Logger and W03_Extensions shutdown.
This commit is contained in:
parent
9abcb5d92e
commit
9145d0b6ca
5 changed files with 23 additions and 28 deletions
|
@ -29,7 +29,7 @@ namespace Examples.Tests
|
|||
{
|
||||
using (Form f = new Form())
|
||||
{
|
||||
context = new GraphicsContext(new OpenTK.DisplayMode(), new OpenTK.Platform.WindowInfo(f));
|
||||
//context = new GraphicsContext(new OpenTK.DisplayMode(), new OpenTK.Platform.WindowInfo(f));
|
||||
context.CreateContext();
|
||||
|
||||
Trace.WriteLine(String.Format("Number of calls: {0}", num_calls));
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Examples.Tests
|
|||
|
||||
void LaunchGameWindow()
|
||||
{
|
||||
hidden = new GameWindow(new DisplayMode(30, 30), "OpenTK | Hidden input window");
|
||||
hidden = new GameWindow("OpenTK | Hidden input window", 16, 16);
|
||||
hidden.Load += hidden_Load;
|
||||
hidden.Unload += hidden_Unload;
|
||||
hidden.Run(60.0, 1.0);
|
||||
|
@ -64,7 +64,7 @@ namespace Examples.Tests
|
|||
while (!start)
|
||||
Thread.Sleep(100);
|
||||
|
||||
WindowInfo info = new WindowInfo(this);
|
||||
//WindowInfo info = new WindowInfo(this);
|
||||
|
||||
keyboardListBoxes.Add(hidden.Keyboard.DeviceID, listBox1);
|
||||
|
||||
|
@ -84,7 +84,8 @@ namespace Examples.Tests
|
|||
{
|
||||
base.OnClosing(e);
|
||||
|
||||
hidden.Exit();
|
||||
hidden.ExitAsync();
|
||||
|
||||
while (hidden.Exists)
|
||||
Thread.Sleep(100);
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ namespace Examples.Tutorial
|
|||
MessageBox.Show("You need at least OpenGL 2.0 to run this example. Aborting.", "GLSL not supported",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
this.Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
GL.ClearColor(Color.SteelBlue);
|
||||
|
@ -159,11 +158,16 @@ namespace Examples.Tutorial
|
|||
|
||||
public override void OnUnload(EventArgs e)
|
||||
{
|
||||
GL.DeleteProgram(shader_program);
|
||||
GL.DeleteShader(fragment_shader_object);
|
||||
GL.DeleteShader(vertex_shader_object);
|
||||
GL.DeleteBuffers(1, ref vertex_buffer_object);
|
||||
GL.DeleteBuffers(1, ref element_buffer_object);
|
||||
if (shader_program != 0)
|
||||
GL.DeleteProgram(shader_program);
|
||||
if (fragment_shader_object != 0)
|
||||
GL.DeleteShader(fragment_shader_object);
|
||||
if (vertex_shader_object != 0)
|
||||
GL.DeleteShader(vertex_shader_object);
|
||||
if (vertex_buffer_object != 0)
|
||||
GL.DeleteBuffers(1, ref vertex_buffer_object);
|
||||
if (element_buffer_object != 0)
|
||||
GL.DeleteBuffers(1, ref element_buffer_object);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -27,16 +27,7 @@ namespace Examples.WinForms
|
|||
{
|
||||
public W01_First_Window()
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.Diagnostics.Trace.WriteLine("Exception during initialization, aborting: {0}", e.ToString());
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
|
|
@ -24,8 +24,7 @@ namespace Examples.WinForms
|
|||
[Example("Extensions", ExampleCategory.WinForms, 3)]
|
||||
public partial class W03_Extensions : Form
|
||||
{
|
||||
//GLControl glControl = new GLControl();
|
||||
GraphicsContext context;
|
||||
GLControl glControl = new GLControl(GraphicsFormat.Default);
|
||||
Type glClass;
|
||||
Type delegatesClass;
|
||||
Type importsClass;
|
||||
|
@ -40,19 +39,19 @@ namespace Examples.WinForms
|
|||
delegatesClass = glClass.GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
importsClass = glClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
|
||||
//glControl.CreateControl();
|
||||
glControl.CreateControl();
|
||||
Application.Idle += StartAsync;
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
glControl.Dispose();
|
||||
}
|
||||
|
||||
void StartAsync(object sender, EventArgs e)
|
||||
{
|
||||
Application.Idle -= StartAsync;
|
||||
|
||||
context = new GraphicsContext(new DisplayMode(), new OpenTK.Platform.WindowInfo(this));
|
||||
context.CreateContext();
|
||||
|
||||
//while (!glControl.Created)
|
||||
|
||||
driver =
|
||||
GL.GetString(StringName.Vendor) + " " +
|
||||
GL.GetString(StringName.Renderer) + " " +
|
||||
|
|
Loading…
Reference in a new issue