Esempio n. 1
0
        public static int CreateVertexArray2(VertexAttribute[] attributes)
        {
            var vertexArrayId = GL.GenVertexArray();
            GL.BindVertexArray(vertexArrayId);

            for (var i = 0; i < attributes.Length; i++)
            {
                var attr = attributes[i];
                GL.EnableVertexAttribArray(i);
                GL.VertexAttribPointer(i, attr.Size, attr.PointerType, attr.Normalized, attr.Stride, attr.Offset);
            }

            GL.BindVertexArray(0);

            return vertexArrayId;
        }
Esempio n. 2
0
        public static int CreateVertexArray(VertexAttribute[] attributes)
        {
            var vertexArrayId = GL.GenVertexArray();
            GL.BindVertexArray(vertexArrayId);

            for (var i = 0; i < attributes.Length; i++)
            {
                var attr = attributes[i];
                GL.EnableVertexAttribArray(i);
                GL.BindBuffer(attr.Target, attr.VertexBuffer);
                GL.VertexAttribPointer(i, attr.Size, attr.PointerType, attr.Normalized, attr.Stride, attr.Offset);
                GL.BindAttribLocation(attr.ShaderHandle, i, attr.ShaderAttribName);
            }

            GL.BindVertexArray(0);

            return vertexArrayId;
        }