mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
opegnl: Remove initialization (use Reset instead) (mobile)
This commit is contained in:
parent
6cfb92c4c4
commit
61ba8dad17
@ -61,30 +61,13 @@ func init() {
|
||||
}
|
||||
|
||||
type context struct {
|
||||
gl mgl.Context
|
||||
worker mgl.Worker
|
||||
initialized chan struct{}
|
||||
gl mgl.Context
|
||||
worker mgl.Worker
|
||||
}
|
||||
|
||||
func NewContext() (*Context, error) {
|
||||
c := &Context{
|
||||
locationCache: newLocationCache(),
|
||||
lastCompositeMode: CompositeModeUnknown,
|
||||
}
|
||||
c := &Context{}
|
||||
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
|
||||
}
|
||||
|
||||
@ -102,10 +85,6 @@ func (c *Context) Reset() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Context) InitializedCh() <-chan struct{} {
|
||||
return c.initialized
|
||||
}
|
||||
|
||||
func (c *Context) Worker() mgl.Worker {
|
||||
return c.worker
|
||||
}
|
||||
|
@ -40,13 +40,6 @@ func Render(chError <-chan error) error {
|
||||
return errors.New("ui: chError must not be nil")
|
||||
}
|
||||
// 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 {
|
||||
case chRender <- struct{}{}:
|
||||
return doGLWorks(chError, chRenderEnd)
|
||||
@ -85,11 +78,9 @@ type userInterface struct {
|
||||
}
|
||||
|
||||
var (
|
||||
chRender = make(chan struct{})
|
||||
chRenderEnd = make(chan struct{})
|
||||
chGLInitialized = make(chan struct{})
|
||||
chGLInitializedEnd = make(chan struct{})
|
||||
currentUI = &userInterface{
|
||||
chRender = make(chan struct{})
|
||||
chRenderEnd = make(chan struct{})
|
||||
currentUI = &userInterface{
|
||||
sizeChanged: true,
|
||||
}
|
||||
)
|
||||
@ -111,12 +102,6 @@ func (u *userInterface) Terminate() error {
|
||||
}
|
||||
|
||||
func (u *userInterface) Update() (interface{}, error) {
|
||||
// TODO: Need lock?
|
||||
if chGLInitialized != nil {
|
||||
<-chGLInitialized
|
||||
chGLInitialized = nil
|
||||
close(chGLInitializedEnd)
|
||||
}
|
||||
if u.sizeChanged {
|
||||
u.sizeChanged = false
|
||||
e := ScreenSizeEvent{
|
||||
|
Loading…
Reference in New Issue
Block a user