Example #1
0
        /// <summary>
        /// Begins a FrameBuffer Pass. Binds only a Color Buffer. 
        /// </summary>
        /// <param name="buffer"></param>
        public void Begin     (ColorBuffer colorBuffer, ViewPort viewPort)
        {
            Gl.glBindFramebufferEXT        (Gl.GL_FRAMEBUFFER_EXT, this.handle);

            Gl.glFramebufferRenderbufferEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_COLOR_ATTACHMENT0_EXT, Gl.GL_RENDERBUFFER_EXT, colorBuffer.Handle);

            this.CheckStatus(Gl.glCheckFramebufferStatusEXT(Gl.GL_FRAMEBUFFER_EXT));

            this.width  = colorBuffer.Width;

            this.height = colorBuffer.Height;
            
            Gl.glPushAttrib(Gl.GL_VIEWPORT_BIT);

            this.device.ViewPort = viewPort;
        }
Example #2
0
        /// <summary>
        /// Begins a FrameBuffer Pass. Binds only a Color Buffer.
        /// </summary>
        /// <param name="buffer"></param>
        public void Begin(ColorBuffer colorBuffer, ViewPort viewPort)
        {
            Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, this.handle);

            Gl.glFramebufferRenderbufferEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_COLOR_ATTACHMENT0_EXT, Gl.GL_RENDERBUFFER_EXT, colorBuffer.Handle);

            this.CheckStatus(Gl.glCheckFramebufferStatusEXT(Gl.GL_FRAMEBUFFER_EXT));

            this.width = colorBuffer.Width;

            this.height = colorBuffer.Height;

            Gl.glPushAttrib(Gl.GL_VIEWPORT_BIT);

            this.device.ViewPort = viewPort;
        }
Example #3
0
        /// <summary>
        /// Begins this Render Buffer with a Texture bound.
        /// </summary>
        /// <param name="texture"></param>
        public void Begin(Texture2D colorTexture, ViewPort viewPort)
        {
            Gl.glBindTexture(Gl.GL_TEXTURE_2D, colorTexture.Handle);

            Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, this.handle);

            Gl.glFramebufferTexture2DEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_COLOR_ATTACHMENT0_EXT, Gl.GL_TEXTURE_2D, colorTexture.Handle, 0);

            this.CheckStatus(Gl.glCheckFramebufferStatusEXT(Gl.GL_FRAMEBUFFER_EXT));

            this.width = colorTexture.Width;

            this.height = colorTexture.Height;

            Gl.glPushAttrib(Gl.GL_VIEWPORT_BIT);

            this.device.ViewPort = viewPort;
        }
Example #4
0
        /// <summary>
        /// Begins Depth Render Pass. Depth Texture TextureFormat "should" be TextureFormat.Depth32
        /// </summary>
        /// <param name="buffer">Color Buffer Render Target</param>
        /// <param name="depthTexture">Depth Texture Render Target</param>
        /// <param name="depthTexture">The Viewport for this FrameBuffer.</param>
        public void BeginDepth(ColorBuffer colorBuffer, Texture2D depthTexture, ViewPort viewPort)
        {
            Gl.glBindTexture(Gl.GL_TEXTURE_2D, depthTexture.Handle);

            Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, this.handle);

            Gl.glFramebufferRenderbufferEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_COLOR_ATTACHMENT0_EXT, Gl.GL_RENDERBUFFER_EXT, colorBuffer.Handle);

            Gl.glFramebufferTexture2DEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_DEPTH_ATTACHMENT_EXT, Gl.GL_TEXTURE_2D, depthTexture.Handle, 0);

            this.CheckStatus(Gl.glCheckFramebufferStatusEXT(Gl.GL_FRAMEBUFFER_EXT));

            this.width = depthTexture.Width;

            this.height = depthTexture.Height;

            Gl.glPushAttrib(Gl.GL_VIEWPORT_BIT);

            this.device.ViewPort = viewPort;
        }
