Centering an OpenGL viewport in an SDL window


I’m trying to center an OpenGL (3.2) viewport inside an SDL window (with a black border), and while the area rendered is correct, it is still rendered as if its origin is located at the window’s bottom left corner (See example):


I’m currently using glViewport to center my graphics, but obviously it’s an incorrect/partial solution. In the native macOS Cocoa port of the same project, I simply have the OpenGL view cover only part of the window, so I don’t have to worry about “correcting” the origin. Is something similar can be done in SDL? If not, is it possible to “correct” the origin in a way that doesn’t require modifying the fragment shader code (i.e. not something like realCoord = gl_FragCoord - uOrigin;)?