Skip to content

Commit

Permalink
ogc: avoid rounding issues with texture drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
mardy authored and WinterMute committed Jan 30, 2024
1 parent 876bbfb commit d1e3510
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/video/ogc/SDL_ogcgxcommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ void OGC_draw_init(int w, int h)
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "OGC_draw_init called with %d, %d", w, h);

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

GX_ClearVtxDesc();
Expand Down

0 comments on commit d1e3510

Please sign in to comment.