예제 #1
0
        public StandardUniformsBufferObject() :
            base()
        {
            var handle = CurrentContext.CreateBuffer();

            try {
                Context.BindUniformBuffer(handle);
                Context.BufferData(BindBufferTarget.UniformBuffer, SizeInBytes, IntPtr.Zero, BufferUsage.StreamDraw);
                Context.BindBufferBase(BindBufferTarget.UniformBuffer, ShaderProgram.StandartUniformsBindingPoint, handle);
            }
            catch {
                Context.DeleteBuffer(handle);
                throw;
            }

            _pointer = Marshal.AllocHGlobal(SizeInBytes);
            Initialize(handle);
        }