示例#1
0
        internal GLRenderBuffer(int width, int height, RenderbufferStorage storage, GLGraphicsContext context)
        {
            this.width = width;
            this.height = height;

            OGL.GenRenderbuffers(1, out renderBufferId);
            context.CheckForErrorsIfDebugging();

            OGL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, renderBufferId);
            OGL.RenderbufferStorage(RenderbufferTarget.Renderbuffer,
                storage, width, height);
            OGL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, 0);

            context.CheckForErrorsIfDebugging();
        }
示例#2
0
        internal GLFrameBuffer(GLRenderBuffer colorBuffer, GLRenderBuffer depthBuffer, FramebufferTarget fbTarget, bool disposeRenderBuffers, GLGraphicsContext context)
            : this(context)
        {
            this.disposeRenderBuffers = disposeRenderBuffers;
            this.colorBuffer = colorBuffer;
            this.depthBuffer = depthBuffer;
            this.fbTarget = fbTarget;

            OGL.BindFramebuffer(fbTarget, fboId);

            OGL.FramebufferRenderbuffer(fbTarget, FramebufferAttachment.ColorAttachment0,
                RenderbufferTarget.Renderbuffer, colorBuffer.Id);
            OGL.FramebufferRenderbuffer(fbTarget, FramebufferAttachment.DepthAttachment,
                RenderbufferTarget.Renderbuffer, depthBuffer.Id);

            FramebufferErrorCode err = OGL.CheckFramebufferStatus(fbTarget);
            switch(err) {
            case FramebufferErrorCode.FramebufferComplete:
                break;
            default:
                this.Dispose();
                throw new Exception(String.Format("Invalid frame buffer status: {0}", err));
            }

            OGL.BindFramebuffer(fbTarget, 0);

            context.CheckForErrorsIfDebugging();
        }
示例#3
0
        private GLFrameBuffer(GLGraphicsContext context)
        {
            this.context = context;

            OGL.GenFramebuffers(1, out fboId);
            context.CheckForErrorsIfDebugging();
        }