From 3a2aa4ece6d6ecc00572bc05edd34c9199804615 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sat, 29 Nov 2008 18:22:51 +0000 Subject: [PATCH] Set default texture parameters before allocating memory for the texture. --- Source/Utilities/Graphics/Texture2D.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Utilities/Graphics/Texture2D.cs b/Source/Utilities/Graphics/Texture2D.cs index fe24d3b8..9a167c96 100644 --- a/Source/Utilities/Graphics/Texture2D.cs +++ b/Source/Utilities/Graphics/Texture2D.cs @@ -218,6 +218,8 @@ namespace OpenTK.Graphics if (id == 0) throw new GraphicsResourceException(String.Format("Texture creation failed, (Error: {0})", GL.GetError())); + SetDefaultTextureParameters(id); + GL.TexImage2D(TextureTarget.Texture2D, 0, InternalFormat, Width, Height, 0, OpenTK.Graphics.PixelFormat.Rgba, PixelType.UnsignedByte, IntPtr.Zero); @@ -264,7 +266,6 @@ namespace OpenTK.Graphics context = GraphicsContext.CurrentContext; id = CreateTexture(Width, Height); - SetDefaultTextureParameters(id); } return id;