]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
gl backend now has functions for color array and flat color states (GL_UseColorArray...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Sep 2002 06:53:30 +0000 (06:53 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 30 Sep 2002 06:53:30 +0000 (06:53 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2482 d7cf8633-e32d-0410-b094-e92efae38249

16 files changed:
cl_particles.c
gl_backend.c
gl_backend.h
gl_draw.c
gl_models.c
gl_rmain.c
gl_rsurf.c
glquake.h
r_crosshairs.c
r_explosion.c
r_light.c
r_shadow.c
r_shadow.h
r_sky.c
r_sprites.c
vid_shared.c

index 30a799c0dd53802a9e24b0d0588a9008b01f542e..9995ccd8cecdb27994b769327c550b28485247f7 100644 (file)
@@ -1500,10 +1500,6 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2)
        cg *= r_colorscale;
        cb *= r_colorscale;
 
-       varray_color[ 0] = varray_color[ 4] = varray_color[ 8] = varray_color[12] = cr;
-       varray_color[ 1] = varray_color[ 5] = varray_color[ 9] = varray_color[13] = cg;
-       varray_color[ 2] = varray_color[ 6] = varray_color[10] = varray_color[14] = cb;
-       varray_color[ 3] = varray_color[ 7] = varray_color[11] = varray_color[15] = ca;
        varray_texcoord[0][0] = tex->s2;varray_texcoord[0][1] = tex->t1;
        varray_texcoord[0][2] = tex->s1;varray_texcoord[0][3] = tex->t1;
        varray_texcoord[0][4] = tex->s1;varray_texcoord[0][5] = tex->t2;
@@ -1569,6 +1565,7 @@ void R_DrawParticleCallback(const void *calldata1, int calldata2)
        glTexCoord2f(tex->s2, tex->t2);glVertex3f(varray_vertex[12], varray_vertex[13], varray_vertex[14]);
        glEnd();
 #else
+       GL_Color(cr, cg, cb, ca);
        R_Mesh_Draw(4, 2, polygonelements);
 #endif
 }
index d9521d4b09bf27ccfc810ae7944c2881da12d6f5..160881413e71506bc8b9d555c492ba643eb2e08a 100644 (file)
@@ -264,6 +264,7 @@ static struct
        int clientunit;
        int texture[MAX_TEXTUREUNITS];
        float texturergbscale[MAX_TEXTUREUNITS];
+       int colorarray;
 }
 gl_state;
 
@@ -344,7 +345,6 @@ void GL_SetupTextureState(void)
        }
 }
 
-int usedarrays;
 void GL_Backend_ResetState(void)
 {
        int i;
@@ -373,8 +373,6 @@ void GL_Backend_ResetState(void)
        gl_state.depthmask = GL_TRUE;
        qglDepthMask(gl_state.depthmask);CHECKGLERROR
 
-       usedarrays = false;
-       usedarrays = true;
        qglVertexPointer(3, GL_FLOAT, sizeof(float[4]), varray_vertex);CHECKGLERROR
        qglEnableClientState(GL_VERTEX_ARRAY);CHECKGLERROR
        if (gl_mesh_floatcolors.integer)
@@ -385,11 +383,32 @@ void GL_Backend_ResetState(void)
        {
                qglColorPointer(4, GL_UNSIGNED_BYTE, sizeof(qbyte[4]), varray_bcolor);CHECKGLERROR
        }
-       qglEnableClientState(GL_COLOR_ARRAY);CHECKGLERROR
+       // LordHavoc: default to color array off
+       gl_state.colorarray = false;
+       GL_Color(1, 1, 1, 1);
 
        GL_SetupTextureState();
 }
 
+void GL_UseColorArray(void)
+{
+       if (!gl_state.colorarray)
+       {
+               gl_state.colorarray = true;
+               qglEnableClientState(GL_COLOR_ARRAY);CHECKGLERROR
+       }
+}
+
+void GL_Color(float cr, float cg, float cb, float ca)
+{
+       if (gl_state.colorarray)
+       {
+               gl_state.colorarray = false;
+               qglDisableClientState(GL_COLOR_ARRAY);CHECKGLERROR
+       }
+       qglColor4f(cr, cg, cb, ca);
+}
+
 // called at beginning of frame
 void R_Mesh_Start(void)
 {
@@ -511,7 +530,7 @@ void R_Mesh_Draw(int numverts, int numtriangles, int *elements)
 
        CHECKGLERROR
 
-       if (!gl_mesh_floatcolors.integer)
+       if (gl_state.colorarray && !gl_mesh_floatcolors.integer)
                GL_ConvertColorsFloatToByte(numverts);
        //GL_TransformVertices(numverts);
        if (!r_render.integer)
@@ -545,27 +564,18 @@ void R_Mesh_Finish(void)
                        }
                        qglBindTexture(GL_TEXTURE_2D, 0);CHECKGLERROR
 
-                       if (usedarrays)
-                       {
-                               qglClientActiveTexture(GL_TEXTURE0_ARB + i);CHECKGLERROR
-                               qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
-                       }
+                       qglClientActiveTexture(GL_TEXTURE0_ARB + i);CHECKGLERROR
+                       qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
                }
        }
        else
        {
                qglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);CHECKGLERROR
                qglEnable(GL_TEXTURE_2D);CHECKGLERROR
-               if (usedarrays)
-               {
-                       qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
-               }
-       }
-       if (usedarrays)
-       {
-               qglDisableClientState(GL_COLOR_ARRAY);CHECKGLERROR
-               qglDisableClientState(GL_VERTEX_ARRAY);CHECKGLERROR
+               qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
        }
+       qglDisableClientState(GL_COLOR_ARRAY);CHECKGLERROR
+       qglDisableClientState(GL_VERTEX_ARRAY);CHECKGLERROR
 
        qglDisable(GL_BLEND);CHECKGLERROR
        qglEnable(GL_DEPTH_TEST);CHECKGLERROR
