summaryrefslogtreecommitdiff
path: root/gfx/gl/glTexture.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-02 13:17:28 +0000
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-02 13:17:28 +0000
commit64ede41ebaade64ad6705f7f55ca4a778a156481 (patch)
tree6d2fbc64cd28d272fe3f5bbf79ddd41ecc5e2626 /gfx/gl/glTexture.cpp
parentRefactor glArrays to better expose underlying types (diff)
downloadilt-64ede41ebaade64ad6705f7f55ca4a778a156481.tar.bz2
ilt-64ede41ebaade64ad6705f7f55ca4a778a156481.tar.xz
ilt-64ede41ebaade64ad6705f7f55ca4a778a156481.zip
Wrap up some low level texture operations in glTexture classHEADmain
Fixes previously hard coded billboard texture size.
Diffstat (limited to 'gfx/gl/glTexture.cpp')
-rw-r--r--gfx/gl/glTexture.cpp18
1 files changed, 18 insertions, 0 deletions
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);
+}