]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_backend.c
made darkplaces compile successfully with g++ to test for errors C doesn't care about...
[xonotic/darkplaces.git] / gl_backend.c
index c281e91f43ece991672745bb92f1846befd450ce..61e606fea084a01441e68d9c1cadaf2c26694aac 100644 (file)
@@ -174,9 +174,9 @@ static void gl_backend_start(void)
        if (gl_support_fragment_shader)
        {
                CHECKGLERROR
-               qglGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &backendimageunits);
+               qglGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, (int *)&backendimageunits);
                CHECKGLERROR
-               qglGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, &backendarrayunits);
+               qglGetIntegerv(GL_MAX_TEXTURE_COORDS_ARB, (int *)&backendarrayunits);
                CHECKGLERROR
                Con_Printf("GLSL shader support detected: texture units = %i texenv, %i image, %i array\n", backendunits, backendimageunits, backendarrayunits);
        }
@@ -432,8 +432,8 @@ void GL_SetupTextureState(void)
        unsigned int i;
        gltextureunit_t *unit;
        CHECKGLERROR
-       gl_state.unit = -1;
-       gl_state.clientunit = -1;
+       gl_state.unit = MAX_TEXTUREUNITS;
+       gl_state.clientunit = MAX_TEXTUREUNITS;
        for (i = 0;i < MAX_TEXTUREUNITS;i++)
        {
                unit = gl_state.units + i;
@@ -1102,6 +1102,8 @@ void R_Mesh_VertexPointer(const float *vertex3f)
 
 void R_Mesh_ColorPointer(const float *color4f)
 {
+       if (r_showtrispass)
+               return;
        if (gl_state.pointer_color != color4f)
        {
                CHECKGLERROR
@@ -1127,6 +1129,8 @@ void R_Mesh_ColorPointer(const float *color4f)
 void R_Mesh_TexCoordPointer(unsigned int unitnum, unsigned int numcomponents, const float *texcoord)
 {
        gltextureunit_t *unit = gl_state.units + unitnum;
+       if (r_showtrispass)
+               return;
        // update array settings
        if (texcoord)
        {
@@ -1164,6 +1168,8 @@ void R_Mesh_TexBindAll(unsigned int unitnum, int tex1d, int tex2d, int tex3d, in
        gltextureunit_t *unit = gl_state.units + unitnum;
        if (unitnum >= backendunits)
                return;
+       if (r_showtrispass)
+               return;
        // update 1d texture binding
        if (unit->t1d != tex1d)
        {
@@ -1255,6 +1261,8 @@ void R_Mesh_TexBind1D(unsigned int unitnum, int texnum)
        gltextureunit_t *unit = gl_state.units + unitnum;
        if (unitnum >= backendunits)
                return;
+       if (r_showtrispass)
+               return;
        // update 1d texture binding
        if (unit->t1d != texnum)
        {
@@ -1310,6 +1318,8 @@ void R_Mesh_TexBind(unsigned int unitnum, int texnum)
        gltextureunit_t *unit = gl_state.units + unitnum;
        if (unitnum >= backendunits)
                return;
+       if (r_showtrispass)
+               return;
        // update 1d texture binding
        if (unit->t1d)
        {
@@ -1365,6 +1375,8 @@ void R_Mesh_TexBind3D(unsigned int unitnum, int texnum)
        gltextureunit_t *unit = gl_state.units + unitnum;
        if (unitnum >= backendunits)
                return;
+       if (r_showtrispass)
+               return;
        // update 1d texture binding
        if (unit->t1d)
        {
@@ -1420,6 +1432,8 @@ void R_Mesh_TexBindCubeMap(unsigned int unitnum, int texnum)
        gltextureunit_t *unit = gl_state.units + unitnum;
        if (unitnum >= backendunits)
                return;
+       if (r_showtrispass)
+               return;
        // update 1d texture binding
        if (unit->t1d)
        {
@@ -1473,6 +1487,8 @@ void R_Mesh_TexBindCubeMap(unsigned int unitnum, int texnum)
 void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix)
 {
        gltextureunit_t *unit = gl_state.units + unitnum;
+       if (r_showtrispass)
+               return;
        if (matrix->m[3][3])
        {
                // texmatrix specified, check if it is different
@@ -1505,6 +1521,8 @@ void R_Mesh_TexMatrix(unsigned int unitnum, const matrix4x4_t *matrix)
 void R_Mesh_TexCombine(unsigned int unitnum, int combinergb, int combinealpha, int rgbscale, int alphascale)
 {
        gltextureunit_t *unit = gl_state.units + unitnum;
+       if (r_showtrispass)
+               return;
        if (gl_combine.integer)
        {
                // GL_ARB_texture_env_combine
@@ -1560,10 +1578,6 @@ void R_Mesh_State(const rmeshstate_t *m)
        BACKENDACTIVECHECK
 
        R_Mesh_VertexPointer(m->pointer_vertex);
-
-       if (r_showtrispass)
-               return;
-
        R_Mesh_ColorPointer(m->pointer_color);
 
        if (gl_backend_rebindtextures)
@@ -2038,7 +2052,7 @@ int R_Mesh_CacheArray(rcachearrayrequest_t *r)
        //R_Mesh_CacheArray_ValidateState(3);
        // calculate a hashindex to choose a cache chain
        r->data = NULL;
-       hashindex = CRC_Block((void *)r, sizeof(*r)) % RCACHEARRAY_HASHSIZE;
+       hashindex = CRC_Block((qbyte *)r, sizeof(*r)) % RCACHEARRAY_HASHSIZE;
 
        // is it already cached?
        for (lhead = &r_mesh_rcachechain[hashindex], l = lhead->next;l != lhead;l = l->next)