index 624df46a1c0510996f334c527949f1abb98a1e0e..cd4b85cb454d0bb5db33ef2d5a2389ef72d13f7e 100644 (file)
@@ -14,6 +14,8 @@ void GL_SetupView_Orientation_Identity (void);
 void GL_SetupView_Orientation_FromEntity (vec3_t origin, vec3_t angles);
 void GL_SetupView_Mode_Perspective (double aspect, double fovx, double fovy, double zNear, double zFar);
 void GL_SetupView_Mode_Ortho (double x1, double y1, double x2, double y2, double zNear, double zFar);
+void GL_UseColorArray(void);
+void GL_Color(float cr, float cg, float cb, float ca);
 void GL_DepthFunc(int value);
 void GL_ClearDepth(void);
 
index 9b3dbec8a27b8ef7554c02642eb7cff5e22e1389..598d9026ca22c068addb1d97eb8a0bee7e2f8bd3 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -459,10 +459,6 @@ void R_DrawQueue(void)
                                if (h == 0)
                                        h = pic->height;
                        }
-                       varray_color[0] = varray_color[4] = varray_color[ 8] = varray_color[12] = cr;
-                       varray_color[1] = varray_color[5] = varray_color[ 9] = varray_color[13] = cg;
-                       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = cb;
-                       varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = ca;
                        varray_texcoord[0][0] = 0;varray_texcoord[0][1] = 0;
                        varray_texcoord[0][2] = 1;varray_texcoord[0][3] = 0;
                        varray_texcoord[0][4] = 1;varray_texcoord[0][5] = 1;
@@ -471,6 +467,7 @@ void R_DrawQueue(void)
                        varray_vertex[ 4] = x+w;varray_vertex[ 5] = y  ;varray_vertex[ 6] = 10;
                        varray_vertex[ 8] = x+w;varray_vertex[ 9] = y+h;varray_vertex[10] = 10;
                        varray_vertex[12] = x  ;varray_vertex[13] = y+h;varray_vertex[14] = 10;
+                       GL_Color(cr, cg, cb, ca);
                        R_Mesh_Draw(4, 2, quadelements);
                        break;
                case DRAWQUEUE_STRING:
@@ -482,9 +479,9 @@ void R_DrawQueue(void)
                                R_Mesh_TextureState(&m);
                        }
                        batchcount = 0;
-                       ac = varray_color;
                        at = varray_texcoord[0];
                        av = varray_vertex;
+                       GL_Color(cr, cg, cb, ca);
                        while ((num = *str++) && x < vid.conwidth)
                        {
                                if (num != ' ')
@@ -493,10 +490,6 @@ void R_DrawQueue(void)
                                        t = (num >> 4)*0.0625f + (0.5f / 256.0f);
                                        u = 0.0625f - (1.0f / 256.0f);
                                        v = 0.0625f - (1.0f / 256.0f);
-                                       ac[0] = ac[4] = ac[ 8] = ac[12] = cr;
-                                       ac[1] = ac[5] = ac[ 9] = ac[13] = cg;
-                                       ac[2] = ac[6] = ac[10] = ac[14] = cb;
-                                       ac[3] = ac[7] = ac[11] = ac[15] = ca;
                                        at[0] = s  ;at[1] = t  ;
                                        at[2] = s+u;at[3] = t  ;
                                        at[4] = s+u;at[5] = t+v;
@@ -513,7 +506,6 @@ void R_DrawQueue(void)
                                        {
                                                R_Mesh_Draw(batchcount * 4, batchcount * 2, quadelements);
                                                batchcount = 0;
-                                               ac = varray_color;
                                                at = varray_texcoord[0];
                                                av = varray_vertex;
                                        }
@@ -531,6 +523,7 @@ void R_DrawQueue(void)
                        memcpy(varray_vertex, mesh->vertices, sizeof(float[4]) * mesh->numvertices);
                        memcpy(varray_texcoord[0], mesh->texcoords, sizeof(float[2]) * mesh->numvertices);
                        memcpy(varray_color, mesh->colors, sizeof(float[4]) * mesh->numvertices);
+                       GL_UseColorArray();
                        R_Mesh_Draw(mesh->numvertices, mesh->numtriangles, mesh->indices);
                        currentpic = "\0";
                        break;
@@ -546,8 +539,6 @@ void R_DrawQueue(void)
                varray_vertex[0] = -5000;varray_vertex[1] = -5000;varray_vertex[2] = 10;
                varray_vertex[4] = 10000;varray_vertex[5] = -5000;varray_vertex[6] = 10;
                varray_vertex[8] = -5000;varray_vertex[9] = 10000;varray_vertex[10] = 10;
-               // alpha is 1 for all these
-               varray_color[3] = varray_color[7] = varray_color[11] = 1;
                // all the blends ignore depth
                memset(&m, 0, sizeof(m));
                m.depthdisable = true;
@@ -562,9 +553,7 @@ void R_DrawQueue(void)
                                cr = t - 1.0f;
                                if (cr > 1.0f)
                                        cr = 1.0f;
-                               varray_color[0] = varray_color[4] = varray_color[ 8] = cr;
-                               varray_color[1] = varray_color[5] = varray_color[ 9] = cr;
-                               varray_color[2] = varray_color[6] = varray_color[10] = cr;
+                               GL_Color(cr, cr, cr, 1);
                                R_Mesh_Draw(3, 1, polygonelements);
                                t *= 0.5;
                        }
@@ -574,9 +563,7 @@ void R_DrawQueue(void)
                        m.blendfunc1 = GL_ZERO;
                        m.blendfunc2 = GL_SRC_COLOR;
                        R_Mesh_State(&m);
