Add opengl.Framebuffer.Fill

This commit is contained in:
Hajime Hoshi 2014-12-31 15:26:06 +09:00
parent fbcd04cda8
commit a4a4c91eb1
2 changed files with 8 additions and 3 deletions

View File

@ -15,6 +15,7 @@
package graphics
import (
// TODO: Remove this
"github.com/go-gl/gl"
"github.com/hajimehoshi/ebiten/internal"
"github.com/hajimehoshi/ebiten/internal/graphics/internal/shader"
@ -103,9 +104,7 @@ func (f *Framebuffer) Fill(r, g, b, a float64) error {
if err := f.setAsViewport(); err != nil {
return err
}
gl.ClearColor(gl.GLclampf(r), gl.GLclampf(g), gl.GLclampf(b), gl.GLclampf(a))
gl.Clear(gl.COLOR_BUFFER_BIT)
return nil
return f.framebuffer.Fill(r, g, b, a)
}
func (f *Framebuffer) DrawTexture(t *Texture, quads TextureQuads, geo, clr Matrix) error {

View File

@ -66,6 +66,12 @@ func (f Framebuffer) SetAsViewport(width, height int) error {
return nil
}
func (f Framebuffer) Fill(r, g, b, a float64) error {
gl.ClearColor(gl.GLclampf(r), gl.GLclampf(g), gl.GLclampf(b), gl.GLclampf(a))
gl.Clear(gl.COLOR_BUFFER_BIT)
return nil
}
func (f Framebuffer) Delete() {
gl.Framebuffer(f).Delete()
}