Manually check for OpenGL version. Removed TextPrinter references.

This commit is contained in:
the_fiddler 2009-08-17 09:57:43 +00:00
parent 33e90d1b97
commit af7175ea0a
2 changed files with 8 additions and 12 deletions

View file

@ -54,10 +54,6 @@ namespace Examples.Tutorial
float UniformOffsetX = 1.8f; // fractal horizontal offset float UniformOffsetX = 1.8f; // fractal horizontal offset
float UniformOffsetY = 1.8f; // fractal vertical offset float UniformOffsetY = 1.8f; // fractal vertical offset
// Text drawing (for fps)
TextPrinter printer = new TextPrinter();
Font font = new Font(FontFamily.GenericSansSerif, 16.0f);
#endregion private Fields #endregion private Fields
#region OnLoad #region OnLoad
@ -69,7 +65,10 @@ namespace Examples.Tutorial
public override void OnLoad(EventArgs e) public override void OnLoad(EventArgs e)
{ {
// Check for necessary capabilities: // Check for necessary capabilities:
if (!GL.SupportsExtension("VERSION_2_0")) string version = GL.GetString(StringName.Version);
int major = (int)version[0];
int minor = (int)version[2];
if (major < 2)
{ {
MessageBox.Show("You need at least OpenGL 2.0 to run this example. Aborting.", MessageBox.Show("You need at least OpenGL 2.0 to run this example. Aborting.",
"GLSL not supported", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); "GLSL not supported", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
@ -290,12 +289,6 @@ namespace Examples.Tutorial
} }
GL.End(); GL.End();
// Then, render the fps:
GL.UseProgram(0);
printer.Begin();
printer.Print((1 / e.Time).ToString("F2"), font, Color.PaleGoldenrod, RectangleF.Empty, TextPrinterOptions.NoCache);
printer.End();
SwapBuffers(); SwapBuffers();
} }

View file

@ -61,7 +61,10 @@ namespace Examples.Tutorial
public override void OnLoad(EventArgs e) public override void OnLoad(EventArgs e)
{ {
// Check for necessary capabilities: // Check for necessary capabilities:
if (!GL.SupportsExtension("VERSION_2_0")) string version = GL.GetString(StringName.Version);
int major = (int)version[0];
int minor = (int)version[2];
if (major < 2)
{ {
MessageBox.Show("You need at least OpenGL 2.0 to run this example. Aborting.", "GLSL not supported", MessageBox.Show("You need at least OpenGL 2.0 to run this example. Aborting.", "GLSL not supported",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation); MessageBoxButtons.OK, MessageBoxIcon.Exclamation);