From f6523b28f4d26094610d1ef0c776aec9278b85df Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 27 Oct 2013 22:12:28 +0900 Subject: [PATCH] Add texture.NewEmpty --- graphics/opengl/context.go | 3 +-- graphics/opengl/rendertarget/render_target.go | 6 +++--- graphics/opengl/texture/texture.go | 7 +++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/graphics/opengl/context.go b/graphics/opengl/context.go index a4713a86a..edb58a4b8 100644 --- a/graphics/opengl/context.go +++ b/graphics/opengl/context.go @@ -52,8 +52,7 @@ func (context *Context) Init() { context.mainFramebufferTexture, err = rendertarget.NewWithFramebuffer( context.screenWidth*context.screenScale, context.screenHeight*context.screenScale, - rendertarget.Framebuffer(mainFramebuffer), - texture.FilterLinear) + rendertarget.Framebuffer(mainFramebuffer)) if err != nil { panic("creating main framebuffer failed: " + err.Error()) } diff --git a/graphics/opengl/rendertarget/render_target.go b/graphics/opengl/rendertarget/render_target.go index 46ef34860..717a36959 100644 --- a/graphics/opengl/rendertarget/render_target.go +++ b/graphics/opengl/rendertarget/render_target.go @@ -46,9 +46,9 @@ func New(width, height int, filter texture.Filter) ( Framebuffer(framebuffer.(C.GLuint))), tex, nil } -func NewWithFramebuffer(width, height int, framebuffer Framebuffer, - filter texture.Filter) (*rendertarget.RenderTarget, error) { - tex, err := texture.New(width, height, filter) +func NewWithFramebuffer(width, height int, framebuffer Framebuffer) ( + *rendertarget.RenderTarget, error) { + tex, err := texture.NewEmpty(width, height) if err != nil { return nil, err } diff --git a/graphics/opengl/texture/texture.go b/graphics/opengl/texture/texture.go index fcef9a7cf..b6e2ee9d2 100644 --- a/graphics/opengl/texture/texture.go +++ b/graphics/opengl/texture/texture.go @@ -70,6 +70,13 @@ func New(width, height int, filter Filter) (*gtexture.Texture, error) { return gtexture.New(width, height, f) } +func NewEmpty(width, height int) (*gtexture.Texture, error) { + f := func(textureWidth, textureHeight int) (interface{}, error) { + return nil, nil + } + return gtexture.New(width, height, f) +} + func NewFromImage(img image.Image) (*gtexture.Texture, error) { return gtexture.NewFromImage(img, createFromImage) }