public void SetIndices(int[] indices, int elementCount)
        {
            if (indices == null)
            {
                throw new ArgumentNullException(nameof(indices));
            }

            this.elementCount = elementCount;
            indexBuffer.Bind();
            indexBuffer.CopyData(indices);
            indexBuffer.Unbind();
        }
Ejemplo n.º 2
0
        public void SetIndices(int[] indices, int elementCount)
        {
            if (indices == null)
            {
                throw new ArgumentNullException(nameof(indices));
            }

            elements = elementCount;
            indexBuffer.Bind();
            indexBuffer.ReplaceData(indices, IntPtr.Zero);
            indexBuffer.Unbind();
        }
Ejemplo n.º 3
0
        public override void SetIndexBuffer(IndexBuffer indexBuffer)
        {
            BindVertexArray(_vertexArrayObject);
            indexBuffer.Bind();

            _indexBuffer = indexBuffer;
        }
Ejemplo n.º 4
0
        public void Render()
        {
            GL.EnableVertexAttribArray(0);
            GL.EnableVertexAttribArray(1);
            GL.EnableVertexAttribArray(2);
            GL.EnableVertexAttribArray(3);

            VertexBuffer.Bind();
            IndexBuffer.Bind();

            GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, /*0*/ 10 * sizeof(float),
                                   new IntPtr(0 * sizeof(float)));
            GL.VertexAttribPointer(1, 4, VertexAttribPointerType.Float, false, /*3*/ 10 * sizeof(float),
                                   new IntPtr(3 * sizeof(float)));
            GL.VertexAttribPointer(2, 2, VertexAttribPointerType.Float, false, /*7*/ 10 * sizeof(float),
                                   new IntPtr(7 * sizeof(float)));
            GL.VertexAttribPointer(3, 1, VertexAttribPointerType.Float, false, /*9*/ 10 * sizeof(float),
                                   new IntPtr(9 * sizeof(float)));

            GL.DrawElements(PrimitiveType.Triangles, Elements.Length, DrawElementsType.UnsignedInt, IntPtr.Zero);

            GL.DisableVertexAttribArray(0);
            GL.DisableVertexAttribArray(1);
            GL.DisableVertexAttribArray(2);
            GL.DisableVertexAttribArray(3);
        }
Ejemplo n.º 5
0
        public void Present()
        {
            m_VertexBuffer.Unmap();

            Context.Instance.SetDepthTesting(false);
            Context.Instance.SetBlend(true);

            m_Shader.Bind();
            m_Shader.SetVSSystemUniformBuffer(m_R2DUniformMatricesBuffer, m_R2DUniformMatricesBufferSlot);

            for (int i = 0; i < m_Textures.Count; i++)
            {
                m_Textures[i].Bind(i);
            }

            m_VertexBuffer.Bind();
            m_IndexBuffer.Bind();
            Context.Instance.DevCon.DrawIndexed(m_IndexBuffer.Count, 0, 0);

            for (int i = 0; i < m_Textures.Count; i++)
            {
                m_Textures[i].Unbind(i);
            }

            m_Textures.Clear();
            m_IndexCount = 0;
        }
Ejemplo n.º 6
0
 public VertexArray SetIndexBuffer(IndexBuffer indexBuffer)
 {
     Bind();
     indexBuffer.Bind();
     IndexBuffer = indexBuffer;
     return(this);
 }
