diff --git a/pixelgl/interface.go b/pixelgl/interface.go index 73189cd377bd159e061aba28c9d0e9d26f834ca0..f65118956d84206822ca0d9df9b0350bba1a13ad 100644 --- a/pixelgl/interface.go +++ b/pixelgl/interface.go @@ -8,4 +8,4 @@ package pixelgl type BeginEnder interface { Begin() End() -} \ No newline at end of file +} diff --git a/pixelgl/texture.go b/pixelgl/texture.go index b14e5b79c5198d5471f51829e842efe464bb94e7..ee1c22c8dc77d907a5376406b32b69fd7ce4f8cf 100644 --- a/pixelgl/texture.go +++ b/pixelgl/texture.go @@ -4,6 +4,7 @@ import ( "runtime" "github.com/go-gl/gl/v3.3-core/gl" + "github.com/go-gl/mathgl/mgl32" ) // Texture is an OpenGL texture. @@ -47,19 +48,19 @@ func NewTexture(width, height int, smooth bool, pixels []uint8) *Texture { gl.Ptr(pixels), ) - gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.MIRRORED_REPEAT) - gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.MIRRORED_REPEAT) + borderColor := mgl32.Vec4{0, 0, 0, 0} + gl.TexParameterfv(gl.TEXTURE_2D, gl.TEXTURE_BORDER_COLOR, &borderColor[0]) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_BORDER) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_BORDER) if smooth { - gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) } else { - gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_NEAREST) + gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST) gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST) } - gl.GenerateMipmap(gl.TEXTURE_2D) - runtime.SetFinalizer(tex, (*Texture).delete) return tex