Refactoring

This commit is contained in:
Hajime Hoshi 2013-11-29 03:21:53 +09:00
parent f0ef3384cb
commit 5fbfb3a3a3
4 changed files with 3 additions and 5 deletions

View File

@ -70,6 +70,7 @@ func (context *Context) DrawTextureParts(
context.offscreen.DrawTextureParts(tex, parts, geometryMatrix, colorMatrix)
}
// Init initializes the context. The initial state is saved for each GL context.
func (context *Context) Init() {
C.glEnable(C.GL_TEXTURE_2D)
C.glEnable(C.GL_BLEND)

View File

@ -28,8 +28,6 @@ func New(screenWidth, screenHeight, screenScale int) *Offscreen {
screenScale: screenScale,
}
// The main framebuffer should be created sooner than any other
// framebuffers!
mainFramebuffer := C.GLint(0)
C.glGetIntegerv(C.GL_FRAMEBUFFER_BINDING, &mainFramebuffer)

View File

@ -49,7 +49,7 @@ func Create(width, height int, filter texture.Filter) (
if err != nil {
return nil, nil, err
}
return tex.NewRenderTarget(&framebufferCreator{}), tex, nil
return tex.CreateRenderTarget(&framebufferCreator{}), tex, nil
}
func CreateWithFramebuffer(width, height int, framebuffer Framebuffer) (

View File

@ -111,7 +111,6 @@ type FramebufferCreator interface {
Create(native interface{}) interface{}
}
func (texture *Texture) NewRenderTarget(creator FramebufferCreator) *RenderTarget {
func (texture *Texture) CreateRenderTarget(creator FramebufferCreator) *RenderTarget {
return NewRenderTarget(creator.Create(texture.native), texture.width, texture.height)
}