/// <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; }
/// <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; }
/// <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; }
/// <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> public void BeginDepth(ColorBuffer colorBuffer, Texture2D depthTexture) { this.BeginDepth(colorBuffer, depthTexture, new ViewPort(0, 0, depthTexture.Width, depthTexture.Height)); }
/// <summary> /// Binds a ColorBuffer and Depth Buffer. A Frame Buffer "must" be bound with a depth buffer if you intend on /// rendering geometry with this FrameBuffer. /// </summary> /// <param name="buffer"></param> /// <param name="depthBuffer"></param> public void Begin (ColorBuffer colorBuffer, DepthBuffer depthBuffer) { this.Begin(colorBuffer, depthBuffer, new ViewPort(0, 0, colorBuffer.Width, colorBuffer.Height)); }
/// <summary> /// Binds a ColorBuffer and Depth Buffer. A Frame Buffer "must" be bound with a depth buffer if you intend on /// rendering geometry with this FrameBuffer. /// </summary> /// <param name="buffer"></param> /// <param name="depthBuffer"></param> public void Begin(ColorBuffer colorBuffer, DepthBuffer depthBuffer) { this.Begin(colorBuffer, depthBuffer, new ViewPort(0, 0, colorBuffer.Width, colorBuffer.Height)); }