protected virtual void Dispose(bool disposing) { if (Disposed) { return; } DrawShader.Dispose(); DrawShader = null; Disposed = true; }
public void Draw() { GL.UseProgram(DrawShader.shaderProgramHandle); GL.BindBuffer(BufferTarget.ArrayBuffer, VertexVBO); GL.EnableVertexAttribArray(DrawShader.vertexAttribLocation); GL.VertexAttribPointer(DrawShader.vertexAttribLocation, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 0); GL.EnableVertexAttribArray(DrawShader.normalAttribLocation); GL.VertexAttribPointer(DrawShader.normalAttribLocation, 3, VertexAttribPointerType.Float, false, 6 * sizeof(float), 3 * sizeof(float)); GL.BindBuffer(BufferTarget.ElementArrayBuffer, IndexVBO); GL.Uniform1(DrawShader.GetUniformLocation("isWireframe"), 0); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); GL.DrawElements(BeginMode.Triangles, Faces.Count * 3, DrawElementsType.UnsignedInt, IntPtr.Zero); GL.Uniform1(DrawShader.GetUniformLocation("isWireframe"), 1); GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); GL.DrawElements(BeginMode.Triangles, Faces.Count * 3, DrawElementsType.UnsignedInt, IntPtr.Zero); }