/// <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(); }
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); }