Skip to content

Commit

Permalink
Merge pull request #3 from toby-bro/emscripten-compilation-fix
Browse files Browse the repository at this point in the history
Emscripten compilation fix
  • Loading branch information
drohmer authored May 18, 2024
2 parents 2a103eb + cf413e6 commit 0c1a93d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion library/cgp/13_opengl/fbo/fbo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace cgp{
// Initialize texture
texture.initialize_texture_2d_on_gpu(width, height, GL_DEPTH_COMPONENT, GL_TEXTURE_2D,GL_REPEAT,GL_REPEAT,GL_NEAREST,GL_NEAREST);
float borderColor[] = { 1.0, 1.0, 1.0, 1.0 };
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);

// Create frame buffer
glGenFramebuffers(1, &id);
Expand All @@ -43,8 +43,10 @@ namespace cgp{
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, texture.id, 0);

// No color buffer is used in depth mode
#ifndef __EMSCRIPTEN__
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
#endif
}

// Reset the standard framebuffer to output on the screen
Expand Down
2 changes: 1 addition & 1 deletion library/cgp/opengl_include.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
// Special case for EMScripten (don't rely on glad)
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <GLES3/gl3.h> // OpenGL ES 3
#include <GLES3/gl32.h> // OpenGL ES 3
#endif


Expand Down

0 comments on commit 0c1a93d

Please sign in to comment.