Create texture objects in current OpenGL context.
More...
|
KTX_error_code | ktxLoadTextureF (FILE *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 | ktxTexture::ktxTexture_GLUpload (ktxTexture *This, GLuint *pTexture, GLenum *pTarget, GLenum *pGlerror) |
| Create a GL texture object from a ktxTexture object. More...
|
|
Create texture objects in current OpenGL context.
§ ktxLoadTextureF()
KTX_error_code ktxLoadTextureF |
( |
FILE * |
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.
- Deprecated:
- Use ktxTexture_CreateFromStdioStream() and ktxTexture_GLUpload().
Sets the texture object's GL_TEXTURE_MAX_LEVEL parameter according to the number of levels in the ktxStream, provided the library has been compiled with a version of gl.h where GL_TEXTURE_MAX_LEVEL is defined.
Unpacks compressed GL_ETC1_RGB8_OES and GL_ETC2_* format textures in software when the format is not supported by the GL context, provided the library has been compiled with SUPPORT_SOFTWARE_ETC_UNPACK defined as 1.
Also converts texture with legacy formats to their modern equivalents when the format is not supported by the GL context, provided the library has been compiled with SUPPORT_LEGACY_FORMAT_CONVERSION defined as 1.
- Parameters
-
[in] | file | stdio stream FILE pointer |
[in,out] | pTexture | name of the GL texture object 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. |
- Returns
- KTX_SUCCESS on success, other KTX_* enum values on error.
- Exceptions
-
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 for the underlying ktxTexture object or 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_UNSUPPORTED_TEXTURE_TYPE | The type of texture is not supported by the current OpenGL context. |
- Examples:
- glloader.c.
§ ktxLoadTextureM()
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.
- Deprecated:
- Use ktxTexture_CreateFromMemory() and ktxTexture_GLUpload().
- Parameters
-
[in] | bytes | pointer to the array of bytes containing the KTX data to load. |
[in] | size | size of the memory array containing the KTX format data. |
[in,out] | pTexture | name of the GL texture object 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. |
- Returns
- KTX_SUCCESS on success, other KTX_* enum values on error.
- Exceptions
-
- Examples:
- glloader.c.
§ ktxLoadTextureN()
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.
- Deprecated:
- Use ktxTexture_CreateFromNamedFile() and ktxTexture_GLUpload().
- Parameters
-
[in] | filename | pointer to a C string that contains the path of the file to load. |
[in,out] | pTexture | name of the GL texture object 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. |
- Returns
- KTX_SUCCESS on success, other KTX_* enum values on error.
- Exceptions
-
- Examples:
- glloader.c.
§ ktxTexture_GLUpload()
Create a GL texture object from a ktxTexture object.
Sets the texture object's GL_TEXTURE_MAX_LEVEL parameter according to the number of levels in the KTX data, provided the library has been compiled with a version of gl.h where GL_TEXTURE_MAX_LEVEL is defined.
Unpacks compressed GL_ETC1_RGB8_OES and GL_ETC2_* format textures in software when the format is not supported by the GL context, provided the library has been compiled with SUPPORT_SOFTWARE_ETC_UNPACK defined as 1.
It will also convert textures with legacy formats to their modern equivalents when the format is not supported by the GL context, provided the library has been compiled with SUPPORT_LEGACY_FORMAT_CONVERSION defined as 1.
- Parameters
-
[in] | This | handle of the ktxTexture to upload. |
[in,out] | pTexture | name of the GL texture object 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] | pGlerror | *pGlerror is set to the value returned by glGetError when this function returns the error KTX_GL_ERROR. glerror can be NULL. |
- Returns
- KTX_SUCCESS on success, other KTX_* enum values on error.
- Exceptions
-
KTX_INVALID_VALUE | This or target is NULL or the size of a mip level is greater than the size of the preceding level. |
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_UNSUPPORTED_TEXTURE_TYPE | The type of texture is not supported by the current OpenGL context. |
- Examples:
- glloader.c.