move TEXTURE_WHITE loading; rm shader.Use() from OnRenderFrame()
This commit is contained in:
parent
a94a3938dc
commit
4e0a15e3a0
11
Program.cs
11
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<Rgba32> white1x1 = new Image<Rgba32>(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<Texture>();
|
||||
@ -281,11 +285,6 @@ public class Game : GameWindow {
|
||||
textures.Add(new Texture(image));
|
||||
}
|
||||
}
|
||||
|
||||
// Load blank white texture.
|
||||
Image<Rgba32> white1x1 = new Image<Rgba32>(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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user