Set texture interpolation to nearest to prevent fringing

This commit is contained in:
Kovid Goyal 2016-11-03 21:26:15 +05:30
parent 90f3c45a1f
commit aa1302b699
2 changed files with 8 additions and 7 deletions

View File

@ -538,7 +538,7 @@ int add_module_gl_constants(PyObject *module) {
GLC(GL_MAX_ARRAY_TEXTURE_LAYERS);
GLC(GL_MAX_TEXTURE_SIZE);
GLC(GL_TEXTURE_2D_ARRAY);
GLC(GL_LINEAR); GLC(GL_CLAMP_TO_EDGE);
GLC(GL_LINEAR); GLC(GL_CLAMP_TO_EDGE); GLC(GL_NEAREST);
GLC(GL_TEXTURE_MIN_FILTER); GLC(GL_TEXTURE_MAG_FILTER);
GLC(GL_TEXTURE_WRAP_S); GLC(GL_TEXTURE_WRAP_T);
GLC(GL_UNPACK_ALIGNMENT);

View File

@ -16,11 +16,12 @@ from .fast_data_types import (
glGetAttribLocation, glUseProgram, glBindVertexArray, GL_TEXTURE0,
GL_TEXTURE1, glGetIntegerv, GL_MAX_ARRAY_TEXTURE_LAYERS, glBufferData,
GL_MAX_TEXTURE_SIZE, glDeleteTexture, GL_TEXTURE_2D_ARRAY, glGenTextures,
glBindTexture, glTexParameteri, GL_LINEAR, GL_CLAMP_TO_EDGE, glDeleteBuffer,
glBindTexture, glTexParameteri, GL_CLAMP_TO_EDGE, glDeleteBuffer,
GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_TEXTURE_WRAP_S,
GL_TEXTURE_WRAP_T, glGenBuffers, GL_R8, GL_RED, GL_UNPACK_ALIGNMENT, GL_UNSIGNED_BYTE,
GL_STATIC_DRAW, GL_TEXTURE_BUFFER, GL_RGB32UI, glBindBuffer, glPixelStorei,
glTexBuffer, glActiveTexture, glTexStorage3D, glCopyImageSubData, glTexSubImage3D
GL_NEAREST, GL_TEXTURE_WRAP_T, glGenBuffers, GL_R8, GL_RED,
GL_UNPACK_ALIGNMENT, GL_UNSIGNED_BYTE, GL_STATIC_DRAW, GL_TEXTURE_BUFFER,
GL_RGB32UI, glBindBuffer, glPixelStorei, glTexBuffer, glActiveTexture,
glTexStorage3D, glCopyImageSubData, glTexSubImage3D
)
GL_VERSION = (3, 3)
@ -71,8 +72,8 @@ class Sprites:
tgt = GL_TEXTURE_2D_ARRAY
tex = glGenTextures(1)
glBindTexture(tgt, tex)
glTexParameteri(tgt, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexParameteri(tgt, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameteri(tgt, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexParameteri(tgt, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(tgt, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(tgt, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
znum = self.z + 1