mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 19:22:49 +01:00
Add texture.NewEmpty
This commit is contained in:
parent
f290a137a9
commit
f6523b28f4
@ -52,8 +52,7 @@ func (context *Context) Init() {
|
|||||||
context.mainFramebufferTexture, err = rendertarget.NewWithFramebuffer(
|
context.mainFramebufferTexture, err = rendertarget.NewWithFramebuffer(
|
||||||
context.screenWidth*context.screenScale,
|
context.screenWidth*context.screenScale,
|
||||||
context.screenHeight*context.screenScale,
|
context.screenHeight*context.screenScale,
|
||||||
rendertarget.Framebuffer(mainFramebuffer),
|
rendertarget.Framebuffer(mainFramebuffer))
|
||||||
texture.FilterLinear)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("creating main framebuffer failed: " + err.Error())
|
panic("creating main framebuffer failed: " + err.Error())
|
||||||
}
|
}
|
||||||
|
@ -46,9 +46,9 @@ func New(width, height int, filter texture.Filter) (
|
|||||||
Framebuffer(framebuffer.(C.GLuint))), tex, nil
|
Framebuffer(framebuffer.(C.GLuint))), tex, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWithFramebuffer(width, height int, framebuffer Framebuffer,
|
func NewWithFramebuffer(width, height int, framebuffer Framebuffer) (
|
||||||
filter texture.Filter) (*rendertarget.RenderTarget, error) {
|
*rendertarget.RenderTarget, error) {
|
||||||
tex, err := texture.New(width, height, filter)
|
tex, err := texture.NewEmpty(width, height)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,13 @@ func New(width, height int, filter Filter) (*gtexture.Texture, error) {
|
|||||||
return gtexture.New(width, height, f)
|
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) {
|
func NewFromImage(img image.Image) (*gtexture.Texture, error) {
|
||||||
return gtexture.NewFromImage(img, createFromImage)
|
return gtexture.NewFromImage(img, createFromImage)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user