Ejemplo n.º 7
0
        internal WebGL2GeometryInput(IndexBuffer indexBuffer, VertexStream[] vertexStreams)
        {
            if (vertexStreams.Length < 1)
            {
                throw new CKGLException("GeometryInput constructor requires at least 1 VertexStream");
            }

            VertexStreams = vertexStreams;
            IndexBuffer   = indexBuffer;

            vao = new VertexArray();

            vao.Bind();

            foreach (VertexStream vertexStream in vertexStreams)
            {
                vertexStream.VertexBuffer.Bind();

                for (uint i = 0; i < vertexStream.VertexFormat.Attributes.Length; i++)
                {
                    GL.enableVertexAttribArray(i);
                    GL.vertexAttribPointer(i, vertexStream.VertexFormat.Attributes[(int)i].Count, vertexStream.VertexFormat.Attributes[(int)i].Type.ToWebGL2(), vertexStream.VertexFormat.Attributes[(int)i].Normalized, vertexStream.VertexFormat.Stride, vertexStream.VertexFormat.Attributes[(int)i].Offset);
                    if (vertexStream.VertexFormat.Attributes[(int)i].Divisor > 0)
                    {
                        GL.vertexAttribDivisor(i, vertexStream.VertexFormat.Attributes[(int)i].Divisor);
                    }
                    //Output.WriteLine($"id: {i}, Count: {vertexStream.VertexFormat.Attributes[(int)i].Count}, Type: {vertexStream.VertexFormat.Attributes[(int)i].Type}, Normalized: {vertexStream.VertexFormat.Attributes[(int)i].Normalized}, Size/Stride: {vertexStream.VertexFormat.Attributes[(int)i].Size}/{vertexStream.VertexFormat.Stride}, offset: {vertexStream.VertexFormat.Attributes[(int)i].Offset}, divisor: {vertexStream.VertexFormat.Attributes[(int)i].Divisor}"); // Debug
                }
            }

            if (indexBuffer != null)
            {
                indexBuffer.Bind();
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Sets up the rendering pipeline with any glyph rendering specific render state that can be shared across all glyph batches drawn using the GlyphRenderer.Render function.
 /// </summary>
 public void PreparePipeline()
 {
     Use();
     indices.Bind();
     vertexConstants.Bind(0);
     instances.Bind(0);
 }
Ejemplo n.º 9
0
        protected override void OnLoad(EventArgs e)
        {
            prog = new ShaderProgram(Shader.FromFile(vertPath), Shader.FromFile(fragPath));

            textureWall      = new Texture(System.Drawing.Image.FromFile("Data/wall.jpg"), 0, "wall");
            textureContainer = new Texture(System.Drawing.Image.FromFile("Data/container2.png"), 1, "container");



            vbo = new VertexBuffer <float>();
            vbo.Bind();
            vbo.BufferData(vertices);


            vao = new VertexArray();
            vao.Bind();

            ibo = new IndexBuffer();
            ibo.Bind();
            ibo.BufferData(indices);

            GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 5 * 4, 0);
            GL.EnableVertexAttribArray(0);
            GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, 5 * 4, 3 * 4);
            GL.EnableVertexAttribArray(1);

            vao.Unbind();
            ibo.Unbind();
            vbo.Unbind();
            prog.Use();

            GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
        }
Ejemplo n.º 10
0
        public void Draw()
        {
            if (state == DrawStates.None)
            {
                return;
            }

            if ((state & DrawStates.Vertex) == DrawStates.Vertex)
            {
                VertexBuffer.Bind(BufferTarget.ArrayBuffer);
                VertexBuffer.UseVertexPointer(vertexSize, VertexStride, VertexOffset);
            }

            if ((state & DrawStates.TexCoord) == DrawStates.TexCoord)
            {
                TexCoordBuffer.Bind(BufferTarget.ArrayBuffer);
                TexCoordBuffer.UseTexCoordPointer(texCoordSize, TexCoordStride, TexCoordOffset);
            }

            if ((state & DrawStates.Normal) == DrawStates.Normal)
            {
                NormalBuffer.Bind(BufferTarget.ArrayBuffer);
                NormalBuffer.UseNormalPointer(NormalStride, NormalOffset);
            }

            //TODO this needs to become static/part of some graphics context class.
            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

            IndexBuffer.Bind(BufferTarget.ElementArrayBuffer);
            GL.DrawElements(DrawMode, IndexBuffer.Length, (DrawElementsType)IndexBuffer.DataType, 0);
            IndexBuffer.Unbind(BufferTarget.ElementArrayBuffer);
        }
