GL_Color no longer interacts with GL_ColorPointer (so be sure to set GL_ColorPointer...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 10 Mar 2004 07:43:41 +0000 (07:43 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 10 Mar 2004 07:43:41 +0000 (07:43 +0000)
GL_ColorPointer now resets glColor when array is turned off, because glColor gets trashed while color array is on (so sayeth the GL spec, and so proveth the NVIDIA driver)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4001 d7cf8633-e32d-0410-b094-e92efae38249

cl_particles.c
gl_backend.c
gl_draw.c
gl_models.c
gl_rmain.c
gl_rsurf.c
r_explosion.c
r_lightning.c
r_shadow.c
r_sky.c

index 3129fa5..aa458a2 100644 (file)
@@ -1877,6 +1877,7 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2)
                }
        }
 
+       GL_ColorPointer(NULL);
        GL_Color(cr, cg, cb, ca);
 
        R_Mesh_Matrix(&r_identitymatrix);
index 003ccfe..d562789 100644 (file)
@@ -451,6 +451,7 @@ void GL_Backend_ResetState(void)
        qglColorPointer(4, GL_FLOAT, sizeof(float[4]), NULL);CHECKGLERROR
        qglDisableClientState(GL_COLOR_ARRAY);CHECKGLERROR
 
+       GL_ColorPointer(NULL);
        GL_Color(0, 0, 0, 0);
        GL_Color(1, 1, 1, 1);
 
@@ -587,6 +588,9 @@ void GL_ColorPointer(const float *p)
                {
                        qglDisableClientState(GL_COLOR_ARRAY);
                        CHECKGLERROR
+                       // when color array is on the glColor gets trashed, set it again
+                       qglColor4f(gl_state.color4f[0], gl_state.color4f[1], gl_state.color4f[2], gl_state.color4f[3]);
+                       CHECKGLERROR
                }
                gl_state.pointer_color = p;
                qglColorPointer(4, GL_FLOAT, sizeof(float[4]), gl_state.pointer_color);
@@ -600,13 +604,12 @@ void GL_Color(float cr, float cg, float cb, float ca)
        {
                if (r_showtrispass)
                        return;
-               GL_ColorPointer(NULL);
                gl_state.color4f[0] = cr;
                gl_state.color4f[1] = cg;
                gl_state.color4f[2] = cb;
                gl_state.color4f[3] = ca;
                CHECKGLERROR
-               qglColor4f(cr, cg, cb, ca);
+               qglColor4f(gl_state.color4f[0], gl_state.color4f[1], gl_state.color4f[2], gl_state.color4f[3]);
                CHECKGLERROR
        }
 }
index f2aa892..b488ba1 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -433,6 +433,8 @@ void R_DrawQueue(void)
        pic = NULL;
        texnum = 0;
        color = 0;
+       GL_ColorPointer(NULL);
+       GL_Color(1,1,1,1);
 
        batch = false;
        batchcount = 0;
@@ -518,6 +520,7 @@ void R_DrawQueue(void)
                        m.pointer_texcoord[0] = mesh->data_texcoord2f;
                        R_Mesh_State_Texture(&m);
                        R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
+                       GL_ColorPointer(NULL);
                        currentpic = "\0";
                        break;
                case DRAWQUEUE_SETCLIP:
index d829e9f..17e1f2b 100644 (file)
@@ -242,6 +242,7 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                if (layer->flags & ALIASLAYER_FOG)
                {
                        colorscale *= fog;
+                       GL_ColorPointer(NULL);
                        GL_Color(fogcolor[0] * colorscale, fogcolor[1] * colorscale, fogcolor[2] * colorscale, ent->alpha);
                }
                else
@@ -265,7 +266,10 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                                VectorScale(tint, r_shadow_realtime_world_lightmaps.value, tint);
                        colorscale *= ifog;
                        if (fullbright)
