.TH "ktxTexture" 3 "Sun Jun 14 2026 18:00:57" "Version 0.0.0" "libktx Reference" \" -*- nroff -*- .ad l .nh .SH NAME ktxTexture \- Base class representing a texture\&. .SH SYNOPSIS .br .PP .PP \fR#include \fP .SS "Public Types" .in +1c .ti -1c .RI "enum \fBktxTextureCreateStorageEnum\fP " .br .RI "Enum for requesting, or not, allocation of storage for images\&. " .ti -1c .RI "enum \fBktxTextureCreateFlagBits\fP " .br .RI "Flags for requesting services during creation\&. " .ti -1c .RI "typedef \fBKTX_error_code\fP(* \fBPFNKTXITERCB\fP) (int miplevel, int face, int width, int height, int depth, ktx_uint64_t faceLodSize, void *pixels, void *userdata)" .br .RI "Signature of function called by the \fRktxTexture_Iterate*\fP functions to receive image data\&. " .ti -1c .RI "typedef ktx_uint32_t \fBktxTextureCreateFlags\fP" .br .RI "Type for TextureCreateFlags parameters\&. " .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture_GLUpload\fP (\fBktxTexture\fP *This, GLuint *pTexture, GLenum *pTarget, GLenum *pGlerror)" .br .RI "Create a GL texture object from a \fBktxTexture\fP object\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture_CreateFromStream\fP (\fBktxStream\fP *pStream, \fBktxTextureCreateFlags\fP createFlags, \fBktxTexture\fP **newTex)" .br .RI "Create a ktx1 or ktx2 texture according to the stream data\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture_CreateFromStdioStream\fP (FILE *stdioStream, \fBktxTextureCreateFlags\fP createFlags, \fBktxTexture\fP **newTex)" .br .RI "Create a \fBktxTexture1\fP or \fBktxTexture2\fP from a stdio stream according to the stream data\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture_CreateFromNamedFile\fP (const char *const filename, \fBktxTextureCreateFlags\fP createFlags, \fBktxTexture\fP **newTex)" .br .RI "Create a \fBktxTexture1\fP or \fBktxTexture2\fP from a named KTX file according to the file contents\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture_CreateFromMemory\fP (const ktx_uint8_t *bytes, ktx_size_t size, \fBktxTextureCreateFlags\fP createFlags, \fBktxTexture\fP **newTex)" .br .RI "Create a \fBktxTexture1\fP or \fBktxTexture2\fP from KTX-formatted data in memory according to the data contents\&. " .ti -1c .RI "ktx_uint8_t * \fBktxTexture_GetData\fP (\fBktxTexture\fP *This)" .br .RI "Return a pointer to the texture image data\&. " .ti -1c .RI "ktx_size_t \fBktxTexture_GetDataSize\fP (\fBktxTexture\fP *This)" .br .RI "Return the total size of the texture image data in bytes\&. " .ti -1c .RI "ktx_uint32_t \fBktxTexture_GetElementSize\fP (\fBktxTexture\fP *This)" .br .RI "Return the size in bytes of an elements of a texture's images\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture_IterateLevelFaces\fP (\fBktxTexture\fP *This, \fBPFNKTXITERCB\fP iterCb, void *userdata)" .br .RI "Iterate over the levels or faces in a \fBktxTexture\fP object\&. " .ti -1c .RI "ktx_uint32_t \fBktxTexture_GetRowPitch\fP (\fBktxTexture\fP *This, ktx_uint32_t level)" .br .RI "Return pitch between rows of a texture image level in bytes\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture_VkUploadEx_WithSuballocator\fP (\fBktxTexture\fP *This, \fBktxVulkanDeviceInfo\fP *vdi, \fBktxVulkanTexture\fP *vkTexture, VkImageTiling tiling, VkImageUsageFlags usageFlags, VkImageLayout finalLayout, \fBktxVulkanTexture_subAllocatorCallbacks\fP *subAllocatorCallbacks)" .br .RI "Create a Vulkan image object from a \fBktxTexture\fP object\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture_VkUploadEx\fP (\fBktxTexture\fP *This, \fBktxVulkanDeviceInfo\fP *vdi, \fBktxVulkanTexture\fP *vkTexture, VkImageTiling tiling, VkImageUsageFlags usageFlags, VkImageLayout finalLayout)" .br .RI "Create a Vulkan image object from a \fBktxTexture\fP object\&. " .ti -1c .RI "\fBKTX_error_code\fP \fBktxTexture_VkUpload\fP (\fBktxTexture\fP *texture, \fBktxVulkanDeviceInfo\fP *vdi, \fBktxVulkanTexture\fP *vkTexture)" .br .RI "Create a Vulkan image object from a \fBktxTexture\fP object\&. " .ti -1c .RI "VkFormat \fBktxTexture_GetVkFormat\fP (\fBktxTexture\fP *This)" .br .RI "Return the VkFormat enum of a \fBktxTexture\fP object\&. " .in -1c .SS "Data Fields" .in +1c .ti -1c .RI "class_id \fBclassId\fP" .br .RI "Identify the class type\&. " .ti -1c .RI "struct \fBktxTexture_vtbl\fP * \fBvtbl\fP" .br .RI "Pointer to the class's vtble\&. " .ti -1c .RI "struct ktxTexture_vvtbl * \fBvvtbl\fP" .br .RI "Pointer to the class's vtble for Vulkan functions\&. " .ti -1c .RI "struct ktxTexture_protected * \fB_protected\fP" .br .RI "Opaque pointer to the class's protected variables\&. " .ti -1c .RI "ktx_bool_t \fBisArray\fP" .br .ti -1c .RI "ktx_bool_t \fBisCubemap\fP" .br .ti -1c .RI "ktx_bool_t \fBisCompressed\fP" .br .ti -1c .RI "ktx_bool_t \fBgenerateMipmaps\fP" .br .ti -1c .RI "ktx_uint32_t \fBbaseWidth\fP" .br .RI "Width of the texture's base level\&. " .ti -1c .RI "ktx_uint32_t \fBbaseHeight\fP" .br .RI "Height of the texture's base level\&. " .ti -1c .RI "ktx_uint32_t \fBbaseDepth\fP" .br .RI "Depth of the texture's base level\&. " .ti -1c .RI "ktx_uint32_t \fBnumDimensions\fP" .br .RI "Number of dimensions in the texture: 1, 2 or 3\&. " .ti -1c .RI "ktx_uint32_t \fBnumLevels\fP" .br .RI "Number of mip levels in the texture\&. " .ti -1c .RI "ktx_uint32_t \fBnumFaces\fP" .br .RI "Number of faces: 6 for cube maps, 1 otherwise\&. " .ti -1c .RI "struct {" .br .ti -1c .RI "} \fBorientation\fP" .br .RI "Describes the logical orientation of the images in each dimension\&. " .ti -1c .RI "\fBktxHashList\fP \fBkvDataHead\fP" .br .RI "Head of the hash list of metadata\&. " .ti -1c .RI "ktx_uint32_t \fBkvDataLen\fP" .br .RI "Length of the metadata, if it has been extracted in its raw form, otherwise 0\&. " .ti -1c .RI "ktx_uint8_t * \fBkvData\fP" .br .RI "Pointer to the metadata, if it has been extracted in its raw form, otherwise NULL\&. " .ti -1c .RI "ktx_size_t \fBdataSize\fP" .br .RI "Byte length of the texture's uncompressed image data\&. " .ti -1c .RI "ktx_uint8_t * \fBpData\fP" .br .RI "Pointer to the start of the image data\&. " .in -1c .SH "Detailed Description" .PP Base class representing a texture\&. ktxTextures should be created only by one of the provided functions and these fields should be considered read-only\&. .PP \fBExamples\fP .in +1c \fBglloader\&.c\fP, and \fBvkload\&.cpp\fP\&. .SH "Member Typedef Documentation" .PP .SS "typedef ktx_uint32_t \fBktxTextureCreateFlags\fP" .PP Type for TextureCreateFlags parameters\&. .PP \fBSee also\fP .RS 4 ktxTexture_CreateFrom*() .RE .PP .SS "typedef \fBKTX_error_code\fP(* PFNKTXITERCB) (int miplevel, int face, int width, int height, int depth, ktx_uint64_t faceLodSize, void *pixels, void *userdata)" .PP Signature of function called by the \fRktxTexture_Iterate*\fP functions to receive image data\&. The function parameters are used to pass values which change for each image\&. Obtain values which are uniform across all images from the \fR\fBktxTexture\fP\fP object\&. .PP \fBParameters\fP .RS 4 \fImiplevel\fP MIP level from 0 to the max level which is dependent on the texture size\&. .br \fIface\fP usually 0; for cube maps, one of the 6 cube faces in the order +X, -X, +Y, -Y, +Z, -Z, 0 to 5\&. .br \fIwidth\fP width of the image\&. .br \fIheight\fP height of the image or, for 1D textures textures, 1\&. .br \fIdepth\fP depth of the image or, for 1D & 2D textures, 1\&. .br \fIfaceLodSize\fP number of bytes of data pointed at by \fRpixels\fP\&. .br \fIpixels\fP pointer to the image data\&. .br \fIuserdata\fP pointer for the application to pass data to and from the callback function\&. .RE .PP .SH "Member Enumeration Documentation" .PP .SS "enum \fBktxTextureCreateFlagBits\fP" .PP Flags for requesting services during creation\&. .PP \fBSee also\fP .RS 4 ktxTexture_CreateFrom* .RE .PP .SS "enum \fBktxTextureCreateStorageEnum\fP" .PP Enum for requesting, or not, allocation of storage for images\&. .PP \fBSee also\fP .RS 4 ktxTexture1_Create() and ktxTexture2_Create()\&. .RE .PP .SH "Field Documentation" .PP .SS "class_id classId" .PP Identify the class type\&. Since there are no public \fBktxTexture\fP constructors, this can only have values of ktxTexture1_c or ktxTexture2_c\&. .PP \fBExamples\fP .in +1c \fBglloader\&.c\fP\&. .SS "ktx_bool_t generateMipmaps" KTX_TRUE if mipmaps should be generated for the texture by \fBktxTexture_GLUpload()\fP or \fBktxTexture_VkUpload()\fP\&. .PP \fBExamples\fP .in +1c \fBglloader\&.c\fP\&. .SS "ktx_bool_t isArray" KTX_TRUE if the texture is an array texture, i\&.e, a GL_TEXTURE_*_ARRAY target is to be used\&. .PP \fBExamples\fP .in +1c \fBglloader\&.c\fP\&. .SS "ktx_bool_t isCompressed" KTX_TRUE if the texture's format is a block compressed format\&. .PP \fBExamples\fP .in +1c \fBglloader\&.c\fP\&. .SS "ktx_bool_t isCubemap" KTX_TRUE if the texture is a cubemap or cubemap array\&. .SS "ktx_uint32_t numLevels" .PP Number of mip levels in the texture\&. Number of array layers in the texture\&. .PP Must be 1, if \fRgenerateMipmaps\fP is KTX_TRUE\&. Can be less than a full pyramid but always starts at the base level\&. .PP \fBExamples\fP .in +1c \fBglloader\&.c\fP\&. .SS "struct { \&.\&.\&. } orientation" .PP Describes the logical orientation of the images in each dimension\&. ktxOrientationX for X, ktxOrientationY for Y and ktxOrientationZ for Z\&. .SS "struct ktxTexture_vvtbl* vvtbl" .PP Pointer to the class's vtble for Vulkan functions\&. A separate vtble is used so this header does not need to include vulkan\&.h\&. .SH "Author" .PP Generated automatically by Doxygen for libktx Reference from the source code\&.