상속: IBindable
예제 #1
0
        /// <summary>
        /// This is the easiest constructor to use when you already have a texture, and you
        /// want to draw into it.  Just pass the texture in, and the RenderTarget will be
        /// constructed to match the size.
        /// </summary>
        /// <param name="gi"></param>
        /// <param name="texture"></param>
        public GLRenderTarget(GLTexture2D texture)
            : this(texture.GI)
        {
            fWidth = texture.Width;
            fHeight = texture.Height;

            FrameBuffer.Bind();

            // Create the render buffer to be attached as a depth
            // buffer.
            fDepthBuffer = new GLRenderBuffer(fGI);
            fDepthBuffer.Bind();
            fDepthBuffer.AllocateStorage(fWidth, fHeight, gl.GL_DEPTH_COMPONENT);
            
            fFrameBuffer.AttachDepthBuffer(fDepthBuffer);

            // Create the texture object to be attached as color buffer    
            AttachColorBuffer(texture, ColorBufferAttachPoint.Position0);

            FrameBuffer.Unbind();
        }
예제 #2
0
        void CreateDepthBuffer(int width, int height)
        {
            // Create the render buffer to be attached as a depth
            // buffer.
            fDepthBuffer = new GLRenderBuffer(fGI);
            fDepthBuffer.Bind();
            fDepthBuffer.AllocateStorage(width, height, gl.GL_DEPTH_COMPONENT);

            fFrameBuffer.AttachDepthBuffer(fDepthBuffer);
        }
예제 #3
0
 public void AttachRenderBuffer(GLRenderBuffer rendBuffer)
 {
     GI.FramebufferRenderbuffer(gl.GL_FRAMEBUFFER_EXT, gl.GL_COLOR_ATTACHMENT0_EXT, gl.GL_RENDERBUFFER_EXT, rendBuffer.BufferID);
 }
예제 #4
0
 /// <summary>
 /// Attach a RenderBuffer as the depth buffer of the FrameBuffer set.
 /// </summary>
 /// <param name="depthbuffer"></param>
 public void AttachDepthBuffer(GLRenderBuffer depthbuffer)
 {
     GI.FramebufferRenderbuffer(gl.GL_FRAMEBUFFER_EXT, gl.GL_DEPTH_ATTACHMENT_EXT, gl.GL_RENDERBUFFER_EXT, depthbuffer.BufferID);
 }
예제 #5
0
 public void AttachRenderBuffer(GLRenderBuffer rendBuffer, int attachtype)
 {
     GI.FramebufferRenderbuffer(gl.GL_FRAMEBUFFER_EXT, attachtype, gl.GL_RENDERBUFFER_EXT, rendBuffer.BufferID);
 }