diff --git a/libs/video/renderer/glsl/glsl_bsp.c b/libs/video/renderer/glsl/glsl_bsp.c index 6c4007cf1..2bd082d75 100644 --- a/libs/video/renderer/glsl/glsl_bsp.c +++ b/libs/video/renderer/glsl/glsl_bsp.c @@ -1181,14 +1181,16 @@ R_LoadSkys (const char *sky) { const char *name; int i; + // NOTE: quake's world and GL's world are rotated relative to each other + // quake has x right, y in, z up. gl has x right, y up, z out static const char *sky_suffix[] = { "ft", "bk", "lf", "rt", "up", "dn"}; static int sky_target[] = { GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, }; if (!sky || !*sky) diff --git a/libs/video/renderer/glsl/quakeskb.frag b/libs/video/renderer/glsl/quakeskb.frag index 067e6a01d..10146e843 100644 --- a/libs/video/renderer/glsl/quakeskb.frag +++ b/libs/video/renderer/glsl/quakeskb.frag @@ -8,5 +8,10 @@ main (void) vec3 dir = direction; dir *= inversesqrt (dot (dir, dir)); - gl_FragColor = textureCube(sky, dir); + + // NOTE: quake's world and GL's world are rotated relative to each other + // quake has x right, y in, z up. gl has x right, y up, z out + // The textures are loaded with GL's z (quake's y) already negated, so + // all that's needed here is to swizzle y and z. + gl_FragColor = textureCube(sky, dir.xzy); }