Functions for instantiating GL or GLES textures from KTX files. More...
#include <string.h>
#include <stdlib.h>
#include "KHR/khrplatform.h"
#include "ktx.h"
#include "ktxint.h"
Classes | |
struct | ktxStream |
struct | ktxMem |
Macros | |
#define | KTX_GL_UNPACK_ALIGNMENT 4 |
Typedefs | |
typedef int(* | ktxStream_read )(void *dst, const GLsizei count, void *src) |
typedef int(* | ktxStream_skip )(const GLsizei count, void *src) |
Functions | |
KTX_error_code | ktxLoadTextureF (FILE *file, GLuint *pTexture, GLenum *pTarget, KTX_dimensions *pDimensions, GLboolean *pIsMipmapped, GLenum *pGlerror, unsigned int *pKvdLen, unsigned char **ppKvd) |
Load a GL texture object from 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) |
Load a GL texture object from 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) |
Load a GL texture object from KTX formatted data in memory. More... | |
Functions for instantiating GL or GLES textures from KTX files.
KTX_error_code ktxLoadTextureF | ( | FILE * | file, |
GLuint * | pTexture, | ||
GLenum * | pTarget, | ||
KTX_dimensions * | pDimensions, | ||
GLboolean * | pIsMipmapped, | ||
GLenum * | pGlerror, | ||
unsigned int * | pKvdLen, | ||
unsigned char ** | ppKvd | ||
) |
Load a GL texture object from a stdio FILE stream.
This function will unpack GL_ETC1_RGB8_OES format compressed textures in software when the format is not supported by the GL implementation, provided the library has been compiled with SUPPORT_SOFTWARE_ETC_UNPACK defined as 1.
[in] | file | pointer to the stdio FILE stream from which to load. |
[in,out] | pTexture | name of the GL texture to load. If NULL or if *pTexture == 0 the function will generate a texture name. The function binds either the generated name or the name given in *pTexture to the texture target returned in *pTarget , before loading the texture data. If pTexture is not NULL and a name was generated, the generated name will be returned in *pTexture. |
[out] | pTarget | *pTarget is set to the texture target used. The target is chosen based on the file contents. |
[out] | pDimensions | If pDimensions is not NULL, the width, height and depth of the texture's base level are returned in the fields of the KTX_dimensions structure to which it points. |
[out] | pIsMipmapped | If pIsMipmapped is not NULL, *pIsMipmapped is set to GL_TRUE if the KTX texture is mipmapped, GL_FALSE otherwise. |
[out] | pGlerror | *pGlerror is set to the value returned by glGetError when this function returns the error KTX_GL_ERROR. glerror can be NULL. |
[in,out] | pKvdLen | If not NULL, *pKvdLen is set to the number of bytes of key-value data pointed at by *ppKvd . Must not be NULL, if ppKvd is not NULL. |
[in,out] | ppKvd | If not NULL, *ppKvd is set to the point to a block of memory containing key-value data read from the file. The application is responsible for freeing the memory. |
KTX_INVALID_VALUE | target is NULL or the size of a mip level is greater than the size of the preceding level. |
KTX_INVALID_OPERATION | ppKvd is not NULL but pKvdLen is NULL. |
KTX_UNEXPECTED_END_OF_FILE | the file does not contain the expected amount of data. |
KTX_OUT_OF_MEMORY | Sufficient memory could not be allocated to store the requested key-value data. |
KTX_GL_ERROR | A GL error was raised by glBindTexture, glGenTextures or gl*TexImage*. The GL error will be returned in *glerror , if glerror is not NULL . |
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 | ||
) |
Load a GL texture object from KTX formatted data in memory.
[in] | bytes | pointer to the array of bytes containing the KTX format data to load. |
[in] | size | size of the memory array containing the KTX format data. |
[in,out] | pTexture | name of the GL texture to load. See ktxLoadTextureF() for details. |
[out] | pTarget | *pTarget is set to the texture target used. See ktxLoadTextureF() for details. |
[out] | pDimensions | the texture's base level width depth and height are returned in structure to which this points. See ktxLoadTextureF() for details. |
[out] | pIsMipmapped | *pIsMipMapped is set to indicate if the loaded texture is mipmapped. See ktxLoadTextureF() for details. |
[out] | pGlerror | *pGlerror is set to the value returned by glGetError when this function returns the error KTX_GL_ERROR. glerror can be NULL. |
[in,out] | pKvdLen | If not NULL, *pKvdLen is set to the number of bytes of key-value data pointed at by *ppKvd . Must not be NULL, if ppKvd is not NULL. |
[in,out] | ppKvd | If not NULL, ppKvd is set to the point to a block of memory containing key-value data read from the file. The application is responsible for freeing the memory. |
KTX_FILE_OPEN_FAILED | The specified memory could not be opened as a file. |
KTX_INVALID_VALUE | See ktxLoadTextureF() for causes. |
KTX_INVALID_OPERATION | See ktxLoadTextureF() for causes. |
KTX_UNEXPECTED_END_OF_FILE | See ktxLoadTextureF() for causes. |
KTX_GL_ERROR | See ktxLoadTextureF() for causes. |
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 | ||
) |
Load a GL texture object from a named file on disk.
[in] | filename | pointer to a C string that contains the path of the file to load. |
[in,out] | pTexture | name of the GL texture to load. See ktxLoadTextureF() for details. |
[out] | pTarget | *pTarget is set to the texture target used. See ktxLoadTextureF() for details. |
[out] | pDimensions | the texture's base level width depth and height are returned in structure to which this points. See ktxLoadTextureF() for details. |
[out] | pIsMipmapped | pIsMipMapped is set to indicate if the loaded texture is mipmapped. See ktxLoadTextureF() for details. |
[out] | pGlerror | *pGlerror is set to the value returned by glGetError when this function returns the error KTX_GL_ERROR. glerror can be NULL. |
[in,out] | pKvdLen | If not NULL, *pKvdLen is set to the number of bytes of key-value data pointed at by *ppKvd . Must not be NULL, if ppKvd is not NULL. |
[in,out] | ppKvd | If not NULL, ppKvd is set to the point to a block of memory containing key-value data read from the file. The application is responsible for freeing the memory. |
KTX_FILE_OPEN_FAILED | The specified file could not be opened. |
KTX_INVALID_VALUE | See ktxLoadTextureF() for causes. |
KTX_INVALID_OPERATION | See ktxLoadTextureF() for causes. |
KTX_UNEXPECTED_END_OF_FILE | See ktxLoadTextureF() for causes. |
KTX_GL_ERROR | See ktxLoadTextureF() for causes. |