Esempio n. 1
0
        public FrameBuffer(int width, int height, FBOAttachment attachments = FBOAttachment.NONE)
        {
            Width  = width;
            Height = height;

            Create(attachments);
        }
Esempio n. 2
0
        private void Create(FBOAttachment attachments)
        {
            var gl = XEngineContext.Graphics;

            gl.GenFramebuffersEXT(1u, glFrameBufferArray);
            gl.BindFramebufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, Id);
            gl.DrawBuffer(OpenGL.GL_COLOR_ATTACHMENT0_EXT);

            if (attachments.HasFlag(FBOAttachment.TextureAttachment))
            {
                AddTextureAttachment();
            }
            if (attachments.HasFlag(FBOAttachment.DepthTextureAttachment))
            {
                AddDepthTextureAttachment();
            }
            if (attachments.HasFlag(FBOAttachment.DepthBufferAttachment))
            {
                AddDepthBufferAttachment();
            }

            gl.BindFramebufferEXT(OpenGL.GL_FRAMEBUFFER_EXT, 0u);
        }