Skip to content

CF_TextureParams

Category: graphics
GitHub: cute_graphics.h


A collection of parameters to create a CF_Texture with cf_make_texture.

Struct Members Description
CF_PixelFormat pixel_format The pixel format for this texture's data. See CF_PixelFormat.
CF_TextureUsageFlags usage The memory access pattern for this texture on the GPU. See CF_TextureUsageBits.
CF_Filter filter The filtering operation to use when fetching data out of the texture, on the GPU. See CF_Filter.
CF_WrapMode wrap_u The texture wrapping behavior when addressing beyond [0,1) for the u-coordinate. See CF_WrapMode.
CF_WrapMode wrap_v The texture wrapping behavior when addressing beyond [0,1) for the v-coordinate. See CF_WrapMode.
CF_MipFilter mip_filter The filtering operation to use when fetching data out of a mipmap, on the GPU. See CF_MipFilter.
int width Number of elements (usually pixels) along the width of the texture.
int height Number of elements (usually pixels) along the height of the texture.
int mip_count 0 = auto compute from dimensions if allocate_mipmaps is true, else specify an explicit number.
bool allocate_mipmaps Defaulted to false, true to allocate a full mipmap chain for the texture.
float mip_lod_bias Mipmap level bias; positive = blurrier, negative = sharper.
float max_anisotropy Maximum anisotropy level; 1.0 disables anisotropic filtering.
bool stream Set this to true if you plan to update the texture contents each frame.
CF_TextureType texture_type The texture's shape (2D, cube, 3D, or 2D array). Defaults to CF_TEXTURE_TYPE_2D,
so zero-initialized params behave exactly as before this member existed. See CF_TextureType.
int layer_count For CF_TEXTURE_TYPE_2D_ARRAY the number of layers; for CF_TEXTURE_TYPE_3D the
depth. Zero means one. Cube maps always have six faces and ignore this. Upload individual
faces/layers/slices with cf_texture_update_layer.
bool compare_enable True to make this a comparison (shadow) sampler: sampler2DShadow in the shader,
where each fetch compares the reference value against the texel and returns a visibility
factor, with hardware PCF where available. Pair with a depth pixel_format and
compare_function (typically CF_COMPARE_FUNCTION_LESS_THAN_OR_EQUAL).
CF_CompareFunction compare_function The comparison used when compare_enable is true. See CF_CompareFunction.

Remarks

You may get a set of good default values by calling cf_texture_defaults.

cf_texture_update
cf_texture_defaults
CF_Texture
cf_make_texture
cf_destroy_texture