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