Module OgamlGraphics.Framebuffer

Framebuffer creation and manipulation

This module provides a safe way to create framebuffer objects (FBO) and attach textures to them.

exception FBO_Error of string
Raised if an error occurs at creation or during an attachment
type t
Type of a framebuffer object
val create : (module RenderTarget.T with type t = 'a) -> 'a -> t
Creates a framebuffer from a valid context
val attach_color : (module Attachment.ColorAttachable with type t = 'a) -> t -> int -> 'a -> unit
Attaches a valid color attachment to a framebuffer at a given index. Raises Error if the index is greater than the maximum number of color attachments allowed by the context, or if the attachment is larger than the maximum size allowed by the context.

See : OgamlGraphics.Attachment.ColorAttachable
See : OgamlGraphics.Context
val attach_depth : (module Attachment.DepthAttachable with type t = 'a) -> t -> 'a -> unit
Attaches a valid depth attachment to a framebuffer. Raises Error if the attachment is larger than the maximum size allowed by the context.

See : OgamlGraphics.Attachment.DepthAttachable
See : OgamlGraphics.Context
val attach_stencil : (module Attachment.StencilAttachable with type t = 'a) -> t -> 'a -> unit
Attaches a valid stencil attachment to a framebuffer. Raises Error if the attachment is larger than the maximum size allowed by the context.

See : OgamlGraphics.Attachment.StencilAttachable
See : OgamlGraphics.Context
val attach_depthstencil : (module Attachment.DepthStencilAttachable with type t = 'a) -> t -> 'a -> unit
Attaches a valid depth and stencil attachment to a framebuffer. Raises Error if the attachment is larger than the maximum size allowed by the context.

See : OgamlGraphics.Attachment.DepthStencilAttachable
See : OgamlGraphics.Context
val has_color : t -> bool
Returns true iff the FBO has a color attachment
val has_depth : t -> bool
Returns true iff the FBO has a depth attachment
val has_stencil : t -> bool
Returns true iff the FBO has a stencil attachment
val size : t -> OgamlMath.Vector2i.t
Returns the size of an FBO, that is the intersection of the sizes of its attachments. Returns the maximal allowed size if nothing has been attached to this FBO
val context : t -> Context.t
Returns the GL context associated to the FBO
val clear : ?color:Color.t option -> ?depth:bool -> ?stencil:bool -> t -> unit
Clears the FBO
val bind : t -> DrawParameter.t -> unit
Binds the FBO for drawing. Internal use only.