Skip to content

Commit

Permalink
OPENGL EMSCRIPTEN: Add ifndef go WebGL constants not defined by emscr…
Browse files Browse the repository at this point in the history
…ipten
  • Loading branch information
chkuendig authored and sev- committed Aug 20, 2021
1 parent 5c8ed4c commit a7196e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions graphics/opengl/framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,15 @@ void FrameBuffer::init() {
const char *glVersion = (const char *)glGetString(GL_VERSION);
if (strstr(glVersion,"WebGL 1.0") != NULL) {
// See https://www.khronos.org/registry/webgl/specs/latest/1.0/#FBO_ATTACHMENTS
// and https://github.com/emscripten-core/emscripten/issues/4832
#ifndef GL_DEPTH_STENCIL
#define GL_DEPTH_STENCIL 0x84F9
#endif
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_STENCIL, _texWidth, _texHeight);

#ifndef GL_DEPTH_STENCIL_ATTACHMENT
#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
#endif
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _renderBuffers[0]);
} else {
glRenderbufferStorage(GL_RENDERBUFFER, useDepthComponent24() ? GL_DEPTH_COMPONENT24 : GL_DEPTH_COMPONENT16, _texWidth, _texHeight);
Expand Down

0 comments on commit a7196e3

Please sign in to comment.