From 3b214e75effaca1ba67daaf29d0a94e5b0129386 Mon Sep 17 00:00:00 2001 From: Adrian Ulbrich Date: Fri, 8 Nov 2019 23:56:17 +0100 Subject: Started work on actual engine --- Unicity.Renderer/Shapes/Triangle.cs | 50 ------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 Unicity.Renderer/Shapes/Triangle.cs (limited to 'Unicity.Renderer/Shapes/Triangle.cs') diff --git a/Unicity.Renderer/Shapes/Triangle.cs b/Unicity.Renderer/Shapes/Triangle.cs deleted file mode 100644 index 7ab94e2..0000000 --- a/Unicity.Renderer/Shapes/Triangle.cs +++ /dev/null @@ -1,50 +0,0 @@ -using OpenTK.Graphics.OpenGL4; - -namespace Unicity.Renderer.Shapes -{ - public class Triangle : Shape - { - int vao = 0; - int vbo = 0; - - float[] vertices = null; - - public Triangle(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) - { - vertices = new float[] - { - x1, y1, z1, - x2, y2, z2, - x3, y3, z3 - }; - - vao = GL.GenVertexArray(); - vbo = GL.GenBuffer(); - - GL.BindVertexArray(vao); - GL.BindBuffer(BufferTarget.ArrayBuffer, vbo); - - GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.StaticDraw); - - GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 3 * sizeof(float), 0); - GL.EnableVertexAttribArray(0); - - } - - internal override void Draw(Shader shader, GraphicsRenderer renderer) - { - GL.BindVertexArray(vao); - GL.BindBuffer(BufferTarget.ArrayBuffer, vbo); - - float[] newVertices = new float[vertices.Length]; - - GL.DrawArrays(PrimitiveType.Triangles, 0, 3); - } - - public override void Dispose() - { - GL.BindBuffer(BufferTarget.ArrayBuffer, 0); - GL.DeleteBuffer(vbo); - } - } -} -- cgit v1.2.3