public void Draw() { vao.Bind(); ind.Bind(); GL.DrawElements(BeginMode.Triangles, length, DrawElementsType.UnsignedInt, IntPtr.Zero); VAO.Unbind(); ind.Unbind(); }
public void Create(Vector3[] positionVboData,Vector3[] normalVboData, int[] indicesVboData) { length = indicesVboData.Length; VBO pos, nor; pos = new VBO(); pos.Create<Vector3>(BufferTarget.ArrayBuffer, positionVboData); nor = new VBO(); nor.Create<Vector3>(BufferTarget.ArrayBuffer, normalVboData); ind = new VBO(); ind.Create<int>(BufferTarget.ElementArrayBuffer, indicesVboData); vao = new VAO(); vao.Create(); vao.SetVertexAttribPointer(0, 3, pos); vao.SetVertexAttribPointer(1, 3, nor); VAO.Unbind(); }
public void Create(Vector3[] positionVboData, Vector3[] normalVboData, int[] indicesVboData) { length = indicesVboData.Length; VBO pos, nor; pos = new VBO(); pos.Create <Vector3>(BufferTarget.ArrayBuffer, positionVboData); nor = new VBO(); nor.Create <Vector3>(BufferTarget.ArrayBuffer, normalVboData); ind = new VBO(); ind.Create <int>(BufferTarget.ElementArrayBuffer, indicesVboData); vao = new VAO(); vao.Create(); vao.SetVertexAttribPointer(0, 3, pos); vao.SetVertexAttribPointer(1, 3, nor); VAO.Unbind(); }