libktx - The KTX Library
ktx.h File Reference

Declares the public functions and structures of the KTX API. More...

#include <stdio.h>
#include <stdint.h>

Data Structures

class  ktxTexture
 Class representing a texture. More...
 
struct  ktxTextureCreateInfo
 Structure for passing texture information to ktxTexture_Create(). More...
 
struct  KTX_dimensions
 Structure used by load functions to return texture dimensions. More...
 
struct  KTX_texture_info
 Structure to pass texture information to ktxWriteKTX. More...
 
struct  KTX_image_info
 Structure used to pass image data to ktxWriteKTX. More...
 

Macros

#define KTX_ORIENTATION_KEY   "KTXorientation"
 Key String for standard orientation value.
 
#define KTX_ORIENTATION2_FMT   "S=%c,T=%c"
 Standard format for 2D orientation value.
 
#define KTX_ORIENTATION3_FMT   "S=%c,T=%c,R=%c"
 Standard format for 3D orientation value.
 
#define KTX_GL_UNPACK_ALIGNMENT   4
 Required unpack alignment.
 
#define ktxHashTable_Destroy(a)   ktxHashList_Destroy(a);
 Destroy a KTX_hash_table. More...
 
#define ktxHashTable_AddKVPair(a, b, c, d)   ktxHashList_AddKVPair(a, b, c, d)
 Add a key-value pair to a KTX_hash_table. More...
 
#define ktxHashTable_FindValue(a, b, c, d)   ktxHashList_FindValue(a, b, c, d)
 Looks up a key and returns its value. More...
 

Typedefs

typedef enum KTX_error_code_t ktxResult
 Result codes returned by library functions.
 

Enumerations

enum  KTX_error_code {
  KTX_SUCCESS = 0, KTX_FILE_DATA_ERROR, KTX_FILE_OPEN_FAILED, KTX_FILE_OVERFLOW,
  KTX_FILE_READ_ERROR, KTX_FILE_SEEK_ERROR, KTX_FILE_UNEXPECTED_EOF, KTX_FILE_WRITE_ERROR,
  KTX_GL_ERROR, KTX_INVALID_OPERATION, KTX_INVALID_VALUE, KTX_NOT_FOUND,
  KTX_OUT_OF_MEMORY, KTX_UNKNOWN_FILE_FORMAT, KTX_UNSUPPORTED_TEXTURE_TYPE
}
 Error codes returned by library functions. More...
 

Functions

KTX_error_code ktxLoadTextureF (FILE *, GLuint *pTexture, GLenum *pTarget, KTX_dimensions *pDimensions, GLboolean *pIsMipmapped, GLenum *pGlerror, unsigned int *pKvdLen, unsigned char **ppKvd)
 Create a GL texture object from KTX data in a stdio FILE stream. More...
 
KTX_error_code ktxLoadTextureN (const char *const filename, GLuint *pTexture, GLenum *pTarget, KTX_dimensions *pDimensions, GLboolean *pIsMipmapped, GLenum *pGlerror, unsigned int *pKvdLen, unsigned char **ppKvd)
 Create a GL texture object from KTX data in a named file on disk. More...
 
KTX_error_code ktxLoadTextureM (const void *bytes, GLsizei size, GLuint *pTexture, GLenum *pTarget, KTX_dimensions *pDimensions, GLboolean *pIsMipmapped, GLenum *pGlerror, unsigned int *pKvdLen, unsigned char **ppKvd)
 Create a GL texture object from KTX formatted data in memory. More...
 
KTX_error_code ktxWriteKTXF (FILE *dst, const KTX_texture_info *imageInfo, GLsizei bytesOfKeyValueData, const void *keyValueData, GLuint numImages, KTX_image_info images[])
 Write image(s) in KTX format to a stdio FILE stream. More...
 
KTX_error_code ktxWriteKTXN (const char *dstname, const KTX_texture_info *imageInfo, GLsizei bytesOfKeyValueData, const void *keyValueData, GLuint numImages, KTX_image_info images[])
 Write image(s) in KTX format to a file on disk. More...
 
KTX_error_code ktxWriteKTXM (unsigned char **dst, GLsizei *size, const KTX_texture_info *textureInfo, GLsizei bytesOfKeyValueData, const void *keyValueData, GLuint numImages, KTX_image_info images[])
 Write image(s) in KTX format to memory. More...
 

Detailed Description

Declares the public functions and structures of the KTX API.

Author
Mark Callow, Edgewise Consulting and while at HI Corporation
Based on original work by Georg Kolling, Imagination Technology
Id
c61a2def94a76991fbd2fd8be197c63c1bd575c0
Date
Sun Apr 22 22:05:39 2018 +0900
Todo:
Find a way so that applications do not have to define KTX_OPENGL{,_ES*} when using the library.

Macro Definition Documentation

◆ ktxHashTable_AddKVPair

#define ktxHashTable_AddKVPair (   a,
  b,
  c,
 
)    ktxHashList_AddKVPair(a, b, c, d)

Add a key-value pair to a KTX_hash_table.

Deprecated:
Use ktxHashList_AddKVPair().

Should be documented as a member of KTX_hash_table but a doxygen limitation prevents that.

◆ ktxHashTable_Destroy

#define ktxHashTable_Destroy (   a)    ktxHashList_Destroy(a);

Destroy a KTX_hash_table.

Deprecated:
Use ktxHashList_Destroy().

Should be documented as a member of KTX_hash_table but a doxygen limitation prevents that.

◆ ktxHashTable_FindValue

#define ktxHashTable_FindValue (   a,
  b,
  c,
 
)    ktxHashList_FindValue(a, b, c, d)

Looks up a key and returns its value.

Deprecated:
Use ktxHashList_FindValue().

Should be documented as a member of KTX_hash_table but a doxygen limitation prevents that.

Examples:
vkload.cpp.

Enumeration Type Documentation

◆ KTX_error_code

Error codes returned by library functions.

Enumerator
KTX_SUCCESS 

Operation was successful.

KTX_FILE_DATA_ERROR 

The data in the file is inconsistent with the spec.

KTX_FILE_OPEN_FAILED 

The target file could not be opened.

KTX_FILE_OVERFLOW 

The operation would exceed the max file size.

KTX_FILE_READ_ERROR 

An error occurred while reading from the file.

KTX_FILE_SEEK_ERROR 

An error occurred while seeking in the file.

KTX_FILE_UNEXPECTED_EOF 

File does not have enough data to satisfy request.

KTX_FILE_WRITE_ERROR 

An error occurred while writing to the file.

KTX_GL_ERROR 

GL operations resulted in an error.

KTX_INVALID_OPERATION 

The operation is not allowed in the current state.

KTX_INVALID_VALUE 

A parameter value was not valid

KTX_NOT_FOUND 

Requested key was not found

KTX_OUT_OF_MEMORY 

Not enough memory to complete the operation.

KTX_UNKNOWN_FILE_FORMAT 

The file not a KTX file

KTX_UNSUPPORTED_TEXTURE_TYPE 

The KTX file specifies an unsupported texture type.