Temporarily removed font rendering.

This commit is contained in:
the_fiddler 2007-10-26 15:55:07 +00:00
parent 210122454c
commit bf95f9c3c6
2 changed files with 40 additions and 9 deletions

View file

@ -12,6 +12,7 @@ using System.Diagnostics;
using OpenTK; using OpenTK;
using OpenTK.OpenGL; using OpenTK.OpenGL;
using OpenTK.Fonts;
namespace Examples.Tutorial namespace Examples.Tutorial
{ {
@ -24,6 +25,8 @@ namespace Examples.Tutorial
{ {
} }
TextureFont sans = new TextureFont(new Font(FontFamily.GenericSansSerif, 16.0f));
#region OnLoad #region OnLoad
/// <summary> /// <summary>
@ -84,7 +87,7 @@ namespace Examples.Tutorial
public override void OnRenderFrame(RenderFrameEventArgs e) public override void OnRenderFrame(RenderFrameEventArgs e)
{ {
GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT); GL.Clear(GL.Enums.ClearBufferMask.COLOR_BUFFER_BIT);
/*
GL.Begin(GL.Enums.BeginMode.TRIANGLES); GL.Begin(GL.Enums.BeginMode.TRIANGLES);
GL.Color3(Color.SpringGreen); GL.Color3(Color.SpringGreen);
@ -96,6 +99,19 @@ namespace Examples.Tutorial
GL.End(); GL.End();
GL.PushMatrix();
*/
GL.MatrixMode(GL.Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
GL.Ortho(-1.0, 1.0, -1.0, 1.0, 0.0, 1.0);
GL.MatrixMode(GL.Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
GL.Translate(0.7f, 1.0f, 0.0f);
//sans.Print(RenderPeriod.ToString());
//GL.PopMatrix();
this.SwapBuffers(); this.SwapBuffers();
} }

View file

@ -14,6 +14,7 @@ using OpenTK;
using OpenTK.OpenGL; using OpenTK.OpenGL;
using System.Diagnostics; using System.Diagnostics;
using OpenTK.Input; using OpenTK.Input;
using OpenTK.Fonts;
namespace Examples.Tutorial namespace Examples.Tutorial
{ {
@ -26,12 +27,13 @@ namespace Examples.Tutorial
float angle = 0.0f; float angle = 0.0f;
Shapes.Shape shape = new Examples.Shapes.Plane(16, 16, 2.0f, 2.0f); Shapes.Shape shape = new Examples.Shapes.Plane(16, 16, 2.0f, 2.0f);
TextureFont sans = new TextureFont(new Font(FontFamily.GenericSansSerif, 32, FontStyle.Regular, GraphicsUnit.Pixel));
#region Constructor #region Constructor
public T02_Vertex_Arrays() : base(new DisplayMode(800, 600), "OpenTK Tutorial 2: Vertex Arrays") public T02_Vertex_Arrays() : base(new DisplayMode(800, 600), "OpenTK Tutorial 2: Vertex Arrays")
{ {
this.VSync = VSyncMode.On; //this.VSync = VSyncMode.On;
this.Keyboard.KeyUp += new KeyUpEvent(Keyboard_KeyUp); this.Keyboard.KeyUp += new KeyUpEvent(Keyboard_KeyUp);
} }
@ -55,7 +57,7 @@ namespace Examples.Tutorial
public override void OnLoad(EventArgs e) public override void OnLoad(EventArgs e)
{ {
base.OnLoad(e); GL.Enable(GL.Enums.EnableCap.TEXTURE_2D);
GL.ClearColor(Color.CadetBlue); GL.ClearColor(Color.CadetBlue);
GL.Enable(GL.Enums.EnableCap.DEPTH_TEST); GL.Enable(GL.Enums.EnableCap.DEPTH_TEST);
@ -158,13 +160,26 @@ namespace Examples.Tutorial
// GL.DrawArrays(GL.Enums.BeginMode.LINES, 0, shape.Vertices.Length); // GL.DrawArrays(GL.Enums.BeginMode.LINES, 0, shape.Vertices.Length);
GL.Begin(GL.Enums.BeginMode.TRIANGLES); //GL.Begin(GL.Enums.BeginMode.TRIANGLES);
GL.Vertex3(-1.0, -1.0, 5.0); //GL.Vertex3(-1.0, -1.0, 5.0);
GL.Vertex3(1.0, -1.0, 5.0); //GL.Vertex3(1.0, -1.0, 5.0);
GL.Vertex3(1.0, 1.0, 5.0); //GL.Vertex3(1.0, 1.0, 5.0);
GL.End(); //GL.End();
GL.PushMatrix();
GL.MatrixMode(GL.Enums.MatrixMode.PROJECTION);
GL.LoadIdentity();
GL.Ortho(-1.0, 1.0, -1.0, 1.0, 0.0, 1.0);
GL.MatrixMode(GL.Enums.MatrixMode.MODELVIEW);
GL.LoadIdentity();
//GL.Translate(0.7f, 1.0f, 0.0f);
//sans.Print(String.Format("{0:f1}", RenderFrequency));
GL.PopMatrix();
SwapBuffers(); SwapBuffers();
} }
@ -183,7 +198,7 @@ namespace Examples.Tutorial
{ {
// Lock UpdateFrame rate at 30Hz and RenderFrame rate 85Hz. // Lock UpdateFrame rate at 30Hz and RenderFrame rate 85Hz.
//Run(60.0, 85.0); //Run(60.0, 85.0);
Run(30.0); Run(30.0, 85.0);
} }
#endregion #endregion