mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
gpu/gl: remove OpenGL functions parameter from NewBackend
As a consequence, most API is gone from gpu/gl, and embedding Gio in foreign frameworks don't need to provide an OpenGL implementation. The next change simplifies the GLFW embedding example accordingly. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -6,14 +6,13 @@ import (
|
||||
"errors"
|
||||
"syscall/js"
|
||||
|
||||
"gioui.org/app/internal/glimpl"
|
||||
"gioui.org/gpu/backend"
|
||||
"gioui.org/gpu/gl"
|
||||
"gioui.org/internal/glimpl"
|
||||
)
|
||||
|
||||
type jsContext struct {
|
||||
ctx js.Value
|
||||
f *glimpl.Functions
|
||||
}
|
||||
|
||||
func newGLContext() (context, error) {
|
||||
@@ -26,23 +25,14 @@ func newGLContext() (context, error) {
|
||||
if ctx.IsNull() {
|
||||
return nil, errors.New("headless: webgl is not supported")
|
||||
}
|
||||
f := &glimpl.Functions{Ctx: ctx}
|
||||
if err := f.Init(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c := &jsContext{
|
||||
ctx: ctx,
|
||||
f: f,
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (c *jsContext) Backend() (backend.Device, error) {
|
||||
return gl.NewBackend(c.f)
|
||||
}
|
||||
|
||||
func (c *jsContext) Functions() *glimpl.Functions {
|
||||
return c.f
|
||||
return gl.NewBackend(glimpl.Context(c.ctx))
|
||||
}
|
||||
|
||||
func (c *jsContext) Release() {
|
||||
|
||||
Reference in New Issue
Block a user