diff --git a/examples/vector/main.go b/examples/vector/main.go index 2b6e06cc3..02b877259 100644 --- a/examples/vector/main.go +++ b/examples/vector/main.go @@ -43,7 +43,7 @@ const ( screenHeight = 480 ) -func drawEbitenText(screen *ebiten.Image) { +func drawEbitenText(screen *ebiten.Image, counter int) { var path vector.Path // E @@ -119,6 +119,7 @@ func drawEbitenText(screen *ebiten.Image) { vs[i].ColorR = 0xdb / float32(0xff) vs[i].ColorG = 0x56 / float32(0xff) vs[i].ColorB = 0x20 / float32(0xff) + vs[i].ColorA = float32((counter/30)%2)/2 + 0.5 } screen.DrawTriangles(vs, is, emptySubImage, op) } @@ -245,7 +246,7 @@ func (g *Game) Update() error { func (g *Game) Draw(screen *ebiten.Image) { screen.Fill(color.White) - drawEbitenText(screen) + drawEbitenText(screen, g.counter) drawEbitenLogo(screen, 20, 90) drawArc(screen, g.counter) drawWave(screen, g.counter) diff --git a/internal/graphicsdriver/metal/graphics.go b/internal/graphicsdriver/metal/graphics.go index 535d6d60b..d702dbf42 100644 --- a/internal/graphicsdriver/metal/graphics.go +++ b/internal/graphicsdriver/metal/graphics.go @@ -737,13 +737,13 @@ func (g *Graphics) Initialize() error { BackFaceStencil: mtl.StencilDescriptor{ StencilFailureOperation: mtl.StencilOperationKeep, DepthFailureOperation: mtl.StencilOperationKeep, - DepthStencilPassOperation: mtl.StencilOperationKeep, + DepthStencilPassOperation: mtl.StencilOperationZero, StencilCompareFunction: mtl.CompareFunctionNotEqual, }, FrontFaceStencil: mtl.StencilDescriptor{ StencilFailureOperation: mtl.StencilOperationKeep, DepthFailureOperation: mtl.StencilOperationKeep, - DepthStencilPassOperation: mtl.StencilOperationKeep, + DepthStencilPassOperation: mtl.StencilOperationZero, StencilCompareFunction: mtl.CompareFunctionNotEqual, }, }) diff --git a/internal/graphicsdriver/opengl/context_desktop.go b/internal/graphicsdriver/opengl/context_desktop.go index 1aee657fe..85c6d3d70 100644 --- a/internal/graphicsdriver/opengl/context_desktop.go +++ b/internal/graphicsdriver/opengl/context_desktop.go @@ -520,6 +520,6 @@ func (c *context) beginStencilWithEvenOddRule() { func (c *context) endStencilWithEvenOddRule() { gl.StencilFunc(gl.NOTEQUAL, 0x00, 0xff) - gl.StencilOp(gl.KEEP, gl.KEEP, gl.KEEP) + gl.StencilOp(gl.KEEP, gl.KEEP, gl.ZERO) gl.ColorMask(true, true, true, true) } diff --git a/internal/graphicsdriver/opengl/context_js.go b/internal/graphicsdriver/opengl/context_js.go index ce44ff9eb..12e09c92d 100644 --- a/internal/graphicsdriver/opengl/context_js.go +++ b/internal/graphicsdriver/opengl/context_js.go @@ -660,6 +660,6 @@ func (c *context) beginStencilWithEvenOddRule() { func (c *context) endStencilWithEvenOddRule() { gl := c.gl gl.stencilFunc.Invoke(gles.NOTEQUAL, 0x00, 0xff) - gl.stencilOp.Invoke(gles.KEEP, gles.KEEP, gles.KEEP) + gl.stencilOp.Invoke(gles.KEEP, gles.KEEP, gles.ZERO) gl.colorMask.Invoke(true, true, true, true) } diff --git a/internal/graphicsdriver/opengl/context_mobile.go b/internal/graphicsdriver/opengl/context_mobile.go index e74aa6fdf..f0b65a248 100644 --- a/internal/graphicsdriver/opengl/context_mobile.go +++ b/internal/graphicsdriver/opengl/context_mobile.go @@ -488,6 +488,6 @@ func (c *context) beginStencilWithEvenOddRule() { func (c *context) endStencilWithEvenOddRule() { c.ctx.StencilFunc(gles.NOTEQUAL, 0x00, 0xff) - c.ctx.StencilOp(gles.KEEP, gles.KEEP, gles.KEEP) + c.ctx.StencilOp(gles.KEEP, gles.KEEP, gles.ZERO) c.ctx.ColorMask(true, true, true, true) }