Added System.Drawing.Color overload to GL.ClearColor.

Updated W01 and W02 examples to use this overload.
Removed 'Paint' message from W01 Paint event.
This commit is contained in:
the_fiddler 2007-09-02 08:08:12 +00:00
parent 00463df2e8
commit 6ddd024fbf
4 changed files with 19 additions and 8 deletions

View file

@ -41,29 +41,30 @@ namespace Examples.WinForms
base.OnLoad(e);
glControl1.CreateContext();
GL.ClearColor(Color.Crimson);
}
private void redButton_Click(object sender, EventArgs e)
{
GL.ClearColor(0.7f, 0.0f, 0.0f, 0.0f);
GL.ClearColor(Color.Crimson);
glControl1.Invalidate();
}
private void greenButton_Click(object sender, EventArgs e)
{
GL.ClearColor(0.0f, 0.5f, 0.0f, 0.0f);
GL.ClearColor(Color.ForestGreen);
glControl1.Invalidate();
}
private void blueButton_Click(object sender, EventArgs e)
{
GL.ClearColor(0.0f, 0.0f, 0.7f, 0.0f);
GL.ClearColor(Color.RoyalBlue);
glControl1.Invalidate();
}
private void glControl1_Paint(object sender, PaintEventArgs e)
{
System.Diagnostics.Debug.Print("Paint");
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT);
glControl1.SwapBuffers();
}

View file

@ -33,21 +33,22 @@
//
// glControl
//
this.glControl.BackColor = System.Drawing.Color.MidnightBlue;
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;
//
// Cube
// W02_Immediate_Mode_Cube
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(624, 444);
this.Controls.Add(this.glControl);
this.Name = "Cube";
this.Name = "W02_Immediate_Mode_Cube";
this.Text = "Cube";
this.ResumeLayout(false);

View file

@ -54,7 +54,7 @@ namespace Examples.WinForms
GL.GetString(GL.Enums.StringName.RENDERER) + " " +
GL.GetString(GL.Enums.StringName.VERSION);
GL.ClearColor(0.1f, 0.1f, 0.5f, 0.0f);
GL.ClearColor(Color.MidnightBlue);
GL.Enable(GL.Enums.EnableCap.DEPTH_TEST);
Application.Idle += Application_Idle;

View file

@ -298,5 +298,14 @@ namespace OpenTK.OpenGL
}
#endregion
#region public static void ClearColor() overloads
public static void ClearColor(System.Drawing.Color color)
{
ClearColor(color.R/255.0f, color.G/255.0f, color.B/255.0f, color.A/255.0f);
}
#endregion
}
}