Exemple #1
0
        /// <summary>
        /// The start methods for the renderer
        /// </summary>
        internal override void Start()
        {
            vao.Bind();
            vbo.Bind();

            vbo.InitBuffer();

            ibo.Bind();
            ibo.SetBufferData();
            ibo.Unbind();

            vbo.Unbind();
            vao.Unbind();
        }
Exemple #2
0
        public GlVertexArray(GlVertexBuffer <TVertex> vertices, GlIndexBuffer <TIndex> indices, Layout layout)
        {
            GlVbo  = vertices;
            GlIbo  = indices;
            Layout = layout;

            Handle = GL.GenVertexArray();
            Bind();
            Vbo.Bind();
            Ibo.Bind();

            int stride = 0;

            for (int i = 0; i < layout.Count; i++)
            {
                stride += Layout.GetSizeOf(layout[i].Type) * layout[i].Count;
            }

            int offset = 0;

            for (int i = 0; i < layout.Count; i++)
            {
                int location = layout.Shader.GetAttributeLocation(layout[i].AttributeName);
                GL.EnableVertexAttribArray(location);
                GL.VertexAttribPointer(location, layout[i].Count, GetAttribType(layout[i].Type), false, stride, offset);
                offset += Layout.GetSizeOf(layout[i].Type) * layout[i].Count;
            }
        }