mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphicsdriver/opengl: Bug fix: compile error on browsers and mobiles
This commit is contained in:
parent
734aeabc8d
commit
aff77d98e4
@ -75,14 +75,6 @@ type contextImpl struct {
|
||||
worker mgl.Worker
|
||||
}
|
||||
|
||||
func Init() {
|
||||
theContext.gl, theContext.worker = mgl.NewContext()
|
||||
}
|
||||
|
||||
func InitWithContext(context mgl.Context) {
|
||||
theContext.gl = context
|
||||
}
|
||||
|
||||
func (c *context) doWork(chError <-chan error, chDone <-chan struct{}) error {
|
||||
if c.worker == nil {
|
||||
panic("not reached")
|
||||
|
@ -17,9 +17,9 @@
|
||||
package opengl
|
||||
|
||||
func (d *Driver) IsContextLost() bool {
|
||||
return theContext.isContextLost()
|
||||
return d.context.isContextLost()
|
||||
}
|
||||
|
||||
func (d *Driver) RestoreContext() {
|
||||
theContext.restoreContext()
|
||||
d.context.restoreContext()
|
||||
}
|
||||
|
@ -16,6 +16,18 @@
|
||||
|
||||
package opengl
|
||||
|
||||
import (
|
||||
"golang.org/x/mobile/gl"
|
||||
)
|
||||
|
||||
func (d *Driver) DoWork(chError <-chan error, chDone <-chan struct{}) error {
|
||||
return theContext.doWork(chError, chDone)
|
||||
return d.context.doWork(chError, chDone)
|
||||
}
|
||||
|
||||
func (d *Driver) Init() {
|
||||
d.context.gl, d.context.worker = gl.NewContext()
|
||||
}
|
||||
|
||||
func (d *Driver) InitWithContext(context gl.Context) {
|
||||
d.context.gl = context
|
||||
}
|
||||
|
@ -152,9 +152,9 @@ func Run(width, height int, scale float64, title string, g GraphicsContext, main
|
||||
|
||||
if mainloop {
|
||||
ctx := <-glContextCh
|
||||
opengl.InitWithContext(ctx)
|
||||
opengl.GetDriver().InitWithContext(ctx)
|
||||
} else {
|
||||
opengl.Init()
|
||||
opengl.GetDriver().Init()
|
||||
}
|
||||
|
||||
// Force to set the screen size
|
||||
|
Loading…
Reference in New Issue
Block a user