graphics: Remove openGLState.initialize

This commit is contained in:
Hajime Hoshi 2016-05-16 11:32:21 +09:00
parent da0196911d
commit d6bfa72c5c
3 changed files with 6 additions and 12 deletions

View File

@ -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
} }

View File

@ -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
} }

View File

@ -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