Skip to content

Commit

Permalink
Merge pull request #168 from ux3d/fix/webGlCheck
Browse files Browse the repository at this point in the history
Detect WebGL 2 and report if not avialable (GSVN-363)
  • Loading branch information
UX3D-becher authored Mar 23, 2021
2 parents bcccbc2 + ed04f2c commit af54445
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app_web/src/ui/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ const app = new Vue({
// remove input class from color picker (added by default by buefy)
const colorPicker = document.getElementById("clearColorPicker");
colorPicker.classList.remove("input");

// test if webgl is present
const context = canvas.getContext("webgl2", { alpha: false, antialias: true });
if (context === undefined || context === null) {
this.error("The sample viewer requires WebGL 2.0, which is not supported by this browser or device. " +
"Please try again with another browser, or check https://get.webgl.org/webgl2/ " +
"if you believe you are seeing this message in error.", 15000);
}
},
methods:
{
Expand Down Expand Up @@ -140,11 +148,11 @@ const app = new Vue({
type: 'is-warning'
})
},
error(message) {
error(message, duration = 5000) {
this.$buefy.toast.open({
message: message,
type: 'is-danger',
duration: 5000
duration: duration
})
},
goToLoadingState() {
Expand Down

0 comments on commit af54445

Please sign in to comment.