Module OgamlGraphics.Text

Text rendering

Submodules

Fx Advanced text rendering

This module provides an efficient way to render text using openGL primitives.

type t
The type of pre-rendered texts.
val create : text:string -> position:OgamlMath.Vector2f.t -> font:Font.t -> ?color:Color.t -> size:int -> ?bold:bool -> unit -> t
Creates a drawable text from the given string.
val draw : (module RenderTarget.T with type t = 'a) -> ?parameters:DrawParameter.t -> text:t -> target:'a -> unit -> unit
Draws text on the screen.
val advance : t -> OgamlMath.Vector2f.t
The global advance of the text. Basically it is a vector such that if you add it to the position of text object, you get the position of the next character you would draw.
val boundaries : t -> OgamlMath.FloatRect.t
Returns a rectangle containing all the text.

Vertex array access

val to_source : t -> VertexArray.SimpleVertex.T.s VertexArray.VertexSource.t -> unit
Outputs text vertices to a vertex array source.
This outputs triangles with UV coordinates, color and position attributes.
Use DrawMode.Triangles with this source and bind the correct font before use.
val map_to_source : t -> (VertexArray.SimpleVertex.T.s VertexArray.Vertex.t -> 'b VertexArray.Vertex.t) -> 'b VertexArray.VertexSource.t -> unit
Outputs text vertices to a vertex array source by mapping its vertices.
See to_source for more information.