libktx Reference 4.3.2
Libraries and tools to create and read KTX image texture files.
Loading...
Searching...
No Matches
OpenGL Texture Image Loader

Create texture objects in current OpenGL context. More...

Functions

KTX_error_code ktxTexture1_GLUpload (ktxTexture1 *This, GLuint *pTexture, GLenum *pTarget, GLenum *pGlerror)
 Create a GL texture object from a ktxTexture1 object.
 
KTX_error_code ktxTexture2_GLUpload (ktxTexture2 *This, GLuint *pTexture, GLenum *pTarget, GLenum *pGlerror)
 Create a GL texture object from a ktxTexture2 object.
 
KTX_error_code ktxTexture_GLUpload (ktxTexture *This, GLuint *pTexture, GLenum *pTarget, GLenum *pGlerror)
 Create a GL texture object from a ktxTexture1 object.
 

Detailed Description

Create texture objects in current OpenGL context.

Function Documentation

◆ ktxTexture1_GLUpload()

KTX_error_code ktxTexture1_GLUpload ( ktxTexture1 This,
GLuint *  pTexture,
GLenum *  pTarget,
GLenum *  pGlerror 
)

Create a GL texture object from a ktxTexture1 object.

Sets the texture object's GL_TEXTURE_MAX_LEVEL parameter according to the number of levels in the KTX data, provided the context supports this feature.

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]Thishandle of the ktxTexture to upload.
[in,out]pTexturename 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. pGlerror can be NULL.
Returns
KTX_SUCCESS on success, other KTX_* enum values on error.
Exceptions
KTX_GL_ERRORA GL error was raised by glBindTexture, glGenTextures or gl*TexImage*. The GL error will be returned in *glerror, if glerror is not NULL.
KTX_INVALID_VALUEThis or target is NULL or the size of a mip level is greater than the size of the preceding level.
KTX_NOT_FOUNDA dynamically loaded OpenGL {,ES} function required by the loader was not found.
KTX_UNSUPPORTED_TEXTURE_TYPEThe type of texture is not supported by the current OpenGL context.

◆ ktxTexture2_GLUpload()

KTX_error_code ktxTexture2_GLUpload ( ktxTexture2 This,
GLuint *  pTexture,
GLenum *  pTarget,
GLenum *  pGlerror 
)

Create a GL texture object from a ktxTexture2 object.

Sets the texture object's GL_TEXTURE_MAX_LEVEL parameter according to the number of levels in the KTX data, provided the context supports this feature.

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.

Parameters
[in]Thishandle of the ktxTexture to upload.
[in,out]pTexturename 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. pGlerror can be NULL.
Returns
KTX_SUCCESS on success, other KTX_* enum values on error.
Exceptions
KTX_GL_ERRORA GL error was raised by glBindTexture, glGenTextures or gl*TexImage*. The GL error will be returned in *glerror, if glerror is not NULL.
KTX_INVALID_VALUEThis or target is NULL or the size of a mip level is greater than the size of the preceding level.
KTX_NOT_FOUNDA dynamically loaded OpenGL {,ES} function required by the loader was not found.
KTX_UNSUPPORTED_TEXTURE_TYPEThe type of texture is not supported by the current OpenGL context.

◆ ktxTexture_GLUpload()

KTX_error_code ktxTexture_GLUpload ( ktxTexture This,
GLuint *  pTexture,
GLenum *  pTarget,
GLenum *  pGlerror 
)

Create a GL texture object from a ktxTexture1 object.

In order to ensure that the GL uploader is not linked into an application unless explicitly called, this is not a virtual function. It determines the texture type then dispatches to the correct function.

Sets the texture object's GL_TEXTURE_MAX_LEVEL parameter according to the number of levels in the KTX data, provided the context supports this feature.

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]Thishandle of the ktxTexture to upload.
[in,out]pTexturename 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. pGlerror can be NULL.
Returns
KTX_SUCCESS on success, other KTX_* enum values on error.
Exceptions
KTX_GL_ERRORA GL error was raised by glBindTexture, glGenTextures or gl*TexImage*. The GL error will be returned in *glerror, if glerror is not NULL.
KTX_INVALID_VALUEThis or target is NULL or the size of a mip level is greater than the size of the preceding level.
KTX_NOT_FOUNDA dynamically loaded OpenGL {,ES} function required by the loader was not found.
KTX_UNSUPPORTED_TEXTURE_TYPEThe type of texture is not supported by the current OpenGL context.