mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-07 14:10:37 +00:00
TextPrinter.Begin() / End() are no longer deprecated.
This commit is contained in:
parent
538198776b
commit
31e425f1cd
|
@ -128,14 +128,26 @@ namespace OpenTK.Graphics
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Obsolete
|
#region Begin
|
||||||
|
|
||||||
[Obsolete]
|
/// <summary>
|
||||||
|
/// Sets up a resolution-dependent orthographic projection.
|
||||||
|
/// </summary>
|
||||||
void Begin();
|
void Begin();
|
||||||
|
|
||||||
[Obsolete]
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Restores the projection and modelview matrices to their previous state.
|
||||||
|
/// </summary>
|
||||||
|
#region End
|
||||||
|
|
||||||
void End();
|
void End();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obsolete
|
||||||
|
|
||||||
[Obsolete("Use TextPrinter.Print instead")]
|
[Obsolete("Use TextPrinter.Print instead")]
|
||||||
void Draw(TextHandle handle);
|
void Draw(TextHandle handle);
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,12 @@ namespace OpenTK.Graphics.Text
|
||||||
Dictionary<Texture2D, List<Vector2>> active_lists = new Dictionary<Texture2D, List<Vector2>>();
|
Dictionary<Texture2D, List<Vector2>> active_lists = new Dictionary<Texture2D, List<Vector2>>();
|
||||||
Queue<List<Vector2>> inactive_lists = new Queue<List<Vector2>>();
|
Queue<List<Vector2>> inactive_lists = new Queue<List<Vector2>>();
|
||||||
|
|
||||||
|
#pragma warning disable 0649
|
||||||
|
|
||||||
|
struct Viewport { public float Left, Top, Right, Bottom; }
|
||||||
|
|
||||||
|
#pragma warning restore 0649
|
||||||
|
|
||||||
bool disposed;
|
bool disposed;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -164,6 +170,62 @@ namespace OpenTK.Graphics.Text
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Begin
|
||||||
|
|
||||||
|
public void Begin()
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().ToString());
|
||||||
|
|
||||||
|
GraphicsContext.Assert();
|
||||||
|
|
||||||
|
int current_matrix;
|
||||||
|
GL.GetInteger(GetPName.MatrixMode, out current_matrix);
|
||||||
|
|
||||||
|
Viewport viewport = new Viewport();
|
||||||
|
GL.GetFloat(GetPName.Viewport, out viewport.Left);
|
||||||
|
|
||||||
|
// Prepare to draw text. We want pixel perfect precision, so we setup a 2D mode,
|
||||||
|
// with size equal to the window (in pixels).
|
||||||
|
// While we could also render text in 3D mode, it would be very hard to get
|
||||||
|
// pixel-perfect precision.
|
||||||
|
GL.MatrixMode(MatrixMode.Projection);
|
||||||
|
GL.PushMatrix();
|
||||||
|
GL.LoadIdentity();
|
||||||
|
GL.Ortho(viewport.Left, viewport.Right, viewport.Bottom, viewport.Top, -1.0, 1.0);
|
||||||
|
|
||||||
|
GL.MatrixMode(MatrixMode.Modelview);
|
||||||
|
GL.PushMatrix();
|
||||||
|
GL.LoadIdentity();
|
||||||
|
|
||||||
|
GL.MatrixMode((MatrixMode)current_matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region End
|
||||||
|
|
||||||
|
public void End()
|
||||||
|
{
|
||||||
|
if (disposed)
|
||||||
|
throw new ObjectDisposedException(this.GetType().ToString());
|
||||||
|
|
||||||
|
GraphicsContext.Assert();
|
||||||
|
|
||||||
|
int current_matrix;
|
||||||
|
GL.GetInteger(GetPName.MatrixMode, out current_matrix);
|
||||||
|
|
||||||
|
GL.MatrixMode(MatrixMode.Modelview);
|
||||||
|
GL.PopMatrix();
|
||||||
|
|
||||||
|
GL.MatrixMode(MatrixMode.Projection);
|
||||||
|
GL.PopMatrix();
|
||||||
|
|
||||||
|
GL.MatrixMode((MatrixMode)current_matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Protected Members
|
#region Protected Members
|
||||||
|
|
|
@ -36,5 +36,7 @@ namespace OpenTK.Graphics.Text
|
||||||
{
|
{
|
||||||
void Print(TextBlock block, Color color, IGlyphRasterizer rasterizer);
|
void Print(TextBlock block, Color color, IGlyphRasterizer rasterizer);
|
||||||
void Clear();
|
void Clear();
|
||||||
|
void Begin();
|
||||||
|
void End();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,7 @@ namespace OpenTK.Graphics
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Clear()
|
#region Clear
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
|
@ -227,55 +227,32 @@ namespace OpenTK.Graphics
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Obsolete
|
#region Begin
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets up OpenGL state for drawing text.
|
/// Sets up a resolution-dependent orthographic projection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete]
|
|
||||||
public void Begin()
|
public void Begin()
|
||||||
{
|
{
|
||||||
if (disposed)
|
TextOutput.Begin();
|
||||||
throw new ObjectDisposedException(this.GetType().ToString());
|
|
||||||
|
|
||||||
GraphicsContext.Assert();
|
|
||||||
|
|
||||||
float[] viewport = new float[4];
|
|
||||||
|
|
||||||
GL.GetFloat(GetPName.Viewport, viewport);
|
|
||||||
|
|
||||||
// Prepare to draw text. We want pixel perfect precision, so we setup a 2D mode,
|
|
||||||
// with size equal to the window (in pixels).
|
|
||||||
// While we could also render text in 3D mode, it would be very hard to get
|
|
||||||
// pixel-perfect precision.
|
|
||||||
GL.MatrixMode(MatrixMode.Projection);
|
|
||||||
GL.PushMatrix();
|
|
||||||
GL.LoadIdentity();
|
|
||||||
GL.Ortho(viewport[0], viewport[2], viewport[3], viewport[1], -1.0, 1.0);
|
|
||||||
|
|
||||||
GL.MatrixMode(MatrixMode.Modelview);
|
|
||||||
GL.PushMatrix();
|
|
||||||
GL.LoadIdentity();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Begin
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Restores OpenGL state.
|
/// Restores the projection and modelview matrices to their previous state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Obsolete]
|
|
||||||
public void End()
|
public void End()
|
||||||
{
|
{
|
||||||
if (disposed)
|
TextOutput.End();
|
||||||
throw new ObjectDisposedException(this.GetType().ToString());
|
|
||||||
|
|
||||||
GraphicsContext.Assert();
|
|
||||||
|
|
||||||
GL.MatrixMode(MatrixMode.Modelview);
|
|
||||||
GL.PopMatrix();
|
|
||||||
|
|
||||||
GL.MatrixMode(MatrixMode.Projection);
|
|
||||||
GL.PopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Obsolete
|
||||||
|
|
||||||
[Obsolete("Use TextPrinter.Print instead")]
|
[Obsolete("Use TextPrinter.Print instead")]
|
||||||
public void Draw(TextHandle handle)
|
public void Draw(TextHandle handle)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue