public GLVertexArrayObject(int handle, GLProgram program, GLBuffer vertexBuffer, GLBuffer indexBuffer) { Handle = handle; Program = program; VertexBuffer = vertexBuffer; IndexBuffer = indexBuffer; }
public GLVertexArrayObject GetVAO(GLBuffer vertexBuffer, GLBuffer indexBuffer) { int vaoHandle = GL.GenVertexArray(); GL.BindVertexArray(vaoHandle); GL.BindBuffer(BufferTarget.ArrayBuffer, vertexBuffer.Handle); GL.BindBuffer(BufferTarget.ElementArrayBuffer, indexBuffer.Handle); var stride = Signature.Attributes.Sum(e => e.SizeInBytes()); var attributeOffset = 0; for (int i = 0; i < Signature.Attributes.Length; i++) { var attribute = Signature.Attributes[i]; GL.VertexAttribPointer(attribute.Location, attribute.GetComponentCount(), attribute.GetComponentType(), false, stride, attributeOffset); GL.EnableVertexAttribArray(attribute.Location); GL.BindAttribLocation(Handle, attribute.Location, attribute.Name); attributeOffset += attribute.SizeInBytes(); } GL.BindVertexArray(0); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0); return new GLVertexArrayObject(vaoHandle, this, vertexBuffer, indexBuffer); }
public VectorMesh(GLBuffer vertexBuffer, GLBuffer indexBuffer, int indexCount) { VertexBuffer = vertexBuffer; IndexBuffer = indexBuffer; IndexCount = indexCount; }
public SpriteBatchBuffer(GLBuffer vertexBuffer, GLBuffer indexBuffer, uint indexCount) { VertexBuffer = vertexBuffer; IndexBuffer = indexBuffer; IndexCount = indexCount; }