app/internal/window,app/internal/gl: move gl.Context to package window

Package gl now only defines opengl types and functions.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-11-29 19:55:52 +01:00
parent 5fa3dbc70d
commit f25f647a66
11 changed files with 21 additions and 26 deletions
+1 -2
View File
@@ -11,7 +11,6 @@ import (
"unsafe"
"gioui.org/app/internal/egl"
"gioui.org/app/internal/gl"
)
type context struct {
@@ -19,7 +18,7 @@ type context struct {
*egl.Context
}
func (w *window) NewContext() (gl.Context, error) {
func (w *window) NewContext() (Context, error) {
ctx, err := egl.NewContext(nil)
if err != nil {
return nil, err
+1 -2
View File
@@ -9,7 +9,6 @@ import (
"unsafe"
"gioui.org/app/internal/egl"
"gioui.org/app/internal/gl"
)
/*
@@ -27,7 +26,7 @@ type context struct {
eglWin *C.struct_wl_egl_window
}
func (w *window) NewContext() (gl.Context, error) {
func (w *window) NewContext() (Context, error) {
disp := egl.NativeDisplayType(unsafe.Pointer(w.display()))
ctx, err := egl.NewContext(disp)
if err != nil {
+1 -2
View File
@@ -6,7 +6,6 @@ import (
"unsafe"
"gioui.org/app/internal/egl"
"gioui.org/app/internal/gl"
)
type context struct {
@@ -14,7 +13,7 @@ type context struct {
*egl.Context
}
func (w *window) NewContext() (gl.Context, error) {
func (w *window) NewContext() (Context, error) {
disp := egl.NativeDisplayType(unsafe.Pointer(w.HDC()))
ctx, err := egl.NewContext(disp)
if err != nil {
+1 -2
View File
@@ -8,7 +8,6 @@ import (
"unsafe"
"gioui.org/app/internal/egl"
"gioui.org/app/internal/gl"
)
type x11Context struct {
@@ -16,7 +15,7 @@ type x11Context struct {
*egl.Context
}
func (w *x11Window) NewContext() (gl.Context, error) {
func (w *x11Window) NewContext() (Context, error) {
disp := egl.NativeDisplayType(unsafe.Pointer(w.display()))
ctx, err := egl.NewContext(disp)
if err != nil {
+1 -1
View File
@@ -121,6 +121,6 @@ func (c *context) MakeCurrent() error {
return nil
}
func (w *window) NewContext() (gl.Context, error) {
func (w *window) NewContext() (Context, error) {
return newContext(w)
}
+1 -1
View File
@@ -90,6 +90,6 @@ func (c *context) MakeCurrent() error {
return nil
}
func (w *window) NewContext() (gl.Context, error) {
func (w *window) NewContext() (Context, error) {
return newContext(w)
}
+1 -1
View File
@@ -71,6 +71,6 @@ func (c *context) MakeCurrent() error {
return nil
}
func (w *window) NewContext() (gl.Context, error) {
func (w *window) NewContext() (Context, error) {
return newContext(w)
}
+10 -1
View File
@@ -31,6 +31,15 @@ type Callbacks interface {
Event(e event.Event)
}
type Context interface {
Functions() *gl.Functions
Present() error
MakeCurrent() error
Release()
Lock()
Unlock()
}
// Driver is the interface for the platform implementation
// of a window.
type Driver interface {
@@ -39,7 +48,7 @@ type Driver interface {
SetAnimating(anim bool)
// ShowTextInput updates the virtual keyboard state.
ShowTextInput(show bool)
NewContext() (gl.Context, error)
NewContext() (Context, error)
}
type windowRendezvous struct {