Ejemplo n.º 11
0
        internal void Draw(PrimitiveType primitiveType, Matrix world)
        {
            Threading.EnsureUIThread();
            GL.FrontFace(FrontFaceDirection.Ccw);
            GL.CullFace(CullFaceMode.Back);

            GL.Enable(EnableCap.CullFace);
            GL.Enable(EnableCap.DepthTest);
            GL.DepthFunc(DepthFunction.Less);
            Material.Shader.Bind();
            Material.Apply();

            VertexBuffer.BindVertexArray();
            VertexBuffer.Bind();
            IndexBuffer.Bind();
            VertexBuffer.VertexDeclaration.Apply(Material.Shader, IntPtr.Zero);

            REngine.CheckGLError();

            Material.Shader.BindSemantics(Matrix.Identity * world, REngine.camera.View, REngine.camera.Projection);
            REngine.CheckGLError();


            GL.DrawElements(primitiveType, IndexBuffer.IndexCount, DrawElementsType.UnsignedInt, IntPtr.Zero);

            Material.Shader.Unbind();
            IndexBuffer.Unbind();
            VertexBuffer.Unbind();
            VertexBuffer.UnbindVertexArray();
        }
Ejemplo n.º 12
0
 protected void Apply(int texture, IndexBuffer indexbuffer, IAttributeBuffer vertexbuffer, IAttributeBuffer texturebuffer, bool alphaBlending)
 {
     Apply(vertexbuffer, alphaBlending);
     texturebuffer.Bind(textureCoordsHandle);
     textureHandle.Set(texture);
     indexbuffer.Bind( );
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Draws all the entities
        /// </summary>
        /// <param name="cameraMatrix"></param>
        private void DrawEntities(Matrix4f cameraMatrix)
        {
            uint currentIndicieCount = 0;

            foreach (IRenderable comp in renderComponents)
            {
                uint quadsCount = (uint)(comp.Vertices.Length / 4);

                if (!comp.Enabled || !comp.Entity.Enabled)
                {
                    currentIndicieCount += quadsCount * 6 * sizeof(int);
                    continue;
                }

                // Set Model view perspective
                Matrix4f mvp = cameraMatrix * comp.Entity.Transform.GetMatrix();

                testShader.SetUniformM4("MVP", mvp);

                testShader.Bind();
                VertexArray.Bind();
                IndexBuffer.Bind();

                for (int i = 0; i < quadsCount; i++)
                {
                    Gl.DrawElements(PrimitiveType.Triangles, 6, DrawElementsType.UnsignedInt, (IntPtr)(currentIndicieCount + (i * 6 * sizeof(int))));
                }

                IndexBuffer.Unbind();
                VertexArray.Unbind();
                testShader.Unbind();

                currentIndicieCount += quadsCount * 6 * sizeof(int);
            }
        }
Ejemplo n.º 14
0
        private void CreateIndexBuffer(OpenGL gl)
        {
            const uint vertexCount = slices * stacks;
            const uint indexCount  = vertexCount * 6;

            indices = new ushort[indexCount];
            int count = 0;

            ushort n = 0;

            for (ushort i = 0; i < slices; i++)
            {
                for (ushort j = 0; j < stacks; j++)
                {
                    indices[count++] = (ushort)(n + j);
                    indices[count++] = (ushort)(n + (j + 1) % stacks);
                    indices[count++] = (ushort)((n + j + stacks) % vertexCount);

                    indices[count++] = (ushort)((n + j + stacks) % vertexCount);
                    indices[count++] = (ushort)((n + (j + 1) % stacks) % vertexCount);
                    indices[count++] = (ushort)((n + (j + 1) % stacks + stacks) % vertexCount);
                }

                n += (ushort)stacks;
            }

            var indexBuffer = new IndexBuffer();

            indexBuffer.Create(gl);
            indexBuffer.Bind(gl);
            indexBuffer.SetData(gl, indices);
        }
Ejemplo n.º 15
0
    public void Draw(VertexArray va, IndexBuffer ib, Shader shader)
    {
        va.Bind();
        ib.Bind();
        shader.Bind();

        GL.DrawElements(PrimitiveType.Triangles, ib.GetCount(), DrawElementsType.UnsignedInt, IntPtr.Zero);
    }
Ejemplo n.º 16
0
 public override void SetIndexBuffer(IndexBuffer indexBuffer)
 {
     AXProfiler.Capture(() =>
     {
         Bind();
         indexBuffer.Bind();
         _indexBuffer = indexBuffer;
     });
 }
Ejemplo n.º 17
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);
 }
