mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Bug fix: Outside texels are used (#317)
This commit is contained in:
parent
d216a04cb6
commit
bb993a481b
@ -154,6 +154,8 @@ func (c *Context) NewTexture(width, height int, pixels []uint8, filter Filter) (
|
||||
if err := c.runOnContextThread(func() error {
|
||||
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, int32(filter))
|
||||
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, int32(filter))
|
||||
//gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP)
|
||||
//gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP)
|
||||
|
||||
var p interface{}
|
||||
if pixels != nil {
|
||||
|
@ -56,6 +56,9 @@ func vertices(parts ImageParts, width, height int, geo *affine.GeoM) []float32 {
|
||||
continue
|
||||
}
|
||||
u0, v0, u1, v1 := float64(sx0)/wf, float64(sy0)/hf, float64(sx1)/wf, float64(sy1)/hf
|
||||
// Adjust texels to fix a problem that outside texels are used (#317).
|
||||
u1 -= 1.0 / 16384.0
|
||||
v1 -= 1.0 / 16384.0
|
||||
vs.SetIndex(n, dx0)
|
||||
vs.SetIndex(n+1, dy0)
|
||||
vs.SetIndex(n+2, u0)
|
||||
|
@ -55,6 +55,9 @@ func vertices(parts ImageParts, width, height int, geo *affine.GeoM) []float32 {
|
||||
continue
|
||||
}
|
||||
u0, v0, u1, v1 := float32(sx0)/wf, float32(sy0)/hf, float32(sx1)/wf, float32(sy1)/hf
|
||||
// Adjust texels to fix a problem that outside texels are used (#317).
|
||||
u1 -= 1.0 / 16384.0
|
||||
v1 -= 1.0 / 16384.0
|
||||
vs[n] = x0
|
||||
vs[n+1] = y0
|
||||
vs[n+2] = u0
|
||||
|
Loading…
Reference in New Issue
Block a user