Ejemplo n.º 1
0
        public void Draw(Spritebatch spritebatch)
        {
            spritebatch.Begin <ColorProgram>();

            // Matrix transformation
            Matrix4 transformationMatrix = modelMatrix * spritebatch.Camera.GetViewProjectionMatrix();

            GL.UniformMatrix4(spritebatch.ColorProgram.ModelViewUniform, false, ref transformationMatrix);

            // Attribute pointers
            GL.BindBuffer(BufferTarget.ArrayBuffer, verticesBuffer.MemoryLocation);
            GL.VertexAttribPointer(spritebatch.ColorProgram.PositionAttribute, 3, VertexAttribPointerType.Float, false, 0, 0);

            GL.BindBuffer(BufferTarget.ArrayBuffer, colorBuffer.MemoryLocation);
            GL.VertexAttribPointer(spritebatch.ColorProgram.ColorAttribute, 3, VertexAttribPointerType.Float, false, 0, 0);

            GL.DrawArrays(PrimitiveType.Lines, 0, verticesBuffer.Length);

            spritebatch.End();
        }