Fixed TextPrinter.Begin() and TextPrinter.End() not restoring matrices.

This commit is contained in:
the_fiddler 2007-12-01 16:51:30 +00:00
parent f23bafa6a4
commit f535256e1e

View file

@ -260,8 +260,6 @@ namespace OpenTK.Fonts
/// </summary> /// </summary>
public void Begin() public void Begin()
{ {
GL.PushMatrix();
GL.GetFloat(GetPName.Viewport, viewport); GL.GetFloat(GetPName.Viewport, viewport);
// Prepare to draw text. We want pixel perfect precision, so we setup a 2D mode, // Prepare to draw text. We want pixel perfect precision, so we setup a 2D mode,
@ -269,10 +267,12 @@ namespace OpenTK.Fonts
// While we could also render text in 3D mode, it would be very hard to get // While we could also render text in 3D mode, it would be very hard to get
// pixel-perfect precision. // pixel-perfect precision.
GL.MatrixMode(MatrixMode.Projection); GL.MatrixMode(MatrixMode.Projection);
GL.PushMatrix();
GL.LoadIdentity(); GL.LoadIdentity();
GL.Ortho(viewport[0], viewport[2], viewport[3], viewport[1], 0.0, 1.0); GL.Ortho(viewport[0], viewport[2], viewport[3], viewport[1], 0.0, 1.0);
GL.MatrixMode(MatrixMode.Modelview); GL.MatrixMode(MatrixMode.Modelview);
GL.PushMatrix();
GL.LoadIdentity(); GL.LoadIdentity();
GL.PushAttrib(AttribMask.TextureBit); GL.PushAttrib(AttribMask.TextureBit);
@ -296,6 +296,11 @@ namespace OpenTK.Fonts
{ {
GL.PopAttrib(); GL.PopAttrib();
GL.PopAttrib(); GL.PopAttrib();
GL.MatrixMode(MatrixMode.Projection);
GL.PopMatrix();
GL.MatrixMode(MatrixMode.Modelview);
GL.PopMatrix(); GL.PopMatrix();
} }