Example #5
0
        /// <summary>
        /// Begins Depth Render Pass. Depth Texture TextureFormat "should" be TextureFormat.Depth32
        /// </summary>
        /// <param name="buffer">Color Buffer Render Target</param>
        /// <param name="depthTexture">Depth Texture Render Target</param>
        /// <param name="depthTexture">The Viewport for this FrameBuffer.</param>
        public void BeginDepth(ColorBuffer colorBuffer,      Texture2D depthTexture, ViewPort viewPort)
        {
            Gl.glBindTexture(Gl.GL_TEXTURE_2D, depthTexture.Handle);

            Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, this.handle);

            Gl.glFramebufferRenderbufferEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_COLOR_ATTACHMENT0_EXT, Gl.GL_RENDERBUFFER_EXT, colorBuffer.Handle);

            Gl.glFramebufferTexture2DEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_DEPTH_ATTACHMENT_EXT, Gl.GL_TEXTURE_2D, depthTexture.Handle, 0);

            this.CheckStatus(Gl.glCheckFramebufferStatusEXT(Gl.GL_FRAMEBUFFER_EXT));

            this.width = depthTexture.Width;

            this.height = depthTexture.Height;

            Gl.glPushAttrib(Gl.GL_VIEWPORT_BIT);

            this.device.ViewPort = viewPort;
        }
Example #6
0
        /// <summary>
        /// Begins a Texture Cube Rendering Pass.
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="face"></param>
        public void Begin     (TextureCube colorTextureCube, DepthBuffer depthBuffer, TextureCubeFace face, ViewPort viewPort)
        {
            Gl.glBindFramebufferEXT        (Gl.GL_FRAMEBUFFER_EXT , this.handle);
 
            Gl.glFramebufferTexture2DEXT   (Gl.GL_FRAMEBUFFER_EXT , Gl.GL_COLOR_ATTACHMENT0_EXT, (int)face, colorTextureCube.Handle, 0);

            Gl.glFramebufferRenderbufferEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_DEPTH_ATTACHMENT_EXT, Gl.GL_RENDERBUFFER_EXT, depthBuffer.Handle);

            this.CheckStatus(Gl.glCheckFramebufferStatusEXT(Gl.GL_FRAMEBUFFER_EXT));
            
            Gl.glPushAttrib(Gl.GL_VIEWPORT_BIT);

            this.device.ViewPort = viewPort;
        }
Example #7
0
        /// <summary>
        /// Begins this Render Buffer with a Texture bound.  
        /// </summary>
        /// <param name="texture"></param>
        public void Begin     (Texture2D   colorTexture,     ViewPort viewPort)
        {
            Gl.glBindTexture            (Gl.GL_TEXTURE_2D, colorTexture.Handle);
            
            Gl.glBindFramebufferEXT     (Gl.GL_FRAMEBUFFER_EXT, this.handle);
            
            Gl.glFramebufferTexture2DEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_COLOR_ATTACHMENT0_EXT, Gl.GL_TEXTURE_2D, colorTexture.Handle, 0);

            this.CheckStatus(Gl.glCheckFramebufferStatusEXT(Gl.GL_FRAMEBUFFER_EXT));

            this.width  = colorTexture.Width;
            
            this.height = colorTexture.Height;

            Gl.glPushAttrib(Gl.GL_VIEWPORT_BIT);

            this.device.ViewPort = viewPort;
        }
Example #8
0
        /// <summary>
        /// Begins a Texture Cube Rendering Pass.
        /// </summary>
        /// <param name="texture"></param>
        /// <param name="face"></param>
        public void Begin(TextureCube colorTextureCube, DepthBuffer depthBuffer, TextureCubeFace face, ViewPort viewPort)
        {
            Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, this.handle);

            Gl.glFramebufferTexture2DEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_COLOR_ATTACHMENT0_EXT, (int)face, colorTextureCube.Handle, 0);

            Gl.glFramebufferRenderbufferEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_DEPTH_ATTACHMENT_EXT, Gl.GL_RENDERBUFFER_EXT, depthBuffer.Handle);

            this.CheckStatus(Gl.glCheckFramebufferStatusEXT(Gl.GL_FRAMEBUFFER_EXT));

            Gl.glPushAttrib(Gl.GL_VIEWPORT_BIT);

            this.device.ViewPort = viewPort;
        }