summaryrefslogtreecommitdiff
path: root/src/render/Texture.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-05 14:33:54 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-04-05 14:33:54 +0200
commit19d946504239e3df1b8afb26d2053fb80dfff19e (patch)
treedf6bfa779d887b43824e519b82702b512e8d1c13 /src/render/Texture.cpp
parent67343898ff881bbbc767025a033005f45db32a09 (diff)
Rendering textures
Diffstat (limited to 'src/render/Texture.cpp')
-rw-r--r--src/render/Texture.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/render/Texture.cpp b/src/render/Texture.cpp
new file mode 100644
index 00000000..6d47c4a8
--- /dev/null
+++ b/src/render/Texture.cpp
@@ -0,0 +1,22 @@
+#include "Texture.hpp"
+
+CTexture::CTexture() {
+ // naffin'
+}
+
+CTexture::CTexture(wlr_texture* tex) {
+ RASSERT(wlr_texture_is_gles2(tex), "wlr_texture provided to CTexture that isn't GLES2!");
+ wlr_gles2_texture_attribs attrs;
+ wlr_gles2_texture_get_attribs(tex, &attrs);
+
+ m_iTarget = attrs.target;
+ m_iTexID = attrs.tex;
+
+ if (m_iTarget == GL_TEXTURE_2D) {
+ m_iType = attrs.has_alpha ? TEXTURE_RGBA : TEXTURE_RGBX;
+ } else {
+ m_iType = TEXTURE_EXTERNAL;
+ }
+
+ m_vSize = Vector2D(tex->width, tex->height);
+} \ No newline at end of file