+                       {
+                               GL_ColorPointer(NULL);
                                GL_Color(tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha);
+                       }
                        else
                        {
                                if (R_LightModel(ambientcolor4f, diffusecolor, diffusenormal, ent, tint[0] * colorscale, tint[1] * colorscale, tint[2] * colorscale, ent->alpha, false))
@@ -275,7 +279,10 @@ void R_DrawAliasModelCallback (const void *calldata1, int calldata2)
                                        R_LightModel_CalcVertexColors(ambientcolor4f, diffusecolor, diffusenormal, mesh->num_vertices, varray_vertex3f, varray_normal3f, varray_color4f);
                                }
                                else
+                               {
+                                       GL_ColorPointer(NULL);
                                        GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]);
+                               }
                        }
                }
                R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
@@ -755,7 +762,10 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
                R_LightModel_CalcVertexColors(ambientcolor4f, diffusecolor, diffusenormal, numverts, varray_vertex3f, aliasvert_normal3f, varray_color4f);
        }
        else
+       {
+               GL_ColorPointer(NULL);
                GL_Color(ambientcolor4f[0], ambientcolor4f[1], ambientcolor4f[2], ambientcolor4f[3]);
+       }
        R_Mesh_Draw(numverts, numtriangles, elements);
        c_alias_polys += numtriangles;
 
@@ -772,6 +782,7 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
                //mstate.pointer_texcoord = ent->model->alias.zymdata_texcoords;
                R_Mesh_State_Texture(&mstate);
 
+               GL_ColorPointer(NULL);
                GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], ent->alpha * fog);
                ZymoticTransformVerts(numverts, varray_vertex3f, ent->model->alias.zymdata_vertbonecounts, ent->model->alias.zymdata_verts);
                R_Mesh_Draw(numverts, numtriangles, elements);
index a7da202..5216f4b 100644 (file)
@@ -564,6 +564,7 @@ static void R_BlendView(void)
        GL_DepthMask(true);
        GL_DepthTest(false); // magic
        GL_VertexPointer(vertex3f);
+       GL_ColorPointer(NULL);
        GL_Color(r_refdef.viewblend[0], r_refdef.viewblend[1], r_refdef.viewblend[2], r_refdef.viewblend[3]);
        r = 64;
        vertex3f[0] = r_vieworigin[0] + r_viewforward[0] * 1.5 + r_viewleft[0] * r - r_viewup[0] * r;
@@ -934,6 +935,7 @@ void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, int depth
        }
 
        R_Mesh_Matrix(&r_identitymatrix);
+       GL_ColorPointer(NULL);
        GL_Color(cr, cg, cb, ca);
        GL_VertexPointer(varray_vertex3f);
        GL_BlendFunc(blendfunc1, blendfunc2);
