コード例 #1
0
 protected void Draw()
 {
     worldMatrix.Matrix = Matrix4x4.CreateOrthographic(2.0f, 2.0f, -1.0f, +1.0f);
     pipeline.Bind();
     worldMatrix.Set(pipeline);
     buffer.Bind();
     indexBuffer.Bind();
     vao.Bind();
     texture.Set(pipeline);
     indexBuffer.DrawIndexed(buffer, 6);
 }
コード例 #2
0
        public override void Draw(IResourceSet resourceSet, int elements)
        {
            if (resourceSet == null)
            {
                throw new ArgumentNullException(nameof(resourceSet));
            }

            pipeline.Bind();
            vertexArrayObject.Bind();
            indexBuffer.Bind();
            vertexArrayBuffer.Bind();

            foreach (var uniform in resourceSet.GetUniforms())
            {
                uniform.Set(pipeline);
            }

            indexBuffer.DrawIndexed(vertexArrayBuffer, elements);

            vertexArrayBuffer.Unbind();
            indexBuffer.Unbind();
            vertexArrayObject.Unbind();
            pipeline.Unbind();
        }