summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/javascript/engine.js26
-rw-r--r--platform/javascript/os_javascript.cpp1
-rw-r--r--platform/uwp/detect.py3
-rw-r--r--platform/windows/detect.py7
4 files changed, 21 insertions, 16 deletions
diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js
index bca1851f40..8f22e41660 100644
--- a/platform/javascript/engine.js
+++ b/platform/javascript/engine.js
@@ -138,18 +138,6 @@
}
var actualCanvas = this.rtenv.canvas;
- var testContext = false;
- var testCanvas;
- try {
- testCanvas = document.createElement('canvas');
- testContext = testCanvas.getContext('webgl2') || testCanvas.getContext('experimental-webgl2');
- } catch (e) {}
- if (!testContext) {
- throw new Error("WebGL 2 not available");
- }
- testCanvas = null;
- testContext = null;
-
// canvas can grab focus on click
if (actualCanvas.tabIndex < 0) {
actualCanvas.tabIndex = 0;
@@ -273,6 +261,20 @@
Engine.RuntimeEnvironment = engine.RuntimeEnvironment;
+ Engine.isWebGLAvailable = function(majorVersion = 1) {
+
+ var testContext = false;
+ try {
+ var testCanvas = document.createElement('canvas');
+ if (majorVersion === 1) {
+ testContext = testCanvas.getContext('webgl') || testCanvas.getContet('experimental-webgl');
+ } else if (majorVersion === 2) {
+ testContext = testCanvas.getContext('webgl2') || testCanvas.getContet('experimental-webgl2');
+ }
+ } catch (e) {}
+ return !!testContext;
+ };
+
Engine.load = function(newBasePath) {
if (newBasePath !== undefined) basePath = getBasePath(newBasePath);
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index ace0bdad60..cbfe99ba2d 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -444,6 +444,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
break;
}
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(NULL, &attributes);
+ ERR_EXPLAIN("WebGL " + itos(attributes.majorVersion) + ".0 not available");
ERR_FAIL_COND_V(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE);
video_mode = p_desired;
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index d850ab9436..3ee195e4f9 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -25,10 +25,11 @@ def can_build():
def get_opts():
+ from SCons.Variables import BoolVariable
return [
('msvc_version', 'MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.', None),
- (BoolVariable('use_mingw', 'Use the Mingw compiler, even if MSVC is installed. Only used on Windows.', False)),
+ BoolVariable('use_mingw', 'Use the Mingw compiler, even if MSVC is installed. Only used on Windows.', False),
]
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 1cb8cb0fc8..2ce55d98be 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -65,7 +65,7 @@ def get_opts():
EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
BoolVariable('separate_debug_symbols', 'Create a separate file with the debug symbols', False),
('msvc_version', 'MSVC version to use. Ignored if VCINSTALLDIR is set in shell env.', None),
- (BoolVariable('use_mingw', 'Use the Mingw compiler, even if MSVC is installed. Only used on Windows.', False)),
+ BoolVariable('use_mingw', 'Use the Mingw compiler, even if MSVC is installed. Only used on Windows.', False),
]
@@ -320,8 +320,9 @@ def configure(env):
print("Configuring for Windows: target=%s, bits=%s" % (env['target'], env['bits']))
- env['ENV'] = os.environ # this makes build less repeatable, but simplifies some things
- env['ENV']['TMP'] = os.environ['TMP']
+ if (os.name == "nt"):
+ env['ENV'] = os.environ # this makes build less repeatable, but simplifies some things
+ env['ENV']['TMP'] = os.environ['TMP']
# First figure out which compiler, version, and target arch we're using
if os.getenv("VCINSTALLDIR"):