app/internal/gl/impl: extract platform dependent opengl bindings

We'd like to support Gio using a different renderer binding than
the builtin. A first step is to define the Functions interface
in package gl, and extract the concrete implementations to a
separate package.

Updates #26

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-07 19:13:51 +01:00
parent e672d71c61
commit 251c075093
17 changed files with 293 additions and 280 deletions
+4 -3
View File
@@ -7,11 +7,12 @@ import (
"syscall/js"
"gioui.org/app/internal/gl"
"gioui.org/app/internal/gl/impl"
)
type jsContext struct {
ctx js.Value
f *gl.Functions
f gl.Functions
}
func newContext() (*jsContext, error) {
@@ -26,7 +27,7 @@ func newContext() (*jsContext, error) {
if ctx.IsNull() {
return nil, errors.New("headless: webgl is not supported")
}
f := &gl.Functions{Ctx: ctx}
f := &impl.Functions{Ctx: ctx}
if err := f.Init(version); err != nil {
return nil, err
}
@@ -37,7 +38,7 @@ func newContext() (*jsContext, error) {
return c, nil
}
func (c *jsContext) Functions() *gl.Functions {
func (c *jsContext) Functions() gl.Functions {
return c.f
}