app,app/headless: expose Backends from window and headless contexts

This is a refactoring change to prepare for another gpu.Backend
implementations.

Notably, app/loop.go no longer imports gpu/gl.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-15 18:29:14 +01:00
parent f62725ea77
commit 94fdc26cb5
9 changed files with 42 additions and 19 deletions
+2 -1
View File
@@ -26,6 +26,7 @@ type Window struct {
type context interface {
Functions() *glimpl.Functions
Backend() (gpu.Backend, error)
MakeCurrent() error
ReleaseCurrent()
Release()
@@ -53,7 +54,7 @@ func NewWindow(width, height int) (*Window, error) {
ctx.Release()
return err
}
backend, err := gl.NewBackend(f)
backend, err := ctx.Backend()
if err != nil {
fbo.Release()
ctx.Release()