Beispiel #1
0
        public RenderBuffer(IOpenGL30 gl, int width, int height, PixelInternalFormat internalFormat, int samples)
        {
            if(gl == null)
                throw new ArgumentNullException("gl");

            if(width <= 0)
                throw new ArgumentException("Width must be greater than 0", "width");

            if(height <= 0)
                throw new ArgumentException("Height must be greater than 0.", "height");

            uint handle = gl.GenRenderBuffer();
            if(handle == 0)
                throw new NoHandleCreatedException();

            Handle = handle;
            Width = width;
            Height = height;
            InternalFormat = internalFormat;
            _gl = gl;

            gl.BindRenderbuffer(Constants.Renderbuffer, Handle);
            gl.RenderbufferStorage(Constants.Renderbuffer, (uint)InternalFormat, Width, Height);
            gl.BindRenderbuffer(Constants.Renderbuffer, 0);
        }