mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
opegnl: Remove initialization (use Reset instead) (mobile)
This commit is contained in:
parent
6cfb92c4c4
commit
61ba8dad17
@ -63,28 +63,11 @@ func init() {
|
|||||||
type context struct {
|
type context struct {
|
||||||
gl mgl.Context
|
gl mgl.Context
|
||||||
worker mgl.Worker
|
worker mgl.Worker
|
||||||
initialized chan struct{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewContext() (*Context, error) {
|
func NewContext() (*Context, error) {
|
||||||
c := &Context{
|
c := &Context{}
|
||||||
locationCache: newLocationCache(),
|
|
||||||
lastCompositeMode: CompositeModeUnknown,
|
|
||||||
}
|
|
||||||
c.gl, c.worker = mgl.NewContext()
|
c.gl, c.worker = mgl.NewContext()
|
||||||
c.initialized = make(chan struct{})
|
|
||||||
go func() {
|
|
||||||
// GL calls will just enqueue an task to the worker.
|
|
||||||
// Since the worker is not available, this enqueuing should be done
|
|
||||||
// in a goroutine.
|
|
||||||
|
|
||||||
// Textures' pixel formats are alpha premultiplied.
|
|
||||||
c.gl.Enable(mgl.BLEND)
|
|
||||||
c.BlendFunc(CompositeModeSourceOver)
|
|
||||||
f := c.gl.GetInteger(mgl.FRAMEBUFFER_BINDING)
|
|
||||||
c.screenFramebuffer = Framebuffer(mgl.Framebuffer{uint32(f)})
|
|
||||||
close(c.initialized)
|
|
||||||
}()
|
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,10 +85,6 @@ func (c *Context) Reset() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) InitializedCh() <-chan struct{} {
|
|
||||||
return c.initialized
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Context) Worker() mgl.Worker {
|
func (c *Context) Worker() mgl.Worker {
|
||||||
return c.worker
|
return c.worker
|
||||||
}
|
}
|
||||||
|
@ -40,13 +40,6 @@ func Render(chError <-chan error) error {
|
|||||||
return errors.New("ui: chError must not be nil")
|
return errors.New("ui: chError must not be nil")
|
||||||
}
|
}
|
||||||
// TODO: Check this is called on the rendering thread
|
// TODO: Check this is called on the rendering thread
|
||||||
if chGLInitialized != nil {
|
|
||||||
if err := doGLWorks(chError, glContext.InitializedCh()); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
close(chGLInitialized)
|
|
||||||
<-chGLInitializedEnd
|
|
||||||
}
|
|
||||||
select {
|
select {
|
||||||
case chRender <- struct{}{}:
|
case chRender <- struct{}{}:
|
||||||
return doGLWorks(chError, chRenderEnd)
|
return doGLWorks(chError, chRenderEnd)
|
||||||
@ -87,8 +80,6 @@ type userInterface struct {
|
|||||||
var (
|
var (
|
||||||
chRender = make(chan struct{})
|
chRender = make(chan struct{})
|
||||||
chRenderEnd = make(chan struct{})
|
chRenderEnd = make(chan struct{})
|
||||||
chGLInitialized = make(chan struct{})
|
|
||||||
chGLInitializedEnd = make(chan struct{})
|
|
||||||
currentUI = &userInterface{
|
currentUI = &userInterface{
|
||||||
sizeChanged: true,
|
sizeChanged: true,
|
||||||
}
|
}
|
||||||
@ -111,12 +102,6 @@ func (u *userInterface) Terminate() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterface) Update() (interface{}, error) {
|
func (u *userInterface) Update() (interface{}, error) {
|
||||||
// TODO: Need lock?
|
|
||||||
if chGLInitialized != nil {
|
|
||||||
<-chGLInitialized
|
|
||||||
chGLInitialized = nil
|
|
||||||
close(chGLInitializedEnd)
|
|
||||||
}
|
|
||||||
if u.sizeChanged {
|
if u.sizeChanged {
|
||||||
u.sizeChanged = false
|
u.sizeChanged = false
|
||||||
e := ScreenSizeEvent{
|
e := ScreenSizeEvent{
|
||||||
|
Loading…
Reference in New Issue
Block a user