Skip to content

Commit

Permalink
Move the center of the screen half a pixel
Browse files Browse the repository at this point in the history
The PS2 assumes the 0,0 pixel at the center of the screen. OpenGL (at least) assumes the 0,0 pixel at the top left. When the screen width/height is even, this causes a slight discrepancy.
  • Loading branch information
kernle32dll committed Feb 21, 2021
1 parent c760050 commit 01ffa38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/gs/GSH_OpenGL/GSH_OpenGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,12 @@ void CGSH_OpenGL::SetRenderingContext(uint64 primReg)
m_nPrimOfsX = offset.GetX();
m_nPrimOfsY = offset.GetY();

// Account for the fact that PS2 assumes the pixel center at the bottom left,
// but OpenGL at the center of the screen. On even resolutions this causes a slight
// discrepancy.
m_nPrimOfsX -= 0.5f;
m_nPrimOfsY -= 0.5f;

CHECKGLERROR();

m_renderState.isValid = true;
Expand Down

0 comments on commit 01ffa38

Please sign in to comment.