app/internal/glimpl: derive version parameter in Functions.Init

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-12-04 19:20:25 +01:00
parent 85a06223a6
commit b8e33bb420
3 changed files with 6 additions and 8 deletions
+1 -3
View File
@@ -26,17 +26,15 @@ func newContext(w *window) (*context, error) {
"desynchronized": true,
"preserveDrawingBuffer": true,
}
version := 2
ctx := w.cnv.Call("getContext", "webgl2", args)
if ctx.IsNull() {
version = 1
ctx = w.cnv.Call("getContext", "webgl", args)
}
if ctx.IsNull() {
return nil, errors.New("app: webgl is not supported")
}
f := &glimpl.Functions{Ctx: ctx}
if err := f.Init(version); err != nil {
if err := f.Init(); err != nil {
return nil, err
}
c := &context{