public Framebuffer(int width, int height, bool depth, bool interpol) { FramebufferTexture texture = new FramebufferTexture(); texture.setFormat(OpenGL.GL_RGBA16F, width, height, OpenGL.GL_RGBA, false, interpol); setup(texture, depth); }
public void addColorAttachment(uint internalfmt, uint format, bool mipmap, bool interpol) { FramebufferTexture texture = new FramebufferTexture(); texture.setFormat(internalfmt, m_width, m_height, format, mipmap, interpol); addColorAttachment(texture); }
private void setup(FramebufferTexture color0, bool depth) { m_width = color0.width(); m_height = color0.height(); /* Create render buffer object for depth buffering */ if (depth) { m_depth = new FramebufferTexture(); m_depth.setFormat(OpenGL.GL_DEPTH_COMPONENT24, m_width, m_height, OpenGL.GL_DEPTH_COMPONENT, false, false); } else { m_depth = null; } /* Create and bind new FBO */ glGenFramebuffers(1, framebufferId); glBindFramebuffer(OpenGL.GL_FRAMEBUFFER_EXT, framebufferId[0]); glFramebufferTexture2D(OpenGL.GL_FRAMEBUFFER_EXT, attachment_id[m_color.Count], OpenGL.GL_TEXTURE_2D, color0.glID(), 0); m_color.Add(color0); if (m_depth != null) { glFramebufferTexture2D(OpenGL.GL_FRAMEBUFFER_EXT, OpenGL.GL_DEPTH_ATTACHMENT_EXT, OpenGL.GL_TEXTURE_2D, m_depth.glID(), 0); } uint result = glCheckFramebufferStatus(OpenGL.GL_FRAMEBUFFER_EXT); if (result != OpenGL.GL_FRAMEBUFFER_COMPLETE_EXT) { throw new Exception("Failed to create frame buffer object!"); } useAllAttachments(); /* Uibind FBO */ glBindFramebuffer(OpenGL.GL_FRAMEBUFFER_EXT, 0); }
private void setup(FramebufferTexture color0, bool depth) { this.Width = color0.Width; this.Height = color0.Width; /* Create render buffer object for depth buffering */ if (depth) { m_depth = new FramebufferTexture(); m_depth.setFormat(OpenGL.GL_DEPTH_COMPONENT24, this.Width, this.Height, OpenGL.GL_DEPTH_COMPONENT, false, false); } else { m_depth = null; } /* Create and bind new FBO */ glGenFramebuffers(1, framebufferId); glBindFramebuffer(OpenGL.GL_FRAMEBUFFER, framebufferId[0]); glFramebufferTexture2D(OpenGL.GL_FRAMEBUFFER, attachment_id[m_color.Count], OpenGL.GL_TEXTURE_2D, color0.TextureId, 0); m_color.Add(color0); if (m_depth != null) { glFramebufferTexture2D(OpenGL.GL_FRAMEBUFFER, OpenGL.GL_DEPTH_ATTACHMENT, OpenGL.GL_TEXTURE_2D, m_depth.TextureId, 0); } uint result = glCheckFramebufferStatus(OpenGL.GL_FRAMEBUFFER); if (result != OpenGL.GL_FRAMEBUFFER_COMPLETE) { throw new Exception("Failed to create frame buffer object!"); } useAllAttachments(); /* Uibind FBO */ glBindFramebuffer(OpenGL.GL_FRAMEBUFFER, 0); }
public void addColorAttachment(uint internalfmt, uint format, bool mipmap, bool interpol) { FramebufferTexture texture = new FramebufferTexture(); texture.setFormat(internalfmt, this.Width, this.Height, format, mipmap, interpol); addColorAttachment(texture); }