1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-18 23:55:26 +01:00

OpenGL3: Add subpixel offset for 2D rendering (#16676)

This commit is contained in:
ExeVirus
2025-11-16 08:59:33 -05:00
committed by GitHub
parent 785042dc9e
commit 7c310cd7f5

View File

@@ -18,7 +18,10 @@ varying vec4 vVertexColor;
void main()
{
gl_Position = uProjection * inVertexPosition;
// Subpixel offset to render pixel-perfect 2D images
// This is a compromise that is expected to work well on most drivers.
// Explanation: https://jvm-gaming.org/t/pixel-perfect-rendering-in-2d/26261/4
gl_Position = uProjection * (inVertexPosition + vec4(0.375, 0.375, 0.0, 0.0));
gl_PointSize = uThickness;
vTextureCoord = inTexCoord0;
vVertexColor = inVertexColor.bgra;