I tried searching on the web but couldn't find a reason for this. When I render an object close to the camera, the object and texture renders fine. But further away from a fixed distance, it starts showing weird color lines on the texture.
Close to the camera, no lines:
Further away, color lines appear on texture:
My shaders are pretty simple.
#version 330 core layout (location = 0) in vec3 pos; layout (location = 1) in vec2 tex; uniform mat4 projMatrix; uniform mat4 viewMatrix; out vec2 uvCoord; void main() { gl_Position = projMatrix * viewMatrix * vec4(pos.xyz, 1.0f); uvCoord = tex; } #version 330 core out vec4 FragColor; uniform sampler2D texture1; in vec2 uvCoord; void main() { FragColor = texture(texture1, uvCoord); } My texture parameters are:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); Any help would be appreciated!
Edit: I have generated mipmaps using glGenerateMipmap(GL_TEXTURE_2D)


glGenerateMipmap(GL_TEXTURE_2D);\$\endgroup\$