Removed the glControl.CreateControl() calls.
This commit is contained in:
parent
65e2c7830c
commit
605225822a
5 changed files with 21 additions and 22 deletions
|
@ -40,7 +40,6 @@
|
|||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.glControl1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.glControl1.Fullscreen = false;
|
||||
this.glControl1.Location = new System.Drawing.Point(1, 0);
|
||||
this.glControl1.Name = "glControl1";
|
||||
this.glControl1.Size = new System.Drawing.Size(629, 565);
|
||||
|
|
|
@ -41,8 +41,6 @@ namespace Examples.WinForms
|
|||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
glControl1.CreateContext();
|
||||
|
||||
GL.ClearColor(Color.Crimson);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,12 +35,12 @@
|
|||
//
|
||||
this.glControl.BackColor = System.Drawing.Color.Black;
|
||||
this.glControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.glControl.Fullscreen = false;
|
||||
this.glControl.Location = new System.Drawing.Point(0, 0);
|
||||
this.glControl.Name = "glControl";
|
||||
this.glControl.Size = new System.Drawing.Size(624, 444);
|
||||
this.glControl.TabIndex = 0;
|
||||
this.glControl.Visible = false;
|
||||
this.glControl.VSync = false;
|
||||
this.glControl.Layout += new System.Windows.Forms.LayoutEventHandler(this.glControl_Layout);
|
||||
//
|
||||
// W02_Immediate_Mode_Cube
|
||||
//
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Examples.WinForms
|
|||
{
|
||||
public partial class W02_Immediate_Mode_Cube : Form, IExample
|
||||
{
|
||||
static float angle;
|
||||
static float angle = 0.0f;
|
||||
|
||||
#region --- Constructor ---
|
||||
|
||||
|
@ -44,11 +44,9 @@ namespace Examples.WinForms
|
|||
base.OnLoad(e);
|
||||
|
||||
glControl.KeyDown += new KeyEventHandler(glControl_KeyDown);
|
||||
glControl.Resize += new EventHandler(glControl_Resize);
|
||||
//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) + " " +
|
||||
|
@ -58,6 +56,8 @@ namespace Examples.WinForms
|
|||
GL.Enable(GL.Enums.EnableCap.DEPTH_TEST);
|
||||
|
||||
Application.Idle += Application_Idle;
|
||||
|
||||
//glControl_Resize(glControl, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -103,8 +103,7 @@ namespace Examples.WinForms
|
|||
|
||||
DrawCube();
|
||||
|
||||
glControl.Context.SwapBuffers();
|
||||
Thread.Sleep(0);
|
||||
glControl.SwapBuffers();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -134,12 +133,6 @@ namespace Examples.WinForms
|
|||
|
||||
void glControl_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Alt && e.Shift)
|
||||
{
|
||||
//this.SetResolution(this.Width, this.Height, this.ColorDepth, !this.IsFullscreen);
|
||||
glControl.Fullscreen = !glControl.Fullscreen;
|
||||
}
|
||||
|
||||
switch (e.KeyData)
|
||||
{
|
||||
case Keys.Escape:
|
||||
|
@ -215,5 +208,10 @@ namespace Examples.WinForms
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void glControl_Layout(object sender, LayoutEventArgs e)
|
||||
{
|
||||
glControl_Resize(sender, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,14 +38,13 @@ namespace Examples.WinForms
|
|||
delegatesClass = glClass.GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
importsClass = glClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
|
||||
Application.Idle += StartAsync;
|
||||
glControl.Load += new EventHandler(glControl_Load);
|
||||
glControl.CreateControl();
|
||||
}
|
||||
|
||||
void StartAsync(object sender, EventArgs e)
|
||||
void glControl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Application.Idle -= StartAsync;
|
||||
|
||||
glControl.CreateContext();
|
||||
Application.Idle += StartAsync;
|
||||
|
||||
driver =
|
||||
GL.GetString(GL.Enums.StringName.VENDOR) + " " +
|
||||
|
@ -54,6 +53,11 @@ namespace Examples.WinForms
|
|||
|
||||
all = delegatesClass.GetFields(BindingFlags.Static | BindingFlags.NonPublic).Length;
|
||||
this.Text = String.Format("Loading {0} functions...", all);
|
||||
}
|
||||
|
||||
void StartAsync(object sender, EventArgs e)
|
||||
{
|
||||
Application.Idle -= StartAsync;
|
||||
|
||||
this.backgroundWorker1.RunWorkerAsync();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue