示例#1
0
        public void SetVertexAttrib(uint index, GpuBuffer buffer, int size, DataType type, bool normalized = false, int stride = 0, uint offset = 0)
        {
            Bind();
            buffer.Bind();

            GL.VertexAttribPointer(index, size, (uint)type, normalized, stride, new IntPtr(offset));
            GL.EnableVertexAttribArray(index);
        }
示例#2
0
        public static GpuBuffer[] Create(int n, BufferTarget target = BufferTarget.Array)
        {
            uint[] handles = new uint[n];
            GL.GenBuffers(n, handles);

            var result = new GpuBuffer[n];

            for (int i = 0; i < n; i++)
            {
                result[i] = new GpuBuffer(handles[i], target);
            }

            return(result);
        }
示例#3
0
        public static GpuBuffer[] Create(BufferTarget[] targets)
        {
            int n = targets.Length;

            uint[] handles = new uint[n];
            GL.GenBuffers(n, handles);

            var result = new GpuBuffer[n];

            for (int i = 0; i < n; i++)
            {
                result[i] = new GpuBuffer(handles[i], targets[i]);
            }

            return(result);
        }