mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
graphics: Remove openGLState.initialize
This commit is contained in:
parent
da0196911d
commit
d6bfa72c5c
@ -21,7 +21,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type openGLState struct {
|
type openGLState struct {
|
||||||
initialized bool
|
|
||||||
indexBufferLines opengl.Buffer
|
indexBufferLines opengl.Buffer
|
||||||
indexBufferQuads opengl.Buffer
|
indexBufferQuads opengl.Buffer
|
||||||
programTexture opengl.Program
|
programTexture opengl.Program
|
||||||
@ -44,15 +43,11 @@ const (
|
|||||||
float32Size = 4
|
float32Size = 4
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitializeIfNeeded(c *opengl.Context) error {
|
func Initialize(c *opengl.Context) error {
|
||||||
return theOpenGLState.initializeIfNeeded(c)
|
return theOpenGLState.initialize(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *openGLState) initializeIfNeeded(c *opengl.Context) error {
|
func (s *openGLState) initialize(c *opengl.Context) error {
|
||||||
if s.initialized {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var zeroProgram opengl.Program
|
var zeroProgram opengl.Program
|
||||||
s.lastProgram = zeroProgram
|
s.lastProgram = zeroProgram
|
||||||
s.lastProjectionMatrix = nil
|
s.lastProjectionMatrix = nil
|
||||||
@ -100,7 +95,6 @@ func (s *openGLState) initializeIfNeeded(c *opengl.Context) error {
|
|||||||
}
|
}
|
||||||
s.indexBufferLines = c.NewBuffer(c.ElementArrayBuffer, indices, c.StaticDraw)
|
s.indexBufferLines = c.NewBuffer(c.ElementArrayBuffer, indices, c.StaticDraw)
|
||||||
|
|
||||||
s.initialized = true
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ func Init() (*opengl.Context, error) {
|
|||||||
if err := u.context.Init(); err != nil {
|
if err := u.context.Init(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := graphics.InitializeIfNeeded(u.context); err != nil {
|
if err := graphics.Initialize(u.context); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ func Init() (*opengl.Context, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := graphics.InitializeIfNeeded(c); err != nil {
|
if err := graphics.Initialize(c); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return c, nil
|
return c, nil
|
||||||
@ -220,7 +220,7 @@ func Init() (*opengl.Context, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := graphics.InitializeIfNeeded(c); err != nil {
|
if err := graphics.Initialize(c); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return c, nil
|
return c, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user