Skip to content

Commit

Permalink
fix(core): use glTexImage3D instead of glTexStorage3D in createTextur…
Browse files Browse the repository at this point in the history
…e2DArray

glTexStorage3D doesn't exist in OpenGL 3.3
  • Loading branch information
tomas7770 committed Oct 9, 2024
1 parent 30da33b commit a0d1044
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/src/gl/ogl_render_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2009,9 +2009,12 @@ Texture2DArray OGLRenderDevice::createTexture2DArray(const Texture2DArrayDesc& d
GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D_ARRAY, id);
glTexStorage3D(GL_TEXTURE_2D_ARRAY, static_cast<GLsizei>(desc.mipLevelCount), internalFormat,
static_cast<GLsizei>(desc.width), static_cast<GLsizei>(desc.height),
static_cast<GLsizei>(desc.size));
for (std::size_t j = 0; j < desc.mipLevelCount; ++j)
{
glTexImage3D(GL_TEXTURE_2D_ARRAY, static_cast<GLint>(j), static_cast<GLint>(internalFormat),
static_cast<GLsizei>(desc.width), static_cast<GLsizei>(desc.height),
static_cast<GLsizei>(desc.size), 0, format, type, nullptr);
}
for (std::size_t i = 0; i < desc.size; ++i)
{
for (std::size_t j = 0, div = 1; j < desc.mipLevelCount; ++j, div *= 2)
Expand Down

0 comments on commit a0d1044

Please sign in to comment.