index 3fd699d..cdf1ee5 100644 (file)
@@ -745,6 +745,7 @@ static void RSurfShader_Sky(const entity_render_t *ent, const texture_t *texture
 
        R_Mesh_Matrix(&ent->matrix);
 
+       GL_ColorPointer(NULL);
        GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], 1);
        if (skyrendermasked)
        {
@@ -833,7 +834,10 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
        if (fogenabled)
                GL_ColorPointer(varray_color4f);
        else
+       {
+               GL_ColorPointer(NULL);
                GL_Color(1, 1, 1, alpha);
+       }
        if (gl_textureshader && r_watershader.value && !fogenabled)
        {
                GL_ActiveTexture (0);
@@ -1016,6 +1020,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetailGlow(co
                m.tex[3] = R_GetTexture(texture->skin.glow);
                m.texcombinergb[3] = GL_ADD;
        }
+       GL_ColorPointer(NULL);
        if (r_shadow_realtime_world.integer)
                GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
        else
@@ -1056,6 +1061,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmapDetail(const
        m.texrgbscale[1] = 2;
        m.tex[2] = R_GetTexture(texture->skin.detail);
        m.texrgbscale[2] = 2;
+       GL_ColorPointer(NULL);
        if (r_shadow_realtime_world.integer)
                GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
        else
@@ -1093,6 +1099,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseCombine_TextureLightmap(const entity
        m.tex[0] = R_GetTexture(texture->skin.base);
        m.tex[1] = R_GetTexture((**surfchain).lightmaptexture);
        m.texrgbscale[1] = 2;
+       GL_ColorPointer(NULL);
        if (r_shadow_realtime_world.integer)
                GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
        else
@@ -1125,6 +1132,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseTexture(const entity_render_t *ent,
        GL_DepthTest(true);
        GL_BlendFunc(GL_ONE, GL_ZERO);
        m.tex[0] = R_GetTexture(texture->skin.base);
+       GL_ColorPointer(NULL);
        if (r_shadow_realtime_world.integer)
                GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
        else
@@ -1151,6 +1159,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseLightmap(const entity_render_t *ent,
        GL_DepthMask(false);
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture((**surfchain).lightmaptexture);
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        while((surf = *surfchain++) != NULL)
        {
@@ -1204,6 +1213,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseDetail(const entity_render_t *ent, c
        GL_DepthMask(false);
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(texture->skin.detail);
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        while((surf = *surfchain++) != NULL)
        {
@@ -1226,6 +1236,7 @@ static void RSurfShader_OpaqueWall_Pass_Glow(const entity_render_t *ent, const t
        GL_DepthMask(false);
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(texture->skin.glow);
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        while((surf = *surfchain++) != NULL)
        {
@@ -1248,6 +1259,7 @@ static void RSurfShader_OpaqueWall_Pass_OpaqueGlow(const entity_render_t *ent, c
        GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
        GL_DepthMask(true);
        m.tex[0] = R_GetTexture(texture->skin.glow);
+       GL_ColorPointer(NULL);
        if (m.tex[0])
                GL_Color(1, 1, 1, 1);
        else
@@ -1275,6 +1287,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseLightmapOnly(const entity_render_t *
        GL_DepthMask(true);
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture((**surfchain).lightmaptexture);
+       GL_ColorPointer(NULL);
        if (r_shadow_realtime_world.integer)
                GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
        else
@@ -1547,6 +1560,7 @@ static void R_DrawPortal_Callback(const void *calldata1, int calldata2)
        R_Mesh_State_Texture(&m);
 
        i = portal - ent->model->brushq1.portals;
+       GL_ColorPointer(NULL);
        GL_Color(((i & 0x0007) >> 0) * (1.0f / 7.0f),
                         ((i & 0x0038) >> 3) * (1.0f / 7.0f),
                         ((i & 0x01C0) >> 6) * (1.0f / 7.0f),
@@ -2032,6 +2046,7 @@ void R_DrawCollisionBrush(colbrushf_t *brush)
 {
        int i;
        i = ((int)brush) / sizeof(colbrushf_t);
+       GL_ColorPointer(NULL);
        GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
        GL_VertexPointer(brush->points->v);
        R_Mesh_Draw(brush->numpoints, brush->numtriangles, brush->elements);
@@ -2043,6 +2058,7 @@ void R_Q3BSP_DrawCollisionFace(entity_render_t *ent, q3mface_t *face)
        if (!face->num_collisiontriangles)
                return;
        i = ((int)face) / sizeof(q3mface_t);
+       GL_ColorPointer(NULL);
        GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
        GL_VertexPointer(face->data_collisionvertex3f);
        R_Mesh_Draw(face->num_collisionvertices, face->num_collisiontriangles, face->data_collisionelement3i);
@@ -2063,6 +2079,7 @@ void R_Q3BSP_DrawSkyFace(entity_render_t *ent, q3mface_t *face)
 
        R_Mesh_Matrix(&ent->matrix);
 
+       GL_ColorPointer(NULL);
        GL_Color(fogcolor[0], fogcolor[1], fogcolor[2], 1);
        if (skyrendermasked)
        {
@@ -2095,6 +2112,7 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_OpaqueGlow(entity_render_t *ent, q3mface_t
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(true);
        GL_DepthTest(true);
+       GL_ColorPointer(NULL);
        if (face->texture->skin.glow)
        {
                m.tex[0] = R_GetTexture(face->texture->skin.glow);
@@ -2120,6 +2138,7 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureLightmapCombine(entity_render_t *en
        m.tex[1] = R_GetTexture(face->lightmaptexture);
        m.pointer_texcoord[1] = face->data_texcoordlightmap2f;
        m.texrgbscale[1] = 2;
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        R_Mesh_State_Texture(&m);
        GL_VertexPointer(face->data_vertex3f);
@@ -2135,6 +2154,7 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_Texture(entity_render_t *ent, q3mface_t *f
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(face->texture->skin.base);
        m.pointer_texcoord[0] = face->data_texcoordtexture2f;
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        R_Mesh_State_Texture(&m);
        GL_VertexPointer(face->data_vertex3f);
@@ -2150,6 +2170,7 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(entity_render_t *ent, q3mface_t *
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(face->lightmaptexture);
        m.pointer_texcoord[0] = face->data_texcoordlightmap2f;
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        R_Mesh_State_Texture(&m);
        GL_VertexPointer(face->data_vertex3f);
@@ -2165,6 +2186,7 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_LightmapOnly(entity_render_t *ent, q3mface
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(face->lightmaptexture);
        m.pointer_texcoord[0] = face->data_texcoordlightmap2f;
+       GL_ColorPointer(NULL);
        if (r_shadow_realtime_world.integer)
                GL_Color(r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, r_shadow_realtime_world_lightmaps.value, 1);
        else
@@ -2181,6 +2203,7 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(entity_render_t *ent, q3mface_t *face
        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
        GL_DepthMask(false);
        GL_DepthTest(true);
+       GL_ColorPointer(NULL);
        if (face->texture->skin.glow)
        {
                m.tex[0] = R_GetTexture(face->texture->skin.glow);
@@ -2270,6 +2293,7 @@ void R_Q3BSP_DrawFace_OpaqueWall_Pass_AddTextureAmbient(entity_render_t *ent, q3
        GL_DepthTest(true);
        m.tex[0] = R_GetTexture(face->texture->skin.base);
        m.pointer_texcoord[0] = face->data_texcoordtexture2f;
+       GL_ColorPointer(NULL);
        GL_Color(r_ambient.value * (1.0f / 128.0f), r_ambient.value * (1.0f / 128.0f), r_ambient.value * (1.0f / 128.0f), 1);
        R_Mesh_State_Texture(&m);
        GL_VertexPointer(face->data_vertex3f);
@@ -2299,6 +2323,7 @@ void R_Q3BSP_DrawFace_TransparentCallback(const void *voident, int facenumber)
                {
                        m.tex[1] = R_GetTexture(face->lightmaptexture);
                        m.pointer_texcoord[1] = face->data_texcoordlightmap2f;
+                       GL_ColorPointer(NULL);
                        GL_Color(1, 1, 1, ent->alpha);
                }
                else
index 45b7f5c..775fa23 100644 (file)
@@ -188,6 +188,7 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
        numtriangles = EXPLOSIONTRIS;
        numverts = EXPLOSIONVERTS;
        alpha = e->alpha;
+       GL_ColorPointer(NULL);
        GL_Color(alpha, alpha, alpha, 1);
        GL_VertexPointer(e->vert[0]);
 
index 5919d3c..9162560 100644 (file)
@@ -316,6 +316,7 @@ void R_DrawLightningBeamCallback(const void *calldata1, int calldata2)
        else
        {
                // solid color if fog is not used
+               GL_ColorPointer(NULL);
                GL_Color(r_lightningbeam_color_red.value, r_lightningbeam_color_green.value, r_lightningbeam_color_blue.value, 1);
        }
 
index 9a660ed..17d8234 100644 (file)
@@ -735,6 +735,7 @@ void R_Shadow_Stage_Begin(void)
        GL_DepthMask(false);
        GL_DepthTest(true);
        R_Mesh_State_Texture(&m);
+       GL_ColorPointer(NULL);
        GL_Color(0, 0, 0, 1);
        qglCullFace(GL_FRONT); // quake is backwards, this culls back faces
        GL_Scissor(r_view_x, r_view_y, r_view_width, r_view_height);
@@ -766,6 +767,7 @@ void R_Shadow_Stage_ShadowVolumes(void)
        rmeshstate_t m;
        memset(&m, 0, sizeof(m));
        R_Mesh_State_Texture(&m);
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        GL_ColorMask(0, 0, 0, 0);
        GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -821,6 +823,7 @@ void R_Shadow_Stage_LightWithoutShadows(void)
        GL_DepthTest(true);
        qglPolygonOffset(0, 0);
        //qglDisable(GL_POLYGON_OFFSET_FILL);
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        GL_ColorMask(1, 1, 1, 1);
        qglDepthFunc(GL_EQUAL);
@@ -845,6 +848,7 @@ void R_Shadow_Stage_LightWithShadows(void)
        GL_DepthTest(true);
        qglPolygonOffset(0, 0);
        //qglDisable(GL_POLYGON_OFFSET_FILL);
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        GL_ColorMask(1, 1, 1, 1);
        qglDepthFunc(GL_EQUAL);
@@ -871,6 +875,7 @@ void R_Shadow_Stage_End(void)
        GL_DepthTest(true);
        qglPolygonOffset(0, 0);
        //qglDisable(GL_POLYGON_OFFSET_FILL);
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        GL_ColorMask(1, 1, 1, 1);
        GL_Scissor(r_view_x, r_view_y, r_view_width, r_view_height);
@@ -1188,6 +1193,7 @@ void R_Shadow_DiffuseLighting(int numverts, int numtriangles, const int *element
        {
                if (!bumptexture)
                        bumptexture = r_shadow_blankbumptexture;
+               GL_ColorPointer(NULL);
                GL_Color(1,1,1,1);
                // colorscale accounts for how much we multiply the brightness during combine
                // mult is how many times the final pass of the lighting will be
@@ -1484,6 +1490,7 @@ void R_Shadow_SpecularLighting(int numverts, int numtriangles, const int *elemen
                if (glosstexture == r_shadow_blankglosstexture)
                        colorscale *= r_shadow_gloss2intensity.value;
                GL_VertexPointer(vertex3f);
+               GL_ColorPointer(NULL);
                GL_Color(1,1,1,1);
                if (r_shadow_texture3d.integer && r_textureunits.integer >= 2 && lightcubemap /*&& gl_support_blendsquare*/) // FIXME: detect blendsquare!
                {
@@ -2069,6 +2076,7 @@ void R_DrawRTLight(rtlight_t *rtlight, int visiblevolumes)
                                GL_ColorMask(1,1,1,1);
                                memset(&m, 0, sizeof(m));
                                R_Mesh_State_Texture(&m);
+                               GL_ColorPointer(NULL);
                                GL_Color(0,0.1,0,1);
                                GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
                                for (mesh = rtlight->static_meshchain_shadow;mesh;mesh = mesh->next)
@@ -2125,6 +2133,7 @@ void R_DrawRTLight(rtlight_t *rtlight, int visiblevolumes)
                                        //qglDisable(GL_CULL_FACE);
                                        memset(&m, 0, sizeof(m));
                                        R_Mesh_State_Texture(&m);
+                                       GL_ColorPointer(NULL);
                                        GL_Color(0.2,0,0,1);
                                        GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
                                        for (mesh = rtlight->static_meshchain_light;mesh;mesh = mesh->next)
@@ -2183,6 +2192,7 @@ void R_ShadowVolumeLighting(int visiblevolumes)
                GL_DepthMask(false);
                GL_DepthTest(r_shadow_visiblevolumes.integer < 2);
                qglDisable(GL_CULL_FACE);
+               GL_ColorPointer(NULL);
                GL_Color(0.0, 0.0125, 0.1, 1);
        }
        else
diff --git a/r_sky.c b/r_sky.c
index a1e41df..0fe747a 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -231,6 +231,7 @@ static void R_SkyBox(void)
 {
        int i;
        rmeshstate_t m;
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        memset(&m, 0, sizeof(m));
        GL_BlendFunc(GL_ONE, GL_ZERO);
@@ -327,6 +328,7 @@ static void R_SkySphere(void)
        Matrix4x4_CreateIdentity(&identitymatrix);
 
        GL_VertexPointer(skysphere_vertex3f);
+       GL_ColorPointer(NULL);
        GL_Color(1, 1, 1, 1);
        GL_BlendFunc(GL_ONE, GL_ZERO);
        GL_DepthMask(true);