public VertexArrayObject(GL gl, BufferObject <TVertexType> vbo, BufferObject <TIndexType> ebo) { //Saving the GL instance. _gl = gl; //Setting out handle and binding the VBO and EBO to this VAO. _handle = _gl.GenVertexArray(); Bind(); vbo.Bind(); ebo.Bind(); }
public GraphicalObject(string objFile, string mtlFile, GL Gl, Shader s) { obj = ObjFile.FromFile(objFile); mtl = ObjMaterialFile.FromFile(mtlFile); associatedShader = s; this.Gl = Gl; (vertices, indices) = CreateVertexInfo(); Ebo = new BufferObject <uint>(Gl, indices, BufferTargetARB.ElementArrayBuffer); Vbo = new BufferObject <float>(Gl, vertices, BufferTargetARB.ArrayBuffer); Vao = new VertexArrayObject <float, uint>(Gl, Vbo, Ebo); Vao.VertexAttributePointer(0, 3, VertexAttribPointerType.Float, 8, 0); Vao.VertexAttributePointer(1, 3, VertexAttribPointerType.Float, 8, 3); Vao.VertexAttributePointer(2, 2, VertexAttribPointerType.Float, 8, 6); }