mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/ui: bug fix: OpenGL must be used when gomobile-build is used
Now the logic of graphicsDriver() is updated, this can return a Metal graphics driver on iOS even when gomobile-build is used. This change fixes this issue.
This commit is contained in:
parent
09b0a0ffaf
commit
85daef7436
@ -270,14 +270,17 @@ func (u *userInterfaceImpl) run(game Game, mainloop bool) (err error) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
u.context = newContextImpl(game)
|
u.context = newContextImpl(game)
|
||||||
u.graphicsDriver = graphicsDriver()
|
|
||||||
|
|
||||||
if mainloop {
|
if mainloop {
|
||||||
// When mainloop is true, gomobile-build is used. In this case, GL functions must be called via
|
// When mainloop is true, gomobile-build is used. In this case, GL functions must be called via
|
||||||
// gl.Context so that they are called on the appropriate thread.
|
// gl.Context so that they are called on the appropriate thread.
|
||||||
|
g := opengl.Get()
|
||||||
|
u.graphicsDriver = g
|
||||||
|
|
||||||
ctx := <-glContextCh
|
ctx := <-glContextCh
|
||||||
u.graphicsDriver.(*opengl.Graphics).SetGomobileGLContext(ctx)
|
g.SetGomobileGLContext(ctx)
|
||||||
} else {
|
} else {
|
||||||
|
u.graphicsDriver = graphicsDriver()
|
||||||
u.t = thread.NewOSThread()
|
u.t = thread.NewOSThread()
|
||||||
graphicscommand.SetRenderingThread(u.t)
|
graphicscommand.SetRenderingThread(u.t)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user