From 0cb61c5a8234e173ade0671e857b44c567497358 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sun, 9 Aug 2009 18:54:35 +0000 Subject: [PATCH] Merged fix for issue [#1089]: "TextPrinter is affected by TextureGen* and TextureEnvMode" from 0.9.8 branch. --- Source/OpenTK/Graphics/GL/GLHelper.cs | 41 ++++++++++++++----- .../Graphics/Text/GL1TextOutputProvider.cs | 8 ++++ 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/Source/OpenTK/Graphics/GL/GLHelper.cs b/Source/OpenTK/Graphics/GL/GLHelper.cs index 2558b089..cb637bf1 100644 --- a/Source/OpenTK/Graphics/GL/GLHelper.cs +++ b/Source/OpenTK/Graphics/GL/GLHelper.cs @@ -17,7 +17,6 @@ using System.Diagnostics; using System.Reflection.Emit; - #endregion // Add a dummy namespace to keep old code compiling. @@ -618,7 +617,7 @@ namespace OpenTK.Graphics #pragma warning disable 1591 #pragma warning disable 1572 #pragma warning disable 1573 - + #region public static void Color[34]() overloads public static void Color3(System.Drawing.Color color) @@ -900,7 +899,7 @@ namespace OpenTK.Graphics { GL.Uniform4(location, quaternion.X, quaternion.Y, quaternion.Z, quaternion.W); } - + #endregion #endregion @@ -917,14 +916,14 @@ namespace OpenTK.Graphics } #endregion - + #region public static string GetShaderInfoLog(Int32 shader) public static string GetShaderInfoLog(Int32 shader) { string info; GetShaderInfoLog(shader, out info); - return info; + return info; } #endregion @@ -949,18 +948,18 @@ namespace OpenTK.Graphics } #endregion - - #region public static string GetProgramInfoLog(Int32 program) + #region public static string GetProgramInfoLog(Int32 program) + public static string GetProgramInfoLog(Int32 program) { string info; GetProgramInfoLog(program, out info); return info; } - + #endregion - + #region public static void GetProgramInfoLog(Int32 program, out string info) public static void GetProgramInfoLog(Int32 program, out string info) @@ -968,8 +967,7 @@ namespace OpenTK.Graphics unsafe { int length; - GL.GetProgram(program, OpenTK.Graphics.ProgramParameter.InfoLogLength, out length); - if (length == 0) + GL.GetProgram(program, OpenTK.Graphics.ProgramParameter.InfoLogLength, out length); if (length == 0) { info = String.Empty; return; @@ -1274,6 +1272,27 @@ namespace OpenTK.Graphics #endregion + #region TexEnv + + public static void TexEnv(TextureEnvTarget target, TextureEnvParameter pname, System.Drawing.Color color) + { + Color4 c = new Color4(color); + unsafe + { + TexEnv(target, pname, &c.R); + } + } + + public static void TexEnv(TextureEnvTarget target, TextureEnvParameter pname, Color4 color) + { + unsafe + { + TexEnv(target, pname, &color.R); + } + } + + #endregion + #pragma warning restore 3019 #pragma warning restore 1591 #pragma warning restore 1572 diff --git a/Source/Utilities/Graphics/Text/GL1TextOutputProvider.cs b/Source/Utilities/Graphics/Text/GL1TextOutputProvider.cs index ed1d4f90..43ccabf5 100644 --- a/Source/Utilities/Graphics/Text/GL1TextOutputProvider.cs +++ b/Source/Utilities/Graphics/Text/GL1TextOutputProvider.cs @@ -86,6 +86,14 @@ namespace OpenTK.Graphics.Text GL.Disable(EnableCap.DepthTest); + GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (int)All.Modulate); + GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvColor, new Color4(0, 0, 0, 0)); + + GL.Disable(EnableCap.TextureGenQ); + GL.Disable(EnableCap.TextureGenR); + GL.Disable(EnableCap.TextureGenS); + GL.Disable(EnableCap.TextureGenT); + RectangleF position; SetColor(color);