+ if (rsurface_mode == RSURFMODE_GLSL)
+ qglUseProgramObjectARB(0);
+ rsurface_mode = RSURFMODE_SKY;
+ if (skyrendernow)
+ {
+ skyrendernow = false;
+ R_Sky();
+ // restore entity matrix
+ R_Mesh_Matrix(&rsurface_entity->matrix);
+ }
+ GL_DepthMask(true);
+ // LordHavoc: HalfLife maps have freaky skypolys so don't use
+ // skymasking on them, and Quake3 never did sky masking (unlike
+ // software Quake and software Quake2), so disable the sky masking
+ // in Quake3 maps as it causes problems with q3map2 sky tricks,
+ // and skymasking also looks very bad when noclipping outside the
+ // level, so don't use it then either.
+ if (rsurface_model->type == mod_brushq1 && r_q1bsp_skymasking.integer && !r_worldnovis)
+ {
+ GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], 1);
+ R_Mesh_ColorPointer(NULL);
+ R_Mesh_ResetTextureState();
+ if (skyrendermasked)
+ {
+ // depth-only (masking)
+ GL_ColorMask(0,0,0,0);
+ // just to make sure that braindead drivers don't draw
+ // anything despite that colormask...
+ GL_BlendFunc(GL_ZERO, GL_ONE);
+ }
+ else
+ {
+ // fog sky
+ GL_BlendFunc(GL_ONE, GL_ZERO);
+ }
+ }