Opentk/Source/Utilities/Fonts/DisplayListTextPrinter.cs

59 lines
1.4 KiB
C#
Raw Normal View History

2007-11-08 15:56:19 +00:00
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info
*/
#endregion
using System;
2007-11-06 20:59:15 +00:00
using System.Collections.Generic;
using System.Text;
using OpenTK.Graphics.OpenGL;
using OpenTK.Math;
2007-11-06 20:59:15 +00:00
namespace OpenTK.Graphics
2007-11-06 20:59:15 +00:00
{
/// <summary>
/// Provides text printing through OpenGL 1.1 Display Lists.
/// </summary>
[Obsolete()]
2007-11-06 20:59:15 +00:00
class DisplayListTextPrinter : ITextPrinterImplementation
{
#region IPrinter Members
public TextHandle Load(Vector2[] vertices, ushort[] indices, int index_count)
2007-11-06 20:59:15 +00:00
{
DisplayListTextHandle handle = new DisplayListTextHandle(GL.GenLists(1));
GL.NewList(handle.Handle, ListMode.Compile);
2007-11-06 20:59:15 +00:00
this.Draw(vertices, indices, index_count);
2007-11-06 20:59:15 +00:00
GL.EndList();
return handle;
}
public void Draw(TextHandle handle)
{
GL.CallList(handle.Handle);
}
public void Draw(Vector2[] vertices, ushort[] indices, int index_count)
{
GL.Begin(BeginMode.Triangles);
for (int i = 0; i < index_count; i++)
//foreach (ushort index in indices)
{
GL.TexCoord2(vertices[indices[i] + 1]);
GL.Vertex2(vertices[indices[i]]);
}
GL.End();
}
2007-11-06 20:59:15 +00:00
#endregion
}
}