Skip to content

Commit 347bdaf

Browse files
authored
Merge pull request #324 from OneLoneCoder/patch-emscripten
fixing emscripten and OpenGL3.3 on Linux
2 parents 7db1394 + f4bef97 commit 347bdaf

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

olcPixelGameEngine.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,8 +1358,9 @@ namespace olc
13581358
#endif
13591359

13601360
#if defined(OLC_PLATFORM_X11)
1361-
namespace X11
1362-
{#include <GL/glx.h>}
1361+
namespace X11 {
1362+
#include <GL/glx.h>
1363+
}
13631364
#define CALLSTYLE
13641365
#endif
13651366

@@ -4595,17 +4596,17 @@ namespace olc
45954596
// #include <OpenGL/glu.h>
45964597
//#endif
45974598

4598-
//#if defined(OLC_PLATFORM_EMSCRIPTEN)
4599-
// #include <EGL/egl.h>
4600-
// #include <GLES2/gl2.h>
4601-
// #define GL_GLEXT_PROTOTYPES
4602-
// #include <GLES2/gl2ext.h>
4603-
// #include <emscripten/emscripten.h>
4604-
// #define CALLSTYLE
4605-
// typedef EGLBoolean(locSwapInterval_t)(EGLDisplay display, EGLint interval);
4606-
// #define GL_CLAMP GL_CLAMP_TO_EDGE
4607-
// #define OGL_LOAD(t, n) n;
4608-
//#endif
4599+
#if defined(OLC_PLATFORM_EMSCRIPTEN)
4600+
#include <EGL/egl.h>
4601+
#include <GLES2/gl2.h>
4602+
#define GL_GLEXT_PROTOTYPES
4603+
#include <GLES2/gl2ext.h>
4604+
#include <emscripten/emscripten.h>
4605+
#define CALLSTYLE
4606+
typedef EGLBoolean(locSwapInterval_t)(EGLDisplay display, EGLint interval);
4607+
#define GL_CLAMP GL_CLAMP_TO_EDGE
4608+
#define OGL_LOAD(t, n) n;
4609+
#endif
46094610

46104611
namespace olc
46114612
{
@@ -6319,8 +6320,8 @@ namespace olc
63196320
let isFullscreen = (document.fullscreenElement != null);
63206321

63216322
// get the width of the containing element
6322-
let width = (isFullscreen || !Module.olc_AssumeDefaultShells) ? window.innerWidth : Module.canvas.parentNode.clientWidth;
6323-
let height = (isFullscreen || !Module.olc_AssumeDefaultShells) ? window.innerHeight : Module.canvas.parentNode.clientHeight;
6323+
let width = (isFullscreen) ? window.innerWidth : Module.canvas.parentNode.clientWidth;
6324+
let height = (isFullscreen) ? window.innerHeight : Module.canvas.parentNode.clientHeight;
63246325

63256326
// calculate the expected viewport size
63266327
let viewWidth = width;

0 commit comments

Comments
 (0)