-                       varray_color[0] = varray_color[4] = varray_color[ 8] = varray_color[12] = t;
-                       varray_color[1] = varray_color[5] = varray_color[ 9] = varray_color[13] = t;
-                       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = t;
+                       GL_Color(t, t, t, 1);
                        R_Mesh_Draw(3, 1, polygonelements);
                }
                if (v_brightness.value >= 0.01f)
@@ -584,9 +571,7 @@ void R_DrawQueue(void)
                        m.blendfunc1 = GL_ONE;
                        m.blendfunc2 = GL_ONE;
                        R_Mesh_State(&m);
-                       varray_color[0] = varray_color[4] = varray_color[ 8] = varray_color[12] = v_brightness.value;
-                       varray_color[1] = varray_color[5] = varray_color[ 9] = varray_color[13] = v_brightness.value;
-                       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = v_brightness.value;
+                       GL_Color(v_brightness.value, v_brightness.value, v_brightness.value, 1);
                        R_Mesh_Draw(3, 1, polygonelements);
                }
        }
index 17310919d8cda8bd8f6298a17aa6cc32202cf138..c56ee35a333336f69756958f5c8e8ab226b058b6 100644 (file)
@@ -292,7 +292,7 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
        colorscale = r_colorscale;
        if (gl_combine.integer)
                colorscale *= 0.25f;
-       
+
        if (!skinframe->base && !skinframe->pants && !skinframe->shirt && !skinframe->glow)
        {
                // untextured
@@ -313,6 +313,7 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                R_LightModel(ent, model->numverts, colorscale, colorscale, colorscale, false);
                aliasvert = aliasvertbuf;
                aliasvertcolor = aliasvertcolorbuf;
+               GL_UseColorArray();
                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
                return;
        }
@@ -338,6 +339,7 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                R_LightModel(ent, model->numverts, colorscale, colorscale, colorscale, false);
                aliasvert = aliasvertbuf;
                aliasvertcolor = aliasvertcolorbuf;
+               GL_UseColorArray();
                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
                return;
        }
@@ -380,6 +382,7 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                R_ModulateColors(aliasvertcolor, varray_color, model->numverts, colorscale, colorscale, colorscale);
                memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
+               GL_UseColorArray();
                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
        }
 
@@ -402,9 +405,12 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                                blendfunc2 = GL_ONE;
                                c_alias_polys += model->numtris;
                                if (pantsfullbright)
-                                       R_FillColors(varray_color, model->numverts, pantscolor[0] * colorscale, pantscolor[1] * colorscale, pantscolor[2] * colorscale, ent->alpha);
+                                       GL_Color(pantscolor[0] * colorscale, pantscolor[1] * colorscale, pantscolor[2] * colorscale, ent->alpha);
                                else
+                               {
+                                       GL_UseColorArray();
                                        R_ModulateColors(aliasvertcolor, varray_color, model->numverts, pantscolor[0] * colorscale, pantscolor[1] * colorscale, pantscolor[2] * colorscale);
+                               }
                                memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                                memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
                                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
@@ -427,9 +433,12 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                                blendfunc2 = GL_ONE;
                                c_alias_polys += model->numtris;
                                if (shirtfullbright)
-                                       R_FillColors(varray_color, model->numverts, shirtcolor[0] * colorscale, shirtcolor[1] * colorscale, shirtcolor[2] * colorscale, ent->alpha);
+                                       GL_Color(shirtcolor[0] * colorscale, shirtcolor[1] * colorscale, shirtcolor[2] * colorscale, ent->alpha);
                                else
+                               {
+                                       GL_UseColorArray();
                                        R_ModulateColors(aliasvertcolor, varray_color, model->numverts, shirtcolor[0] * colorscale, shirtcolor[1] * colorscale, shirtcolor[2] * colorscale);
+                               }
                                memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                                memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
                                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
@@ -450,9 +459,9 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                        blendfunc1 = GL_SRC_ALPHA;
                        blendfunc2 = GL_ONE;
                        c_alias_polys += model->numtris;
-                       R_FillColors(varray_color, model->numverts, (1 - fog) * r_colorscale, (1 - fog) * r_colorscale, (1 - fog) * r_colorscale, ent->alpha);
                        memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                        memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
+                       GL_Color((1 - fog) * r_colorscale, (1 - fog) * r_colorscale, (1 - fog) * r_colorscale, ent->alpha);
                        R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
                }
        }
@@ -465,9 +474,9 @@ void R_DrawQ1Q2AliasModelCallback (const void *calldata1, int calldata2)
                R_Mesh_State(&m);
 
                c_alias_polys += model->numtris;
-               R_FillColors(varray_color, model->numverts, fogcolor[0] * fog * r_colorscale, fogcolor[1] * fog * r_colorscale, fogcolor[2] * fog * r_colorscale, ent->alpha);
                memcpy(varray_vertex, aliasvert, model->numverts * sizeof(float[4]));
                memcpy(varray_texcoord[0], model->mdlmd2data_texcoords, model->numverts * sizeof(float[2]));
+               GL_Color(fogcolor[0] * fog * r_colorscale, fogcolor[1] * fog * r_colorscale, fogcolor[2] * fog * r_colorscale, ent->alpha);
                R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
        }
 }
@@ -500,12 +509,13 @@ void R_DrawQ1Q2AliasModelFakeShadow (entity_render_t *ent)
                                        R_Mesh_State(&m);
                                        R_Mesh_Matrix(&ent->matrix);
                                        R_LerpMDLMD2Vertices(ent, varray_vertex, aliasvertnorm);
-                                       R_FillColors(varray_color, model->numverts * 2, 0.1 * r_colorscale, 0.025 * r_colorscale, 0.0125 * r_colorscale, 1);
+                                       GL_Color(0.1 * r_colorscale, 0.025 * r_colorscale, 0.0125 * r_colorscale, 1);
                                        Matrix4x4_Transform(&ent->inversematrix, r_dlight[i].origin, temp);
