示例#1
0
 public UniformBufferObject(UboObject[] objects)
 {
     _objects = objects;
     _vbo     = new VertexBufferObject();
     Bind();
     _vbo.SetData(BufferTarget.UniformBuffer, CalculateSize(), BufferUsageHint.StreamDraw);
     Unbind();
 }
示例#2
0
        private void GenerateEbo(int[] indices)
        {
            var vbo = new VertexBufferObject();

            LinkBuffer(vbo);
            vbo.Bind(BufferTarget.ElementArrayBuffer);
            vbo.SetData(BufferTarget.ElementArrayBuffer, indices, BufferUsageHint.StaticDraw);
        }
示例#3
0
        private void GenerateDrawVbo(Vector3[] vertices)
        {
            var vbo = new VertexBufferObject();

            LinkBuffer(vbo);
            var data = ToFloatArray(vertices);

            vbo.Bind(BufferTarget.ArrayBuffer);
            vbo.SetData(BufferTarget.ArrayBuffer, data, BufferUsageHint.StaticDraw);
            AttributePointer(0, 3, 3 * sizeof(float), 0, false);
            VertexBufferObject.Unbind(BufferTarget.ArrayBuffer);
            _verticesVbo = vbo;
        }
示例#4
0
        private void GenerateDrawVbo(Vertex[] vertices)
        {
            var vbo = new VertexBufferObject();

            LinkBuffer(vbo);
            var data = ToFloatArray(vertices);

            vbo.Bind(BufferTarget.ArrayBuffer);
            vbo.SetData(BufferTarget.ArrayBuffer, data, BufferUsageHint.StaticDraw);

            var builder = new AttributePointerBuilder(this, Vertex.Size, 0);

            builder.AddPointer(3, false);
            builder.AddPointer(3, false);
            builder.AddPointer(2, false);
            VertexBufferObject.Unbind(BufferTarget.ArrayBuffer);
        }
示例#5
0
 public void UnlinkBuffer(VertexBufferObject vbo)
 {
     _buffers.Remove(vbo);
 }
示例#6
0
 public void LinkBuffer(VertexBufferObject vbo)
 {
     _buffers.Add(vbo);
 }
示例#7
0
 public void Unbind()
 {
     VertexBufferObject.Unbind(BufferTarget.UniformBuffer);
 }