Skip to content

Commit

Permalink
Fix crash when using FrameBuffer in Android simulator
Browse files Browse the repository at this point in the history
Using GL_RGBA is incorrect for internalformat but was chosing
for emscripten in f5cd8ac
  • Loading branch information
jhasse committed Dec 5, 2023
1 parent 621c01e commit 3dbe12e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jngl/FrameBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ FrameBuffer::FrameBuffer(const Pixels width, const Pixels height)

glGenRenderbuffers(1, &impl->buffer);
glBindRenderbuffer(GL_RENDERBUFFER, impl->buffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, static_cast<int>(width),
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, static_cast<int>(width),
static_cast<int>(height));

glGenFramebuffers(1, &impl->fbo);
Expand Down
3 changes: 3 additions & 0 deletions src/opengl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#define glGenVertexArrays glGenVertexArraysOES
#define glBindVertexArray glBindVertexArrayOES
#define glDeleteVertexArrays glDeleteVertexArraysOES
#if defined(__EMSCRIPTEN__)
#define GL_RGBA8 GL_RGBA8_OES
#endif
#else
#include <glad/gl.h>
#endif
Expand Down

0 comments on commit 3dbe12e

Please sign in to comment.