-                                       R_ShadowVolume(model->numverts, model->numtris, model->mdlmd2data_indices, model->mdlmd2data_triangleneighbors, temp, r_dlight[i].cullradius + model->radius - sqrt(f));
+                                       R_ShadowVolume(model->numverts, model->numtris, model->mdlmd2data_indices, model->mdlmd2data_triangleneighbors, temp, r_dlight[i].cullradius + model->radius - sqrt(f), true);
                                }
                        }
                }
+               return;
        }
 
        lightdirection[0] = 0.5;
@@ -529,7 +539,6 @@ void R_DrawQ1Q2AliasModelFakeShadow (entity_render_t *ent)
 
        c_alias_polys += model->numtris;
        R_LerpMDLMD2Vertices(ent, varray_vertex, aliasvertnorm);
-       R_FillColors(varray_color, model->numverts, 0, 0, 0, 0.5);
 
        // put a light direction in the entity's coordinate space
        Matrix4x4_Transform3x3(&ent->inversematrix, lightdirection, projection);
@@ -552,6 +561,7 @@ void R_DrawQ1Q2AliasModelFakeShadow (entity_render_t *ent)
                //if (i & 1)
                        VectorMA(v, dist, projection, v);
        }
+       GL_Color(0, 0, 0, 0.5);
        R_Mesh_Draw(model->numverts, model->numtris, model->mdlmd2data_indices);
 }
 
@@ -908,6 +918,7 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
        memcpy(varray_vertex, aliasvert, numverts * sizeof(float[4]));
        R_ModulateColors(aliasvertcolor, varray_color, numverts, colorscale, colorscale, colorscale);
        memcpy(varray_texcoord[0], (float *)(m->lump_texcoords.start + (int) m), numverts * sizeof(float[2]));
+       GL_UseColorArray();
        R_Mesh_Draw(numverts, numtriangles, elements);
 
        if (fog)
@@ -921,8 +932,8 @@ void R_DrawZymoticModelMeshCallback (const void *calldata1, int calldata2)
 
                c_alias_polys += numtriangles;
                memcpy(varray_vertex, aliasvert, numverts * sizeof(float[4]));
-               R_FillColors(varray_color, numverts, fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, ent->alpha * fog);
                //memcpy(mesh_texcoord[0], (float *)(m->lump_texcoords.start + (int) m), numverts * sizeof(float[2]));
+               GL_Color(fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, ent->alpha * fog);
                R_Mesh_Draw(numverts, numtriangles, elements);
        }
 }
index 1b10e6cd5517992d94c1dc449efb27258d1fcf30..dc4bd184a547fffa3f28c2f26f66a039244a390c 100644 (file)
@@ -626,10 +626,6 @@ static void R_BlendView(void)
        R_Mesh_Matrix(&r_identitymatrix);
        R_Mesh_State(&m);
 
-       varray_color[0] = varray_color[4] = varray_color[8] = r_refdef.viewblend[0];
-       varray_color[1] = varray_color[5] = varray_color[9] = r_refdef.viewblend[1];
-       varray_color[2] = varray_color[6] = varray_color[10] = r_refdef.viewblend[2];
-       varray_color[3] = varray_color[7] = varray_color[11] = r_refdef.viewblend[3];
        r = 64000;
        varray_vertex[0] = r_origin[0] + vpn[0] * 1.5 - vright[0] * r - vup[0] * r;
        varray_vertex[1] = r_origin[1] + vpn[1] * 1.5 - vright[1] * r - vup[1] * r;
@@ -641,6 +637,7 @@ static void R_BlendView(void)
        varray_vertex[8] = varray_vertex[0] + vright[0] * r;
        varray_vertex[9] = varray_vertex[1] + vright[1] * r;
        varray_vertex[10] = varray_vertex[2] + vright[2] * r;
+       GL_Color(r_refdef.viewblend[0], r_refdef.viewblend[1], r_refdef.viewblend[2], r_refdef.viewblend[3]);
        R_Mesh_Draw(3, 1, polygonelements);
 }
 
@@ -747,10 +744,7 @@ void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, floa
        varray_vertex[20] = maxs[0];varray_vertex[21] = mins[1];varray_vertex[22] = maxs[2];
        varray_vertex[24] = mins[0];varray_vertex[25] = maxs[1];varray_vertex[26] = maxs[2];
        varray_vertex[28] = maxs[0];varray_vertex[29] = maxs[1];varray_vertex[30] = maxs[2];
-       varray_color[ 0] = varray_color[ 4] = varray_color[ 8] = varray_color[12] = varray_color[16] = varray_color[20] = varray_color[24] = varray_color[28] = cr * r_colorscale;
-       varray_color[ 1] = varray_color[ 5] = varray_color[ 9] = varray_color[13] = varray_color[17] = varray_color[21] = varray_color[25] = varray_color[29] = cg * r_colorscale;
-       varray_color[ 2] = varray_color[ 6] = varray_color[10] = varray_color[14] = varray_color[18] = varray_color[22] = varray_color[26] = varray_color[30] = cb * r_colorscale;
-       varray_color[ 3] = varray_color[ 7] = varray_color[11] = varray_color[15] = varray_color[19] = varray_color[23] = varray_color[27] = varray_color[31] = ca;
+       R_FillColors(varray_color, 8, cr * r_colorscale, cg * r_colorscale, cb * r_colorscale, ca);
        if (fogenabled)
        {
                for (i = 0, v = varray_vertex, c = varray_color;i < 8;i++, v += 4, c += 4)
@@ -764,6 +758,7 @@ void R_DrawBBoxMesh(vec3_t mins, vec3_t maxs, float cr, float cg, float cb, floa
                        c[2] = c[2] * f1 + fogcolor[2] * f2;
                }
        }
