Created
September 25, 2024 18:07
-
-
Save RafaelOliveira/afaeb0ed650c7603f713882dfb5efb91 to your computer and use it in GitHub Desktop.
Load a ktx texture in OpenGL with libktx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MYAPI void LoadKtxTexture(const char* fileName, int* width, int* height) | |
{ | |
ktxTexture* kTexture; | |
GLenum target, glerror; | |
ktxTexture_CreateFromNamedFile(fileName, KTX_TEXTURE_CREATE_NO_FLAGS, &kTexture); | |
*width = kTexture->baseWidth; | |
*height = kTexture->baseHeight; | |
glGenTextures(1, &texDrawData.activeTextureId); | |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | |
ktxTexture_GLUpload(kTexture, &texDrawData.activeTextureId, &target, &glerror); | |
ktxTexture_Destroy(kTexture); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment