Framebuffer objects
GPU-accelerated rendering

Prev:Texture objects
Next:Shader objects

The gpu.framebuffers vocabulary provides words for creating, allocating, and reading from framebuffer objects. Framebuffer objects are used as rendering targets; the system-framebuffer is supplied by the window system and contains the contents of the window on screen. User-created framebuffer objects can also be created to direct rendering output to offscreen texture s or renderbuffer s.



The contents of a framebuffer can be cleared to known values before rendering a scene:
clear-framebuffer ( framebuffer alist -- )

clear-framebuffer-attachment ( framebuffer: any-framebuffer attachment-ref: attachment-ref value -- )

The image memory for a renderbuffer can be resized, or the full set of textures and renderbuffers attached to a framebuffer can be resized to the same dimensions together:
allocate-renderbuffer ( renderbuffer: renderbuffer dim -- )

resize-framebuffer ( framebuffer: framebuffer dim -- )

Rectangular regions of framebuffers can be read into memory, read into GPU buffer s, and copied between framebuffers:


read-framebuffer ( framebuffer-rect -- byte-array )

read-framebuffer-to ( framebuffer-rect: framebuffer-rect gpu-data-ptr -- )

read-framebuffer-image ( framebuffer-rect: framebuffer-rect -- image )

copy-framebuffer ( to-fb-rect: framebuffer-rect from-fb-rect: framebuffer-rect depth? stencil? filter: texture-filter -- )