Refactoring

This commit is contained in:
Hajime Hoshi 2013-10-27 21:29:39 +09:00
parent e4ab8de45e
commit 0bf319f7d0
2 changed files with 9 additions and 8 deletions

View File

@ -37,12 +37,12 @@ func New(width, height int, filter texture.Filter) (
if err != nil {
return nil, err
}
framebuffer := C.GLuint(0)
tex.CreateFramebuffer(func(native interface{}) {
framebuffer =
createFramebuffer(C.GLuint(native.(texture.Native)))
})
return rendertarget.NewWithFramebuffer(tex, Framebuffer(framebuffer)), nil
f := func(native interface{}) interface{}{
return createFramebuffer(C.GLuint(native.(texture.Native)))
}
framebuffer := tex.CreateFramebuffer(f)
return rendertarget.NewWithFramebuffer(tex,
Framebuffer(framebuffer.(C.GLuint))), nil
}
func NewWithFramebuffer(width, height int, framebuffer Framebuffer,

View File

@ -126,6 +126,7 @@ func (texture *Texture) DrawParts(parts []graphics.TexturePart,
draw(texture.native, quads)
}
func (texture *Texture) CreateFramebuffer(create func(native interface{})) {
create(texture.native)
func (texture *Texture) CreateFramebuffer(
create func(native interface{}) interface{}) interface{} {
return create(texture.native)
}