From d79fd1e198b9cf3b0422a689de1959c1dd9a98ec Mon Sep 17 00:00:00 2001 From: wheremyfoodat Date: Fri, 3 Mar 2023 00:58:57 +0200 Subject: [PATCH] [OpenGL HAL] Add createDSTexture --- include/opengl.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/opengl.hpp b/include/opengl.hpp index d27c9ad1..8cb1613e 100644 --- a/include/opengl.hpp +++ b/include/opengl.hpp @@ -193,6 +193,18 @@ namespace OpenGL { create(width, height, internalFormat, GL_TEXTURE_2D_MULTISAMPLE, samples); } + // Creates a depth, stencil or depth-stencil texture + void createDSTexture(int width, int height, GLenum internalFormat, GLenum format, const void* data = nullptr, + GLenum type = GL_FLOAT, GLenum binding = GL_TEXTURE_2D) { + m_width = width; + m_height = height; + m_binding = binding; + + glGenTextures(1, &m_handle); + bind(); + glTexImage2D(binding, 0, internalFormat, width, height, 0, format, type, data); + } + void setWrapS(WrappingMode mode) { glTexParameteri(m_binding, GL_TEXTURE_WRAP_S, static_cast(mode)); }