Module Lit.Fbuf

module Fbuf: sig .. end
Framebuffers.


Clears


type clears = {
   clear_color : Gg.color option;
   clear_depth : float option;
   clear_stencil : int option;
}
The type for framebuffer clears. If a field is None the corresponding buffer is not cleared.
val clears_default : clears
clear_default is the default clears:

Attachements


module Rbuf: sig .. end
Render buffers.
type image = [ `Rbuf of Rbuf.t
| `Tex of int * Lit.tex
| `Tex_layer of int * int * Lit.tex ]
The type for framebuffer images.
type attachement = [ `Color of int * image
| `Depth of image
| `Depth_stencil of image
| `Stencil of image ]
The type for framebuffer attachements.

Framebuffers


type t = Lit.fbuf 
The type for framebuffers.
val default : Lit.fbuf
default is the default framebuffer with Lit.Fbuf.clears_default clears.
val create : ?clears:clears -> attachement list -> Lit.fbuf
create attachements is a framebuffer with attachements attachments.
val attachements : Lit.fbuf -> attachement list
attachements fb is fb's attachements. Irrelevant on Lit.Fbuf.default.
val is_multisample : Lit.fbuf -> bool
is_multisample fb is true if fb is a multisample framebuffer. Always false on Lit.Fbuf.default, though not entirely accurate it's always possible to Lit.Fbuf.read from a multisample framebuffer.
val clears : Lit.fbuf -> clears
clears fb is fb's clears.
val set_clears : Lit.fbuf -> clears -> unit
set_clears fb clears sets fb's clears to clears.
val clear : Lit.renderer -> Lit.fbuf -> unit
clear r fb clears the framebuffer fb using clears fb. Only r's Lit.Renderer.view viewport is affected.

Framebuffer status


type status = [ `Complete
| `Incomplete_attachement
| `Incomplete_draw_buffer
| `Incomplete_layer_targets
| `Incomplete_missing_attachement
| `Incomplete_multisample
| `Incomplete_read_buffer
| `Undefined
| `Unknown of int
| `Unsupported ]
The type for frame buffer statuses.
val pp_status : Format.formatter -> status -> unit
pp_status ppf s prints a textual representation of s on ppf.
val status : Lit.renderer -> Lit.fbuf -> status
status r fb is fb's status.

Framebuffer reading and blitting


type read = [ `Color_b of int
| `Color_g of int
| `Color_r of int
| `Color_rgb of int
| `Color_rgba of int
| `Depth
| `Depth_stencil
| `Stencil ]
The type for framebuffer reads. For color components the integer denotes the color attachement (ignored for Lit.Fbuf.default).
val read : ?first:int ->
?w_stride:int ->
Lit.renderer -> Lit.fbuf -> read -> Gg.box2 -> Lit.buf -> unit
read r fb read box buf asynchronously reads the contents of framebuffer fb according to read in the rectangle box specified in integral screen coordinates and stores the result in the GPU buffer of buf, starting at index first (defaults to 0) and using w_stride pixels (defaults to (Box2.w box)) to move from line to line.
Raises Invalid_argument if `Depth_stencil is used and the scalar type of buf is not `UInt32 (the data is packed as 24 bits of depth and 8 bits of stencil) or if is_multisample fb is true.
type blit_buffer = [ `Color | `Depth | `Stencil ] 
The type for framebuffer buffers to blit.
type blit_filter = [ `Linear | `Nearest ] 
The type for blit filter if the blit is only on `Color buffer.
val blit : ?filter:blit_filter ->
Lit.renderer ->
blit_buffer list ->
src:Lit.fbuf -> Gg.box2 -> dst:Lit.fbuf -> Gg.box2 -> unit
blit filter r src sbox dst dbox blits between the buffers bufs src and dfb. blit_filter defaults to `Nearest and can be only set to `Linear for blits that involve only color buffers.

TODO. No way to specify color attachement.

FIXME. There are a lot of things to consider for this operation. We should try to make more checks.