From 4e0a15e3a09e0c297e4294f3d405a9bc6853e048 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Thu, 6 Jul 2023 19:18:59 -0400 Subject: [PATCH] move TEXTURE_WHITE loading; rm shader.Use() from OnRenderFrame() --- Program.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Program.cs b/Program.cs index d9f7883..61748b7 100644 --- a/Program.cs +++ b/Program.cs @@ -272,6 +272,10 @@ public class Game : GameWindow { GL.EnableVertexAttribArray(texCoordLocation); GL.VertexAttribPointer(texCoordLocation, 2, VertexAttribPointerType.Float, false, 5 * sizeof(float), 3 * sizeof(float)); + // Load blank white texture. + Image white1x1 = new Image(1, 1, new Rgba32(255, 255, 255)); + TEXTURE_WHITE = new Texture(white1x1); + // Load textures from JPEGs. string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\06\27\"); textures = new List(); @@ -281,11 +285,6 @@ public class Game : GameWindow { textures.Add(new Texture(image)); } } - - // Load blank white texture. - Image white1x1 = new Image(1, 1, new Rgba32(255, 255, 255)); - TEXTURE_WHITE = new Texture(white1x1); - textures.Add(TEXTURE_WHITE); // FIXME: remove } protected override void OnUnload() { @@ -309,7 +308,6 @@ public class Game : GameWindow { GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.DynamicDraw); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, active.Handle); - shader.Use(); GL.DrawElements(PrimitiveType.Triangles, indices.Length, DrawElementsType.UnsignedInt, 0); for (int i = 0; i < textures.Count; i++) { @@ -318,7 +316,6 @@ public class Game : GameWindow { GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.DynamicDraw); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, textures[i].Handle); - shader.Use(); GL.DrawElements(PrimitiveType.Triangles, indices.Length, DrawElementsType.UnsignedInt, 0); }