Ejemplo n.º 1
0
 public RenderTarget2D(int width, int height) : base(width, height)
 {
     //generate the FBO
     FBO = GL.GenFramebuffer();
     GL.BindFramebuffer(GL.GL_FRAMEBUFFER, FBO);
     //make the depth buffer
     DepthBuffer = new DepthBuffer(width, height);
     GL.FramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
                                GL.GL_DEPTH_ATTACHMENT,
                                GL.GL_RENDERBUFFER, DepthBuffer.ID);
     //bind the texture
     GL.FramebufferTexture2D(GL.GL_FRAMEBUFFER,
                             GL.GL_COLOR_ATTACHMENT0,
                             GL.GL_TEXTURE_2D, ID, 0);
     //unbind the FBO
     GL.BindFramebuffer(GL.GL_FRAMEBUFFER, 0);
 }
Ejemplo n.º 2
0
 public override void Dispose()
 {
     GL.DeleteFramebuffer(FBO);
     DepthBuffer.Dispose();
     Texture.Dispose();
 }