Ejemplo n.º 18
0
 public StreamDisplayList(uint vertexSize, OpenGL.PrimitiveType primitiveType = OpenGL.PrimitiveType.Triangles, uint vertexBufferSize = 1024, uint indexBufferSize = 1024, ShaderPipeline pipeline = null, Core.VertexAttributeDescription[] vertexAttributes = null) : base(vertexSize, pipeline, vertexAttributes)
 {
     vertexArrayBuffer = new VertexArrayBuffer <T>(vertexSize, OpenGL.BufferUsage.StreamDraw, primitiveType);
     indexBuffer       = new IndexBuffer <T>(OpenGL.BufferUsage.StreamDraw);
     vertexArrayObject = new VertexArrayObject <T>(vertexArrayBuffer, this.pipeline, this.vertexAttributes);
     vertexArrayBuffer.Bind();
     indexBuffer.Bind();
     vertexArrayBuffer.CopyRawData(IntPtr.Zero, vertexSize * vertexBufferSize);
     indexBuffer.CopyRawData(IntPtr.Zero, sizeof(int) * indexBufferSize);
     indexBuffer.Unbind();
     vertexArrayBuffer.Unbind();
 }
Ejemplo n.º 19
0
        public void Draw(IndexBuffer indexBuffer, IAttributeBuffer vertexBuffer, IAttributeBuffer baseTextureBuffer, IAttributeBuffer ampTextureBuffer, Texture2D baseTexture, Texture2D ampTexture, Matrix matrix, int count, int offset, bool alphaBlending = true)
        {
            indexBuffer.Bind( );
            Apply(vertexBuffer, alphaBlending);

            baseTextureHandle.Set(baseTexture.ID, 0);
            ampTextureHandle.Set(ampTexture.ID, 1);
            baseTextureBuffer.Bind(baseTextureCoordsHandle);
            ampTextureBuffer.Bind(ampTextureCoordsHandle);
            mvpMatrixHandle.Set(matrix.MVP);

            GL.DrawElements(BeginMode.Triangles, count, DrawElementsType.UnsignedShort, new IntPtr(offset));
        }
Ejemplo n.º 20
0
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            GL.Viewport(0, 0, Width, Height);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            shader.Bind();
            vao.Bind();
            indexVbo.Bind();
            GL.DrawElements(BeginMode.Triangles, indexVbo.Length,
                            DrawElementsType.UnsignedInt, IntPtr.Zero);

            SwapBuffers();
        }
Ejemplo n.º 21
0
 private void CreateIndexBuffer()
 {
     CreateIndices();
     indexBuffer = new IndexBuffer();
     indexBuffer.Create(my_OpenGL);
     indexBuffer.Bind(my_OpenGL);
     uint[] indis = new uint[my_Indices.Length];
     for (int I = 0; I < my_Indices.Length; I++)
     {
         indis[I] = (uint)my_Indices[I];
     }
     indexBuffer.SetData(my_OpenGL, indis);
 }
Ejemplo n.º 22
0
        public void BuildVertexArray()
        {
            foreach (var block in Blocks)
            {
                if (block is IBlockModel)
                {
                    var blockModel = block as IBlockModel;

                    ElementCount  += blockModel.Model.ElementCount;
                    VertecesCount += blockModel.Model.VertexCount;
                }
            }

            Vertices = new Vertex[VertecesCount];
            Elements = new uint[ElementCount];

            uint vertexPos  = 0;
            uint elementPos = 0;

            foreach (var block in Blocks)
            {
                var tempVertexPos = vertexPos;

                if (block is IBlockModel)
                {
                    var blockModel = block as IBlockModel;

                    blockModel.Model.Vertices.CopyTo(Vertices, vertexPos);
                    vertexPos += blockModel.Model.VertexCount;

                    foreach (var element in blockModel.Model.Elements)
                    {
                        Elements[elementPos] = tempVertexPos + element;
                        elementPos++;
                    }
                }
            }

            VertexBuffer = new VertexBuffer();
            IndexBuffer  = new IndexBuffer();

            VertexBuffer.Create();
            VertexBuffer.Bind();
            VertexBuffer.SetData(RawDataCreation.GenRawVertexData(Vertices));

            IndexBuffer.Create();
            IndexBuffer.Bind();
            IndexBuffer.SetData(Elements);
        }