+       GL_UseColorArray();
        R_Mesh_Draw(8, 12);
 }
 */
@@ -807,12 +802,12 @@ void R_DrawNoModelCallback(const void *calldata1, int calldata2)
        varray_vertex[12] =   0;varray_vertex[13] =  16;varray_vertex[14] =   0;
        varray_vertex[16] =   0;varray_vertex[17] =   0;varray_vertex[18] = -16;
        varray_vertex[20] =   0;varray_vertex[21] =   0;varray_vertex[22] =  16;
-       varray_color[ 0] = 0.00f;varray_color[ 1] = 0.00f;varray_color[ 2] = 0.50f;varray_color[ 3] = ent->alpha;
-       varray_color[ 4] = 0.00f;varray_color[ 5] = 0.00f;varray_color[ 6] = 0.50f;varray_color[ 7] = ent->alpha;
-       varray_color[ 8] = 0.00f;varray_color[ 9] = 0.50f;varray_color[10] = 0.00f;varray_color[11] = ent->alpha;
-       varray_color[12] = 0.00f;varray_color[13] = 0.50f;varray_color[14] = 0.00f;varray_color[15] = ent->alpha;
-       varray_color[16] = 0.50f;varray_color[17] = 0.00f;varray_color[18] = 0.00f;varray_color[19] = ent->alpha;
-       varray_color[20] = 0.50f;varray_color[21] = 0.00f;varray_color[22] = 0.00f;varray_color[23] = ent->alpha;
+       varray_color[ 0] = 0.00f * r_colorscale;varray_color[ 1] = 0.00f * r_colorscale;varray_color[ 2] = 0.50f * r_colorscale;varray_color[ 3] = ent->alpha;
+       varray_color[ 4] = 0.00f * r_colorscale;varray_color[ 5] = 0.00f * r_colorscale;varray_color[ 6] = 0.50f * r_colorscale;varray_color[ 7] = ent->alpha;
+       varray_color[ 8] = 0.00f * r_colorscale;varray_color[ 9] = 0.50f * r_colorscale;varray_color[10] = 0.00f * r_colorscale;varray_color[11] = ent->alpha;
+       varray_color[12] = 0.00f * r_colorscale;varray_color[13] = 0.50f * r_colorscale;varray_color[14] = 0.00f * r_colorscale;varray_color[15] = ent->alpha;
+       varray_color[16] = 0.50f * r_colorscale;varray_color[17] = 0.00f * r_colorscale;varray_color[18] = 0.00f * r_colorscale;varray_color[19] = ent->alpha;
+       varray_color[20] = 0.50f * r_colorscale;varray_color[21] = 0.00f * r_colorscale;varray_color[22] = 0.00f * r_colorscale;varray_color[23] = ent->alpha;
        if (fogenabled)
        {
                VectorSubtract(ent->origin, r_origin, diff);
@@ -834,6 +829,7 @@ void R_DrawNoModelCallback(const void *calldata1, int calldata2)
                        c[2] *= r_colorscale;
                }
        }
+       GL_UseColorArray();
        R_Mesh_Draw(6, 8, element);
 }
 
