From 64ede41ebaade64ad6705f7f55ca4a778a156481 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 2 Mar 2026 13:17:28 +0000 Subject: Wrap up some low level texture operations in glTexture class Fixes previously hard coded billboard texture size. --- gfx/gl/glTexture.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gfx/gl/glTexture.cpp (limited to 'gfx/gl/glTexture.cpp') diff --git a/gfx/gl/glTexture.cpp b/gfx/gl/glTexture.cpp new file mode 100644 index 0000000..8dcf16f --- /dev/null +++ b/gfx/gl/glTexture.cpp @@ -0,0 +1,18 @@ +#include "glTexture.h" + +TextureDimensions +Impl::glTexture::getSize() const +{ + TextureDimensions size {}; + glGetTextureLevelParameteriv(name, 0, GL_TEXTURE_WIDTH, &size.x); + glGetTextureLevelParameteriv(name, 0, GL_TEXTURE_HEIGHT, &size.y); + glGetTextureLevelParameteriv(name, 0, GL_TEXTURE_DEPTH, &size.z); + return size; +} + +void +Impl::glTexture::bind(GLenum type, GLenum unit) const +{ + glActiveTexture(unit); + glBindTexture(type, name); +} -- cgit v1.3