Ejemplo n.º 23
0
 public void Draw(Matrix4 persp, Matrix4 model)
 {
     vao.Bind();
     ibo.Bind();
     tex.Bind();
     shaderProgram.Use();
     shaderProgram.SetUniform("proj", persp);
     shaderProgram.SetUniform("mdl", model);
     shaderProgram.SetUniform("myTextureSampler", 0f);
     GL.DrawElements(PrimitiveType.Triangles, elementCount, DrawElementsType.UnsignedInt, 0);
     shaderProgram.Unuse();
     tex.Unbind();
     ibo.Unbind();
     vao.Unbind();
 }
Ejemplo n.º 24
0
        public void GenerateGeometry(OpenGL gl)
        {
            vertexBufferArray = new VertexBufferArray();
            vertexBufferArray.Create(gl);
            vertexBufferArray.Bind(gl);

            VertexBuffer vb = new VertexBuffer();

            vb.Create(gl);
            vb.Bind(gl);
            vb.SetData(gl, 0, vertices.SelectMany(v => ((vec3)v).ToArray()).ToArray(), false, 3);

            IndexBuffer ib = new IndexBuffer();

            ib.Create(gl);
            ib.Bind(gl);
            ib.SetData(gl, indices);
        }
Ejemplo n.º 25
0
        public void Render(Camera camera, Int2 screenResolution, Span <TInstance> instances, int start, int count)
        {
            Use();
            indices.Bind();
            vertexConstants.Bind(0);
            this.instances.Bind(0);
            pixelConstants.Bind(1);

            var vertexConstantsData = new RayTracedVertexConstants {
                Projection     = camera.Projection,
                CameraPosition = camera.Position,
                CameraRight    = camera.Right,
                NearClip       = camera.NearClip,
                CameraUp       = camera.Up,
                CameraBackward = camera.Backward,
            };

            vertexConstants.Update(ref vertexConstantsData);
            var viewportHeight     = 2 * (float)Math.Tan(camera.FieldOfView / 2);
            var viewportWidth      = viewportHeight * camera.AspectRatio;
            var pixelConstantsData = new RayTracedPixelConstants {
                CameraRight          = camera.Right,
                NearClip             = camera.NearClip,
                CameraUp             = camera.Up,
                FarClip              = camera.FarClip,
                CameraBackward       = camera.Backward,
                PixelSizeAtUnitPlane = new Vector2(viewportWidth / screenResolution.X, viewportHeight / screenResolution.Y)
            };

            pixelConstants.Update(ref pixelConstantsData);

            while (count > 0)
            {
                var batchCount = Math.Min(this.instances.Capacity, count);
                this.instances.Update(instances, batchCount, start);
                GL.DrawElements(PrimitiveType.Triangles, 36 * batchCount, indices.Type, 0);
                count -= batchCount;
                start += batchCount;
            }
        }
        public StaticDisplayList(T[] vertices, int[] indices, uint vertexSize, OpenGL.PrimitiveType primitiveType = OpenGL.PrimitiveType.Triangles, ShaderPipeline pipeline = null, VertexAttributeDescription[] attributes = null) : base(vertexSize, pipeline, attributes)
        {
            if (vertices == null)
            {
                throw new ArgumentNullException(nameof(vertices));
            }
            if (indices == null)
            {
                throw new ArgumentNullException(nameof(indices));
            }

            vertexArrayBuffer = new VertexArrayBuffer <T>(vertexSize, OpenGL.BufferUsage.StaticDraw, primitiveType);
            indexBuffer       = new IndexBuffer <T>(OpenGL.BufferUsage.StaticDraw);
            vertexArrayObject = new VertexArrayObject <T>(vertexArrayBuffer, this.pipeline, vertexAttributes);
            vertexArrayBuffer.Bind();
            indexBuffer.Bind();
            vertexArrayBuffer.CopyData(vertices);
            indexBuffer.CopyData(indices);
            indexBuffer.Unbind();
            vertexArrayBuffer.Unbind();
            elementCount = indices.Length;
        }
