mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
parent
a60976f260
commit
2dc4f3fdf0
@ -23,20 +23,6 @@ var (
|
||||
oneMinus = math.Nextafter32(1, 0)
|
||||
)
|
||||
|
||||
// adjustForClearColor adjust the value x for glClearColor function.
|
||||
//
|
||||
// On some machines like MacBook Pro, exact 0 and exact 1 might cause problems
|
||||
// at glClearColor() (#452).
|
||||
func adjustForClearColor(x float32) float32 {
|
||||
if x <= 0 {
|
||||
return zeroPlus
|
||||
}
|
||||
if x >= 1 {
|
||||
return oneMinus
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
var (
|
||||
VertexShader ShaderType
|
||||
FragmentShader ShaderType
|
||||
|
@ -270,17 +270,6 @@ func (c *Context) setViewportImpl(width, height int) {
|
||||
})
|
||||
}
|
||||
|
||||
func (c *Context) FillFramebuffer(r, g, b, a float32) error {
|
||||
return c.runOnContextThread(func() error {
|
||||
gl.ClearColor(adjustForClearColor(r),
|
||||
adjustForClearColor(g),
|
||||
adjustForClearColor(b),
|
||||
adjustForClearColor(a))
|
||||
gl.Clear(gl.COLOR_BUFFER_BIT)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (c *Context) DeleteFramebuffer(f Framebuffer) {
|
||||
_ = c.runOnContextThread(func() error {
|
||||
ff := uint32(f)
|
||||
|
@ -218,17 +218,6 @@ func (c *Context) setViewportImpl(width, height int) {
|
||||
gl.Viewport(0, 0, width, height)
|
||||
}
|
||||
|
||||
func (c *Context) FillFramebuffer(r, g, b, a float32) error {
|
||||
// TODO: Use f?
|
||||
gl := c.gl
|
||||
gl.ClearColor(adjustForClearColor(r),
|
||||
adjustForClearColor(g),
|
||||
adjustForClearColor(b),
|
||||
adjustForClearColor(a))
|
||||
gl.Clear(gl.COLOR_BUFFER_BIT)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Context) DeleteFramebuffer(f Framebuffer) {
|
||||
gl := c.gl
|
||||
if !gl.IsFramebuffer(f.(*js.Object)) {
|
||||
|
@ -211,16 +211,6 @@ func (c *Context) setViewportImpl(width, height int) {
|
||||
gl.Viewport(0, 0, width, height)
|
||||
}
|
||||
|
||||
func (c *Context) FillFramebuffer(r, g, b, a float32) error {
|
||||
gl := c.gl
|
||||
gl.ClearColor(adjustForClearColor(r),
|
||||
adjustForClearColor(g),
|
||||
adjustForClearColor(b),
|
||||
adjustForClearColor(a))
|
||||
gl.Clear(mgl.COLOR_BUFFER_BIT)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Context) DeleteFramebuffer(f Framebuffer) {
|
||||
gl := c.gl
|
||||
if !gl.IsFramebuffer(mgl.Framebuffer(f)) {
|
||||
|
Loading…
Reference in New Issue
Block a user