From f535256e1e06f56666c82e9df3f2e687c49041af Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sat, 1 Dec 2007 16:51:30 +0000 Subject: [PATCH] Fixed TextPrinter.Begin() and TextPrinter.End() not restoring matrices. --- Source/OpenTK/Fonts/TextPrinter.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/OpenTK/Fonts/TextPrinter.cs b/Source/OpenTK/Fonts/TextPrinter.cs index 9c106540..5c71b67b 100644 --- a/Source/OpenTK/Fonts/TextPrinter.cs +++ b/Source/OpenTK/Fonts/TextPrinter.cs @@ -260,8 +260,6 @@ namespace OpenTK.Fonts /// public void Begin() { - GL.PushMatrix(); - GL.GetFloat(GetPName.Viewport, viewport); // 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 // pixel-perfect precision. GL.MatrixMode(MatrixMode.Projection); + GL.PushMatrix(); GL.LoadIdentity(); GL.Ortho(viewport[0], viewport[2], viewport[3], viewport[1], 0.0, 1.0); GL.MatrixMode(MatrixMode.Modelview); + GL.PushMatrix(); GL.LoadIdentity(); GL.PushAttrib(AttribMask.TextureBit); @@ -296,6 +296,11 @@ namespace OpenTK.Fonts { GL.PopAttrib(); GL.PopAttrib(); + + GL.MatrixMode(MatrixMode.Projection); + GL.PopMatrix(); + + GL.MatrixMode(MatrixMode.Modelview); GL.PopMatrix(); }