Ejemplo n.º 27
0
        public override void GenerateGeometry(OpenGL gl)
        {
            vertexBufferArray = new VertexBufferArray();
            vertexBufferArray.Create(gl);
            vertexBufferArray.Bind(gl);

            VertexBuffer vb = new VertexBuffer();

            vb.Create(gl);
            vb.Bind(gl);
            vb.SetData(gl, 0, vertexTriangles.Select(v => vertices[v]).SelectMany(v => ((vec3)v).ToArray()).ToArray(), false, 3);

            VertexBuffer nb = new VertexBuffer();

            nb.Create(gl);
            nb.Bind(gl);
            nb.SetData(gl, 1, vertexNormals.SelectMany(v => ((vec3)v).ToArray()).ToArray(), false, 3);

            IndexBuffer ib = new IndexBuffer();

            ib.Create(gl);
            ib.Bind(gl);
            ib.SetData(gl, Enumerable.Range(0, 36).Select(v => (ushort)v).ToArray());
        }
Ejemplo n.º 28
0
        public override void GenerateGeometry(OpenGL gl)
        {
            vertexBufferArray = new VertexBufferArray();
            vertexBufferArray.Create(gl);
            vertexBufferArray.Bind(gl);

            VertexBuffer vb = new VertexBuffer();

            vb.Create(gl);
            vb.Bind(gl);
            vb.SetData(gl, 0, Vertices.SelectMany(v => ((vec3)v).ToArray()).ToArray(), false, 3);

            VertexBuffer nb = new VertexBuffer();

            nb.Create(gl);
            nb.Bind(gl);
            nb.SetData(gl, 1, Vertices.SelectMany(v => ((vec3)v).ToArray()).ToArray(), false, 3);

            IndexBuffer ib = new IndexBuffer();

            ib.Create(gl);
            ib.Bind(gl);
            ib.SetData(gl, Faces.SelectMany(v => v).Select(v => (ushort)v).ToArray());
        }
Ejemplo n.º 29
0
        protected void Setup()
        {
            var vs = DefaultShader.FromType(typeof(VertexPositionColorTexture), PlainCore.Graphics.Core.ShaderType.Vertex);
            var fs = DefaultShader.FromType(typeof(VertexPositionColorTexture), PlainCore.Graphics.Core.ShaderType.Fragment);

            pipeline    = new ShaderPipeline(vs, fs);
            buffer      = new VertexArrayBuffer <VertexPositionColorTexture>(32, OpenGL.BufferUsage.StaticDraw);
            indexBuffer = new IndexBuffer <VertexPositionColorTexture>(OpenGL.BufferUsage.StaticDraw);
            vao         = new VertexArrayObject <VertexPositionColorTexture>(buffer, pipeline,
                                                                             DefaultVertexDefinition.FromType(typeof(VertexPositionColorTexture)));
            texture            = new DeviceTexture(DefaultShader.DEFFAULT_TEXTURE_UNIFORM_NAME, 100, 100, true);
            defaultFramebuffer = Framebuffer.GetDefault();
            var imageData = Image.Load("Example.png").SavePixelData();

            texture.Bind();
            texture.CopyData(imageData);
            buffer.Bind();
            buffer.CopyData(_ArrayPosition);
            buffer.Unbind();
            indexBuffer.Bind();
            indexBuffer.CopyData(indexArray);
            indexBuffer.Unbind();
            worldMatrix = new Matrix4fUniform(DefaultShader.MVP_UNIFORM_NAME);
        }
        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();
        }