Module Lit.Tex

module Tex: sig .. end
Textures.

TODO We need to introduce Tex.sampler which will map to GL's 3.3 sampler objects. A tex uniform will then be a pair Tex.t * Tex.sampler (mmh except for Buffer textures...). The fallback should simply set the parameters and we should say that in renderers that don't support rendering a tex with different Tex.sampler won't work.



Textures


type wrap = [ `Clamp_to_edge | `Mirrored_repeat | `Repeat ] 
The type for texture wraps
val pp_wrap : Format.formatter -> wrap -> unit
pp_wrap ppf w prints a textual representation of w on ppf
type mag_filter = [ `Linear | `Nearest ] 
The type for magnification filters.
val pp_mag_filter : Format.formatter -> mag_filter -> unit
pp_mag_filter ppf m prints a textual representation of m on ppf
type min_filter = [ `Linear
| `Linear_mipmap_linear
| `Linear_mipmap_nearest
| `Nearest
| `Nearest_mipmap_linear
| `Nearest_mipmap_nearest ]
The type for minification filters.
val pp_min_filter : Format.formatter -> min_filter -> unit
pp_mag_filter ppf m prints a textual representation of m on ppf
type kind = [ `Buffer | `D1 | `D2 | `D2_ms | `D3 | `D3_ms ] 
The type for kinds of textures. TODO add `Cube_map
val pp_kind : Format.formatter -> kind -> unit
pp_kind ppf k prints a textual representation of k on ppf
type sample_format = [ `D1 of Gg.Ba.scalar_type * bool
| `D2 of Gg.Ba.scalar_type * bool
| `D3 of Gg.Ba.scalar_type * bool
| `D4 of Gg.Ba.scalar_type * bool
| `Depth of [ `Float32 | `UInt16 | `UInt24 ]
| `Depth_stencil of [ `Float32_UInt8 | `UInt24_UInt8 ]
| `SRGB of [ `UInt8 ]
| `SRGBA of [ `UInt8 ]
| `Stencil of [ `UInt8 ] ]
The type for texture sample formats. This defines the internal texture format and how Lit.Tex.init buffers are read (dimension). For `D1 to `D4 the boolean indicates if normalization should be performed for signed and unsigned integers scalar types.

Note. Renderers may not support all sample formats. This can by testing membership in Renderer.Tex.sample_formats.

val pp_sample_format : Format.formatter -> sample_format -> unit
pp_sample_format ppf sf prints a textual representation of sp on ppf.
type init = [ `Buffer of sample_format * Lit.Buf.t
| `D1 of sample_format * float * Lit.Buf.t option
| `D2 of sample_format * Gg.size2 * Lit.Buf.t option
| `D2_ms of sample_format * Gg.size2 * int * bool
| `D3 of sample_format * Gg.size3 * Lit.Buf.t option
| `D3_ms of sample_format * Gg.size3 * int * bool ]
The type for texture initialisation, determines the kind of the the texture.

Buffers image data pixel by pixel in row order then layer order, the first pixel of the buffer is the image's lower left frontmost pixel.

val pp_init : Format.formatter -> init -> unit
pp_init ppf init prints a textual representation of init on ppf.
val init_of_raster : ?buf:bool ->
?cpu_autorelease:bool ->
?usage:Lit.Buf.usage ->
?kind:kind ->
?sample_format:sample_format ->
?norm:bool -> Gg.raster -> init
init_of_raster r is a texture init value derived from raster.
Raises Invalid_argument If the raster's sample format dimension is greater than 4 or if kind specifies a multisample texture.
type t = Lit.tex 
The type for textures.
val nil : Lit.tex
nil is a stub texture that can be used for example to initialize texture uniforms. Trying to render the nil texture results in an error.
val create : ?wrap_s:wrap ->
?wrap_t:wrap ->
?wrap_r:wrap ->
?mipmaps:bool ->
?min_filter:min_filter ->
?mag_filter:mag_filter ->
?buf_autorelease:bool -> init -> Lit.tex

Raises Invalid_argumnet if the init spec is inconsistent.
val sample_format : Lit.tex -> sample_format
sample_format t is t's sample format.
val kind : Lit.tex -> kind
kind t is t's texture kind.
val size2 : Lit.tex -> Gg.size2
size2 t is t's width and height.
val size3 : Lit.tex -> Gg.size3
size3 t is t's width and height in samples.
val buf : Lit.tex -> Lit.Buf.t option
buf is t's buffer if any.
val set_buf : Lit.tex -> Lit.Buf.t option -> unit
set_buf t b sets t's buffer to b.
val buf_autorelease : Lit.tex -> bool
val set_buf_autorelease : Lit.tex -> bool -> unit
val gpu_update : Lit.tex -> bool
val set_gpu_update : Lit.tex -> bool -> unit
Needs to be called if you change the underlying buffer and want buffer changes to be picked up.
val wrap_s : Lit.tex -> wrap
wrap_s t is t's texturing wrapping mode in the s dimension.
val wrap_t : Lit.tex -> wrap
wrap_t t is t's texturing wrapping mode in the t dimension.
val wrap_r : Lit.tex -> wrap
wrap_r t is t's texturing wrapping mode in the r dimension.
val mipmaps : Lit.tex -> bool
mipmaps t is true if mipmaps are generated for texture.
val min_filter : Lit.tex -> min_filter
min_filter t is t's minification filter.
val mag_filter : Lit.tex -> mag_filter
min_filter t is t's magnification filter.
val multisample : Lit.tex -> int * bool
multisample t is t's multisample parameters.
Raises Invalid_argument if t's kind is not `D{2,3}_ms.
val pp : Format.formatter -> Lit.tex -> unit
pp ppf t is a textual represenation of t on ppf.