Exemplo n.º 1
0
        public void Use(int width, int height)
        {
#if nomsaa
            return;
#else
            if (width <= 0 || height <= 0)
            {
                return;
            }
            SafeFrameBuffer.BindFramebuffer(FramebufferTarget.Framebuffer, Framebuffer);
            if (width != Width || height != Height)
            {
                Width  = width;
                Height = height;
                System.Diagnostics.Debug.WriteLine("width: " + width + " height: " + height);

                SafeFrameBuffer.BindRenderbuffer(RenderbufferTarget.Renderbuffer, _renderbuffer);
                SafeFrameBuffer.RenderbufferStorageMultisample(RenderbufferTarget.Renderbuffer, MSAA, RenderbufferStorage.Rgba8, width, height);
                SafeFrameBuffer.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, RenderbufferTarget.Renderbuffer, _renderbuffer);
                SafeFrameBuffer.BindRenderbuffer(RenderbufferTarget.Renderbuffer, 0);
                ErrorCheck();
            }
            ErrorCheck();
            GL.Clear(ClearBufferMask.ColorBufferBit);
#endif
        }
Exemplo n.º 2
0
        public void Use(int width, int height)
        {
#if nomsaa
            return;
#else
            if (width <= 0 || height <= 0)
            {
                return;
            }
            SafeFrameBuffer.BindFramebuffer(FramebufferTarget.Framebuffer, Framebuffer);
            if (width != Width || height != Height)
            {
                Width  = width;
                Height = height;

                SafeFrameBuffer.BindRenderbuffer(RenderbufferTarget.Renderbuffer, _renderbuffer);
                SafeFrameBuffer.RenderbufferStorageMultisample(RenderbufferTarget.Renderbuffer, MSAA, RenderbufferStorage.Rgba8, width, height);

                SafeFrameBuffer.BindRenderbuffer(RenderbufferTarget.Renderbuffer, _stencilbuffer);
                SafeFrameBuffer.RenderbufferStorageMultisample(RenderbufferTarget.Renderbuffer, MSAA, RenderbufferStorage.Depth24Stencil8, width, height);

                SafeFrameBuffer.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.StencilAttachment, RenderbufferTarget.Renderbuffer, _stencilbuffer);

                SafeFrameBuffer.FramebufferRenderbuffer(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, RenderbufferTarget.Renderbuffer, _renderbuffer);
                SafeFrameBuffer.BindRenderbuffer(RenderbufferTarget.Renderbuffer, 0);
                ErrorCheck();
            }
            ErrorCheck();
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.StencilBufferBit);
#endif
        }