Skip to content

Commit 695e060

Browse files
committed
do not do GL immediate mode emulation if a 2D context is being used, even if compiled with emulation
1 parent f842201 commit 695e060

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/library_browser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ mergeInto(LibraryManager.library, {
7777
}
7878
if (setInModule) {
7979
Module.ctx = ctx;
80+
Module.useWebGL = useWebGL;
8081
Browser.moduleContextCreatedCallbacks.forEach(function(callback) { callback() });
8182
}
8283
return ctx;

src/library_gl.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,8 @@ var LibraryGL = {
15171517
Module.printErr('WARNING: using emscripten GL immediate mode emulation. This is very limited in what it supports');
15181518
GL.immediate.initted = true;
15191519

1520+
if (!Module.useWebGL) return; // a 2D canvas may be currently used TODO: make sure we are actually called in that case
1521+
15201522
this.matrixStack['m'] = [];
15211523
this.matrixStack['p'] = [];
15221524
for (var i = 0; i < GL.immediate.MAX_TEXTURES; i++) {

0 commit comments

Comments
 (0)