Skip to content

Instantly share code, notes, and snippets.

View RafaelOliveira's full-sized avatar

Rafael Oliveira RafaelOliveira

View GitHub Profile
@RafaelOliveira
RafaelOliveira / TextureDraw.cpp
Created September 25, 2024 18:07
Load a ktx texture in OpenGL with libktx
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;
@RafaelOliveira
RafaelOliveira / TextureDraw.cpp
Last active September 25, 2024 18:10
Load a png texture in OpenGL with libpng
MYAPI void LoadPngTexture(const char* fileName, int* width, int* height)
{
png_image image;
memset(&image, 0, sizeof(image));
image.version = PNG_IMAGE_VERSION;
if (!png_image_begin_read_from_file(&image, fileName)) {
return;
}