Skip to content

Commit d1e3510

Browse files
mardyWinterMute
authored andcommitted
ogc: avoid rounding issues with texture drawing
1 parent 876bbfb commit d1e3510

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/video/ogc/SDL_ogcgxcommon.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ void OGC_draw_init(int w, int h)
5959
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "OGC_draw_init called with %d, %d", w, h);
6060

6161
guMtxIdentity(mv);
62-
guMtxTransApply(mv, mv, 0.5, 0.5, 0);
62+
/* Ideally we would use 0.5 to center the coordinates on the pixels, but
63+
* this causes some visual artifacts due to rounding: in the VVVVVV game,
64+
* all 8x8 pixel textures lose their rightmost column and bottom row,
65+
* except when they are drawn on the bottom-right quadrant of the screen.
66+
* Values from 0.1 to 0.4 fix this issue, while preserving pixel accuracy
67+
* on drawing operations. */
68+
guMtxTransApply(mv, mv, 0.4, 0.4, 0);
6369
GX_LoadPosMtxImm(mv, GX_PNMTX0);
6470

6571
GX_ClearVtxDesc();

0 commit comments

Comments
 (0)