index b827c2edb8795f31042d09ad73962a4f4073b30d..314429c0f92a7dd49c9897baf9e6064b1c293852 100644 (file)
@@ -791,10 +791,7 @@ static void RSurfShader_Sky(const entity_render_t *ent, const texture_t *texture
                {
                        R_Mesh_ResizeCheck(mesh->numverts);
                        memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
-                       if (skyrendermasked)
-                               memset(varray_color, 0, mesh->numverts * sizeof(float[4]));
-                       else
-                               R_FillColors(varray_color, mesh->numverts, fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, 1);
+                       GL_Color(fogcolor[0] * r_colorscale, fogcolor[1] * r_colorscale, fogcolor[2] * r_colorscale, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -837,6 +834,7 @@ static void RSurfShader_Water_Callback(const void *calldata1, int calldata2)
                colorscale *= 0.25f;
        }
        R_Mesh_State(&m);
+       GL_UseColorArray();
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
        {
                R_Mesh_ResizeCheck(mesh->numverts);
@@ -923,6 +921,7 @@ static void RSurfShader_Wall_Pass_BaseVertex(const entity_render_t *ent, const m
        }
        base = ent->effects & EF_FULLBRIGHT ? 2.0f : r_ambient.value * (1.0f / 64.0f);
        R_Mesh_State(&m);
+       GL_UseColorArray();
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
        {
                R_Mesh_ResizeCheck(mesh->numverts);
@@ -965,6 +964,7 @@ static void RSurfShader_Wall_Pass_BaseFullbright(const entity_render_t *ent, con
        }
        m.tex[0] = R_GetTexture(surf->currenttexture->texture);
        R_Mesh_State(&m);
+       GL_UseColorArray();
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
        {
                R_Mesh_ResizeCheck(mesh->numverts);
@@ -986,6 +986,7 @@ static void RSurfShader_Wall_Pass_Glow(const entity_render_t *ent, const msurfac
        m.blendfunc2 = GL_ONE;
        m.tex[0] = R_GetTexture(surf->currenttexture->glowtexture);
        R_Mesh_State(&m);
+       GL_UseColorArray();
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
        {
                R_Mesh_ResizeCheck(mesh->numverts);
@@ -1007,6 +1008,7 @@ static void RSurfShader_Wall_Pass_Fog(const entity_render_t *ent, const msurface
        m.blendfunc2 = GL_ONE;
        m.tex[0] = R_GetTexture(surf->currenttexture->fogtexture);
        R_Mesh_State(&m);
+       GL_UseColorArray();
        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
        {
                R_Mesh_ResizeCheck(mesh->numverts);
@@ -1035,6 +1037,8 @@ static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render
        m.texrgbscale[1] = 4;
        m.texrgbscale[2] = 2;
        R_Mesh_State(&m);
+       cl = (float) (1 << r_lightmapscalebit) * r_colorscale;
+       GL_Color(cl, cl, cl, 1);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
                lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
@@ -1050,8 +1054,6 @@ static void RSurfShader_OpaqueWall_Pass_BaseTripleTexCombine(const entity_render
                        memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
                        memcpy(varray_texcoord[1], mesh->uv, mesh->numverts * sizeof(float[2]));
                        memcpy(varray_texcoord[2], mesh->ab, mesh->numverts * sizeof(float[2]));
-                       cl = (float) (1 << r_lightmapscalebit) * r_colorscale;
-                       R_FillColors(varray_color, mesh->numverts, cl, cl, cl, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -1071,6 +1073,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseDoubleTex(const entity_render_t *ent
        if (gl_combine.integer)
                m.texrgbscale[1] = 4;
        R_Mesh_State(&m);
+       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
                lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
@@ -1085,7 +1088,6 @@ static void RSurfShader_OpaqueWall_Pass_BaseDoubleTex(const entity_render_t *ent
                        memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
                        memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
                        memcpy(varray_texcoord[1], mesh->uv, mesh->numverts * sizeof(float[2]));
-                       R_FillColors(varray_color, mesh->numverts, r_colorscale, r_colorscale, r_colorscale, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -1101,6 +1103,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseTexture(const entity_render_t *ent,
        m.blendfunc2 = GL_ZERO;
        m.tex[0] = R_GetTexture(texture->texture);
        R_Mesh_State(&m);
+       GL_Color(1, 1, 1, 1);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
                for (mesh = surf->mesh;mesh;mesh = mesh->chain)
@@ -1108,7 +1111,6 @@ static void RSurfShader_OpaqueWall_Pass_BaseTexture(const entity_render_t *ent,
                        R_Mesh_ResizeCheck(mesh->numverts);
                        memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
                        memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
-                       R_FillColors(varray_color, mesh->numverts, 1, 1, 1, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -1127,6 +1129,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseLightmap(const entity_render_t *ent,
        if (gl_combine.integer)
                m.texrgbscale[0] = 4;
        R_Mesh_State(&m);
+       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
                lightmaptexturenum = R_GetTexture(surf->lightmaptexture);
@@ -1140,7 +1143,6 @@ static void RSurfShader_OpaqueWall_Pass_BaseLightmap(const entity_render_t *ent,
                        R_Mesh_ResizeCheck(mesh->numverts);
                        memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
                        memcpy(varray_texcoord[0], mesh->uv, mesh->numverts * sizeof(float[2]));
-                       R_FillColors(varray_color, mesh->numverts, r_colorscale, r_colorscale, r_colorscale, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -1164,6 +1166,7 @@ static void RSurfShader_OpaqueWall_Pass_Light(const entity_render_t *ent, const
                colorscale *= 0.25f;
        }
        R_Mesh_State(&m);
+       GL_UseColorArray();
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
                if (surf->dlightframe == r_framecount)
@@ -1196,6 +1199,7 @@ static void RSurfShader_OpaqueWall_Pass_Fog(const entity_render_t *ent, const te
        m.blendfunc1 = GL_SRC_ALPHA;
        m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
        R_Mesh_State(&m);
+       GL_UseColorArray();
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
                for (mesh = surf->mesh;mesh;mesh = mesh->chain)
@@ -1220,6 +1224,7 @@ static void RSurfShader_OpaqueWall_Pass_BaseDetail(const entity_render_t *ent, c
        m.blendfunc2 = GL_SRC_COLOR;
        m.tex[0] = R_GetTexture(texture->detailtexture);
        R_Mesh_State(&m);
+       GL_Color(1, 1, 1, 1);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
                for (mesh = surf->mesh;mesh;mesh = mesh->chain)
@@ -1227,7 +1232,6 @@ static void RSurfShader_OpaqueWall_Pass_BaseDetail(const entity_render_t *ent, c
                        R_Mesh_ResizeCheck(mesh->numverts);
                        memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
                        memcpy(varray_texcoord[0], mesh->ab, mesh->numverts * sizeof(float[2]));
-                       R_FillColors(varray_color, mesh->numverts, 1, 1, 1, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -1243,6 +1247,7 @@ static void RSurfShader_OpaqueWall_Pass_Glow(const entity_render_t *ent, const t
        m.blendfunc2 = GL_ONE;
        m.tex[0] = R_GetTexture(texture->glowtexture);
        R_Mesh_State(&m);
+       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
        for (surf = texture->surfacechain;surf;surf = surf->texturechain)
        {
                for (mesh = surf->mesh;mesh;mesh = mesh->chain)
@@ -1250,7 +1255,6 @@ static void RSurfShader_OpaqueWall_Pass_Glow(const entity_render_t *ent, const t
                        R_Mesh_ResizeCheck(mesh->numverts);
                        memcpy(varray_vertex, mesh->verts, mesh->numverts * sizeof(float[4]));
                        memcpy(varray_texcoord[0], mesh->st, mesh->numverts * sizeof(float[2]));
-                       R_FillColors(varray_color, mesh->numverts, r_colorscale, r_colorscale, r_colorscale, 1);
                        R_Mesh_Draw(mesh->numverts, mesh->numtriangles, mesh->index);
                }
        }
@@ -1484,11 +1488,10 @@ static void R_DrawPortal_Callback(const void *calldata1, int calldata2)
        R_Mesh_State(&m);
        R_Mesh_ResizeCheck(portal->numpoints);
        i = portal - ent->model->portals;
-       R_FillColors(varray_color, portal->numpoints,
-               ((i & 0x0007) >> 0) * (1.0f / 7.0f) * r_colorscale,
-               ((i & 0x0038) >> 3) * (1.0f / 7.0f) * r_colorscale,
-               ((i & 0x01C0) >> 6) * (1.0f / 7.0f) * r_colorscale,
-               0.125f);
+       GL_Color(((i & 0x0007) >> 0) * (1.0f / 7.0f) * r_colorscale,
+                        ((i & 0x0038) >> 3) * (1.0f / 7.0f) * r_colorscale,
+                        ((i & 0x01C0) >> 6) * (1.0f / 7.0f) * r_colorscale,
+                        0.125f);
        if (PlaneDiff(r_origin, (&portal->plane)) > 0)
        {
                for (i = portal->numpoints - 1, v = varray_vertex;i >= 0;i--, v += 4)
index 120da2c9d59153cae079f5a0ccc7173f82042596..18e75d9e471c7fb4f3cebdddd109c5ffcd7ef4fd 100644 (file)
--- a/glquake.h
+++ b/glquake.h
@@ -321,7 +321,7 @@ extern void (GLAPIENTRY *qglColorPointer)(GLint size, GLenum type, GLsizei strid
 extern void (GLAPIENTRY *qglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
 extern void (GLAPIENTRY *qglArrayElement)(GLint i);
 
-extern void (GLAPIENTRY *qglColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+extern void (GLAPIENTRY *qglColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
 extern void (GLAPIENTRY *qglTexCoord2f)(GLfloat s, GLfloat t);
 extern void (GLAPIENTRY *qglVertex2f)(GLfloat x, GLfloat y);
 extern void (GLAPIENTRY *qglVertex3f)(GLfloat x, GLfloat y, GLfloat z);
index ccd49feea8506f487e749ec37eeb1ffbccbfaad9..2de8d9b9f112849f4d392ed22ee8013f9007d36e 100644 (file)
@@ -41,10 +41,7 @@ void R_DrawCrosshairSprite(rtexture_t *texture, vec3_t origin, vec_t scale, floa
        R_Mesh_Matrix(&r_identitymatrix);
        R_Mesh_State(&m);
 
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = cr * r_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = cg * r_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = cb * r_colorscale;
-       varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = ca;
+       GL_Color(cr * r_colorscale, cg * r_colorscale, cb * r_colorscale, ca);
        varray_texcoord[0][0] = 0;
        varray_texcoord[0][1] = 0;
        varray_texcoord[0][2] = 0;
index 50c3d66f38e04b2d508d6d91e04ca9f915e2e0aa..6dac84caf655f9faacf6478edaca0000044d37af 100644 (file)
@@ -241,6 +241,7 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
                        c[3] = 1;
                }
        }
+       GL_UseColorArray();
        R_Mesh_Draw(numverts, numtriangles, explosiontris[0]);
 }
 
index f0660972cbad80fe6a1318e4608436ef8afed148..b06f3cb9657d8a908e023bed4f4b9fb161af7207 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -167,10 +167,7 @@ void R_DrawCoronas(void)
                                VectorSubtract(rd->origin, r_origin, diff);
                                scale *= 1 - exp(fogdensity/DotProduct(diff,diff));
                        }
-                       varray_color[ 0] = varray_color[ 4] = varray_color[ 8] = varray_color[12] = rd->light[0] * scale;
-                       varray_color[ 1] = varray_color[ 5] = varray_color[ 9] = varray_color[13] = rd->light[1] * scale;
-                       varray_color[ 2] = varray_color[ 6] = varray_color[10] = varray_color[14] = rd->light[2] * scale;
-                       varray_color[ 3] = varray_color[ 7] = varray_color[11] = varray_color[15] = 1;
+                       GL_Color(rd->light[0] * scale, rd->light[1] * scale, rd->light[2] * scale, 1);
                        varray_texcoord[0][0] = 0;
                        varray_texcoord[0][1] = 0;
                        varray_texcoord[0][2] = 0;
index f18b15581733b6ed365777805bf91ebf00f93aa4..153867fd031ddf0504d0dadf41f60ef342f51532 100644 (file)
@@ -36,7 +36,7 @@ void R_Shadow_Init(void)
        R_RegisterModule("R_Shadow", r_shadow_start, r_shadow_shutdown, r_shadow_newmap);
 }
 
-void R_ShadowVolume(int numverts, int numtris, int *elements, int *neighbors, vec3_t relativelightorigin, float projectdistance)
+void R_ShadowVolume(int numverts, int numtris, int *elements, int *neighbors, vec3_t relativelightorigin, float projectdistance, int visiblevolume)
 {
        int i, *e, *n, *out, tris;
        float *v0, *v1, *v2, dir0[3], dir1[3], temp[3], f;
@@ -164,5 +164,24 @@ void R_ShadowVolume(int numverts, int numtris, int *elements, int *neighbors, ve
                }
        }
        // draw the volume
-       R_Mesh_Draw(numverts * 2, tris, shadowelements);
+       if (visiblevolume)
+       {
+               qglDisable(GL_CULL_FACE);
+               R_Mesh_Draw(numverts * 2, tris, shadowelements);
+               qglEnable(GL_CULL_FACE);
+       }
+       else
+       {
+               qglCullFace(GL_FRONT);
+               //qglStencilFunc(
+       }
+}
+
+void R_Shadow_BeginScene(void)
+{
+       rmeshstate_t m;
+       memset(&m, 0, sizeof(m));
+       m.blendfunc1 = GL_ONE;
+       m.blendfunc2 = GL_ZERO;
+       R_Mesh_State(&m);
 }
index 96586cb5015b83179d5567acdd6c54badfbe227b..42e80ba139caed1a14569fd0ea5b649c09cf1b4a 100644 (file)
@@ -3,6 +3,6 @@
 #define R_SHADOW_H
 
 void R_Shadow_Init(void);
-void R_ShadowVolume(int numverts, int numtris, int *elements, int *neighbors, vec3_t relativelightorigin, float projectdistance);
+void R_ShadowVolume(int numverts, int numtris, int *elements, int *neighbors, vec3_t relativelightorigin, float projectdistance, int visiblevolume);
 
 #endif
diff --git a/r_sky.c b/r_sky.c
index 25fa9fd5ea73a8e9b5b8fe2fad054bbd31f207c5..9b237f908a3c19a186480a197cd06e1646185cb9 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -132,10 +132,7 @@ static void R_SkyBox(void)
        m.tex[0] = R_GetTexture(skyboxside[3]); // front
        R_Mesh_State(&m);
 
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = r_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = r_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = r_colorscale;
-       varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = 1;
+       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
        
        R_SkyBoxPolyVec(0, 1, 0,  1, -1,  1);
        R_SkyBoxPolyVec(1, 1, 1,  1, -1, -1);
@@ -229,15 +226,11 @@ static void skyspherecalc(float *sphere, float dx, float dy, float dz)
        }
 }
 
-static void skyspherearrays(float *v, float *t, float *c, float *source, float s, float colorscale)
+static void skyspherearrays(float *v, float *t, float *source, float s)
 {
        int i;
-       for (i = 0;i < (skygridx1*skygridy1);i++, c += 4, t += 2, v += 4, source += 5)
+       for (i = 0;i < (skygridx1*skygridy1);i++, t += 2, v += 4, source += 5)
        {
-               c[0] = colorscale;
-               c[1] = colorscale;
-               c[2] = colorscale;
-               c[3] = 1;
                t[0] = source[0] + s;
                t[1] = source[1] + s;
                v[0] = source[2];
@@ -275,7 +268,9 @@ static void R_SkySphere(void)
        m.tex[0] = R_GetTexture(solidskytexture);
        R_Mesh_State(&m);
 
-       skyspherearrays(varray_vertex, varray_texcoord[0], varray_color, skysphere, speedscale, r_colorscale);
+       GL_Color(r_colorscale, r_colorscale, r_colorscale, 1);
+
+       skyspherearrays(varray_vertex, varray_texcoord[0], skysphere, speedscale);
        R_Mesh_Draw(numverts, numtriangles, skysphereindices);
 
        m.blendfunc1 = GL_SRC_ALPHA;
@@ -283,7 +278,7 @@ static void R_SkySphere(void)
        m.tex[0] = R_GetTexture(alphaskytexture);
        R_Mesh_State(&m);
 
-       skyspherearrays(varray_vertex, varray_texcoord[0], varray_color, skysphere, speedscale2, r_colorscale);
+       skyspherearrays(varray_vertex, varray_texcoord[0], skysphere, speedscale2);
        R_Mesh_Draw(numverts, numtriangles, skysphereindices);
 }
 
index a565400728053bd11311a9da11973237f67f9190..b979805850d96c78ce6b75cc622710a618bc4f81 100644 (file)
@@ -89,10 +89,6 @@ static void R_DrawSpriteImage (int additive, mspriteframe_t *frame, int texture,
        m.tex[0] = texture;
        R_Mesh_State(&m);
 
-       varray_color[0] = varray_color[4] = varray_color[8] = varray_color[12] = red * r_colorscale;
-       varray_color[1] = varray_color[5] = varray_color[9] = varray_color[13] = green * r_colorscale;
-       varray_color[2] = varray_color[6] = varray_color[10] = varray_color[14] = blue * r_colorscale;
-       varray_color[3] = varray_color[7] = varray_color[11] = varray_color[15] = alpha;
        varray_texcoord[0][0] = 0;
        varray_texcoord[0][1] = 1;
        varray_texcoord[0][2] = 0;
@@ -114,6 +110,7 @@ static void R_DrawSpriteImage (int additive, mspriteframe_t *frame, int texture,
        varray_vertex[12] = origin[0] + frame->down * up[0] - frame->right * left[0];
        varray_vertex[13] = origin[1] + frame->down * up[1] - frame->right * left[1];
        varray_vertex[14] = origin[2] + frame->down * up[2] - frame->right * left[2];
+       GL_Color(red * r_colorscale, green * r_colorscale, blue * r_colorscale, alpha);
        R_Mesh_Draw(4, 2, polygonelements);
 }
 
index 0806ce062db28d6ae2ff5f30a67ce9ed942d8f96..4ae9663a030b1385c818acb0807a83d4bd7da1bc 100644 (file)
@@ -107,7 +107,7 @@ void (GLAPIENTRY *qglColorPointer)(GLint size, GLenum type, GLsizei stride, cons
 void (GLAPIENTRY *qglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
 void (GLAPIENTRY *qglArrayElement)(GLint i);
 
-void (GLAPIENTRY *qglColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+void (GLAPIENTRY *qglColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
 void (GLAPIENTRY *qglTexCoord2f)(GLfloat s, GLfloat t);
 void (GLAPIENTRY *qglVertex2f)(GLfloat x, GLfloat y);
 void (GLAPIENTRY *qglVertex3f)(GLfloat x, GLfloat y, GLfloat z);
@@ -229,7 +229,7 @@ static gl_extensionfunctionlist_t opengl110funcs[] =
        {"glColorPointer", (void **) &qglColorPointer},
        {"glTexCoordPointer", (void **) &qglTexCoordPointer},
        {"glArrayElement", (void **) &qglArrayElement},
-       {"glColor4ub", (void **) &qglColor4ub},
+       {"glColor4f", (void **) &qglColor4f},
        {"glTexCoord2f", (void **) &qglTexCoord2f},
        {"glVertex2f", (void **) &qglVertex2f},
        {"glVertex3f", (void **) &qglVertex3f},