aboutsummaryrefslogtreecommitdiff
path: root/src/Platform/OpenGL/OpenGLTexture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Platform/OpenGL/OpenGLTexture.cpp')
-rw-r--r--src/Platform/OpenGL/OpenGLTexture.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Platform/OpenGL/OpenGLTexture.cpp b/src/Platform/OpenGL/OpenGLTexture.cpp
index 02252d1..7e2dea0 100644
--- a/src/Platform/OpenGL/OpenGLTexture.cpp
+++ b/src/Platform/OpenGL/OpenGLTexture.cpp
@@ -19,7 +19,7 @@ namespace Donut
glTextureParameteri(m_RendererID, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
- // TODO: Texture Loading
+ // TODO(Hachem): Texture Loading
OpenGLTexture2D::OpenGLTexture2D(const std::string& path)
: m_Path(path)
{
@@ -56,6 +56,7 @@ namespace Donut
std::cout << "Data must be entire texture!" << std::endl;
return;
}
+
glTextureSubImage2D(m_RendererID, 0, 0, 0, m_Width, m_Height, m_DataFormat, GL_UNSIGNED_BYTE, data);
}
@@ -63,4 +64,10 @@ namespace Donut
{
glBindTextureUnit(slot, m_RendererID);
}
+
+ void OpenGLTexture2D::BindAsImage(uint32_t slot, bool readOnly) const
+ {
+ GLenum access = readOnly ? GL_READ_ONLY : GL_WRITE_ONLY;
+ glBindImageTexture(slot, m_RendererID, 0, GL_FALSE, 0, access, m_InternalFormat);
+ }
}; \ No newline at end of file