ui/app: (wasm) add checks for required extensions

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-08-10 00:49:28 +02:00
parent 7bc18c0139
commit 2a0b0077da
2 changed files with 21 additions and 11 deletions
+5 -1
View File
@@ -23,15 +23,19 @@ func newContext(w *window) (*context, error) {
"desynchronized": true,
"preserveDrawingBuffer": true,
}
version := 2
ctx := w.cnv.Call("getContext", "webgl2", args)
if ctx == js.Null() {
version = 1
ctx = w.cnv.Call("getContext", "webgl", args)
}
if ctx == js.Null() {
return nil, errors.New("app: webgl is not supported")
}
f := &gl.Functions{Ctx: ctx}
f.Init()
if err := f.Init(version); err != nil {
return nil, err
}
c := &context{
ctx: ctx,
cnv: w.cnv,