private void DeleteVBOs() { GL.DeleteBuffer(this.positionVboHandle); GL.DeleteBuffer(this.elementsHandle); Utility.CheckWebGLError(); GL.BindBuffer(GL.GL_ARRAY_BUFFER, null); Utility.CheckWebGLError(); }
private void CreateVBOs() { this.positionVboHandle = GL.CreateBuffer(); this.elementsHandle = GL.CreateBuffer(); GL.BindBuffer(GL.GL_ARRAY_BUFFER, this.positionVboHandle); GL.BindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, this.elementsHandle); this.vaoHandle = GL.CreateVertexArray(); GL.BindVertexArray(this.vaoHandle); GL.BindBuffer(GL.GL_ARRAY_BUFFER, this.positionVboHandle); GL.EnableVertexAttribArray(this.attributePositon); GL.EnableVertexAttribArray(this.attributeUV); GL.EnableVertexAttribArray(this.attributeColor); GL.VertexAttribPointer(this.attributePositon, 2, GL.GL_FLOAT, false, Marshal.SizeOf <DrawVertex>(), Marshal.OffsetOf <DrawVertex>("pos").ToInt32()); GL.VertexAttribPointer(this.attributeUV, 2, GL.GL_FLOAT, false, Marshal.SizeOf <DrawVertex>(), Marshal.OffsetOf <DrawVertex>("uv").ToInt32()); GL.VertexAttribPointer(this.attributeColor, 4, GL.GL_FLOAT, true, Marshal.SizeOf <DrawVertex>(), Marshal.OffsetOf <DrawVertex>("color").ToInt32()); Utility.CheckWebGLError(); }