100 likes | 114 Views
This update highlights the resolutions and advancements since the previous ARB meeting in December 2004. It covers topics such as EXT_framebuffer_object completion, error behaviors, terminology, relationship with textures and renderbuffers, completeness metrics, and resolved issues. The description also includes sample code for rendering to a 2D texture with a depth buffer and outlines upcoming steps for implementation and further enhancements.
E N D
Super Buffers Workgroup Status update, December 2004
Highlights since last ARB meeting • EXT_framebuffer_object is done! • Can be used for ‘render to texture’ and general off-screen rendering • Only single context needed • Resolved since last ARB meeting • Error behavior when framebuffer cannot be rendered to • What state is per context or per framebuffer object • Error behavior across contexts • What, if any, state can change after a call to BindFramebuffer? • Still on schedule, as presented at last meeting • Sept 2004 – Draft spec with render-to-texture support • Dec 2004 – Final spec. Promoted to ARB (?)
Overview • New objects • Renderbuffer – a new 2D storage object. Holds destination of pixel data resulting from rendering • Framebuffer – Collection of logical buffers (color, depth, stencil) and its state defining where GL output is directed to. • Terminology • Renderbuffer image – 2D array of pixels part of a renderbuffer. • Framebuffer-attachable image – 2D array of pixels that can be attached to a framebuffer. Texture images and renderbuffer images are examples. • Attachment point – State that references a framebuffer-attachable image. One each for color, depth and stencil information of a framebuffer. • Renderable image completeness • Framebuffer attachment completeness • Framebuffer completeness • Renderbuffer images and texture images can be shared among framebuffers.
Overview - cont • When a framebuffer object is bound its attached images are the source and destination for rendering • Color and depth textures • Multiple color attachments to support MRT • Stencil, depth, color renderbuffers
Relationship Framebuffer object Textures (color, depth) Attachment points 2D in nature Renderbuffers (stencil, depth, accum etc) Renderbuffer image is 2D in nature
Framebuffer completeness • Framebuffer completeness • Measures if the framebuffer can be rendered to. • Depends on attachements • Can be implementation specific • If not complete, Begin will generate error INVALID_FRAMEBUFFER_OPERATION • CheckFramebufferStatus • Optional, but useful development tool • Returns enums • FRAMEBUFFER_COMPLETE • FRAMEBUFFER_INCOMPLETE_ATTACHEMENTS • FRAMEBUFFER_INCOMPLETE_IMAGES • FRAMEBUFFER_INCOMPLETE_DIMENSIONS • FRAMEBUFFER_INCOMPLETE_FORMATS • FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER • FRAMEBUFFER_INCOMPLETE_READ_BUFFER • FRAMEBUFFER_UNSUPPORTED • FRAMEBUFFER_STATUS_ERROR • Set of state that can change on a framebuffer bind • AUX_BUFFERS, MAX_DRAW_BUFFERS, STEREO, SAMPLES, X_BITS, DOUBLE_BUFFER and a few more
Resolved since last ARB meeting • At last ARB meeting asked for input on • Begin error behavior • Error behavior across contexts • What state can change after a bind to a framebuffer object • Other noteworthy issues resolved • Drawbuffer state per framebuffer object • Readpixels will throw error when reading from incomplete framebuffer • Include separate GenerateMipmap command • Framebuffer-attachable images cannot change internal format or dimensions • No Accum, No multi-sample support (for now) • Reading from, and rendering to, the same texture image is undefined • Allow rendering to textures with borders and border pixels • No context state influences framebuffer completenes
Example #define CHECK_FRAMEBUFFER_STATUS() \ { \ GLenum status; \ status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); \ switch(status) { \ case GL_FRAMEBUFFER_COMPLETE_EXT: \ break; \ case GL_FRAMEBUFFER_UNSUPPORTED_EXT: \ // choose different formats \ break; \ default: \ // programming error; will fail on all hardware \ assert(0); \ } }
Render to 2D texture with depth buffer // fb, color_tex, depth_rb already allocated // Enable render-to-texture glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb); // Set up color_tex and depth_rb for render-to-texture glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_tex, 0); glFramebufferRenderBufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT, GL_RENDER_BUFFER_EXT, depth_rb); CHECK_FRAMEBUFFER_STATUS(); <draw to the texture and renderbuffer> // Re-enable rendering to the window glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glBindTexture(GL_TEXTURE_2D, color_tex); <draw to the window, reading from the color_tex> Need 16-bit and/or 32-bit fp No benefit Need 32-bit fp Need 16-bit fp
Wrap up • Spec done, start implementing! • Next steps • Format Restrictions API to layer on top • Support Multi-sample, accum as separate extension • Start work on “render-to-vertex-array” • Questions ?