aboutsummaryrefslogtreecommitdiff
path: root/Unicity.Renderer/Shapes/Triangle.cs
diff options
context:
space:
mode:
authorAdrian Ulbrich <adrian.ulbrich.2003@gmail.com>2019-11-08 23:56:17 +0100
committerAdrian Ulbrich <adrian.ulbrich.2003@gmail.com>2019-11-08 23:56:17 +0100
commit3b214e75effaca1ba67daaf29d0a94e5b0129386 (patch)
treeee0ccd43f193f2bdaedd36dcdc944f01a75e37e3 /Unicity.Renderer/Shapes/Triangle.cs
parente63155370c817a1d9c16ef798b0a55e6fe328941 (diff)
downloadUnicity-3b214e75effaca1ba67daaf29d0a94e5b0129386.tar.gz
Unicity-3b214e75effaca1ba67daaf29d0a94e5b0129386.tar.bz2
Unicity-3b214e75effaca1ba67daaf29d0a94e5b0129386.zip
Started work on actual engine
Diffstat (limited to 'Unicity.Renderer/Shapes/Triangle.cs')
-rw-r--r--Unicity.Renderer/Shapes/Triangle.cs50
1 files changed, 0 insertions, 50 deletions
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);
- }
- }
-}