module Tex:sig
..end
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.
typewrap =
[ `Clamp_to_edge | `Mirrored_repeat | `Repeat ]
val pp_wrap : Format.formatter -> wrap -> unit
pp_wrap ppf w
prints a textual representation of w
on ppf
typemag_filter =
[ `Linear | `Nearest ]
val pp_mag_filter : Format.formatter -> mag_filter -> unit
pp_mag_filter ppf m
prints a textual representation of m
on ppf
typemin_filter =
[ `Linear
| `Linear_mipmap_linear
| `Linear_mipmap_nearest
| `Nearest
| `Nearest_mipmap_linear
| `Nearest_mipmap_nearest ]
val pp_min_filter : Format.formatter -> min_filter -> unit
pp_mag_filter ppf m
prints a textual representation of m
on ppf
typekind =
[ `Buffer | `D1 | `D2 | `D2_ms | `D3 | `D3_ms ]
val pp_kind : Format.formatter -> kind -> unit
pp_kind ppf k
prints a textual representation of k
on ppf
typesample_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 ] ]
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
.typeinit =
[ `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 ]
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
.
buf
, if true
(default) or kind
is `Buffer
, a Lit
buffer value is created for the raster's buffer
value. cpu_autorelease
and usage
are passed to
Lit.Buf.create
.sample_format
, if unspecified it has r
's sample format
scalar type and dimension. Packed raster sample formats are mapped
to `D1
texture sample format. norm
determines the
normalization if sample_format
is unspecified (see
Lit.Tex.sample_format
, defaults to true
).kind
, if unspecified it is automatically derived to
`D1
, `D2
or `D3
according to the raster's dimension.Invalid_argument
If the raster's sample format dimension is
greater than 4 or if kind
specifies a multisample texture.typet =
Lit.tex
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
wrap_s, wrap_t, wrap_r
, wrapping behaviour, if applicable,
along s
, t
and r
dimensions. Defaults to `Repeat.mipmaps
, if true
generates mipmaps. Defaults to false
.min_filter
, if applicable, minification filter. Defaults to
`Nearest_mipmap_linear
.mag_filter
, if applicable, magnification filter. Defaults to
`Nearest
.buf_autorelease
, doesn't keep a reference on buf once
texture has been uploaded to gpu. Defaults to true
for
`D1 to `D3 but false on `Buffer.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
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.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
.