]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rmain.c
Experimental restoration of GLES2 support. It *might* compile.
[xonotic/darkplaces.git] / gl_rmain.c
index 08c76845f23b7b63b48b7e38646f083acc2bac4f..5e97574bd14eb817414901e97662c36fe144b081 100644 (file)
@@ -393,30 +393,7 @@ static void R_BuildBlankTextures(void)
 
 static void R_BuildNoTexture(void)
 {
-       int x, y;
-       unsigned char pix[16][16][4];
-       // this makes a light grey/dark grey checkerboard texture
-       for (y = 0;y < 16;y++)
-       {
-               for (x = 0;x < 16;x++)
-               {
-                       if ((y < 8) ^ (x < 8))
-                       {
-                               pix[y][x][0] = 128;
-                               pix[y][x][1] = 128;
-                               pix[y][x][2] = 128;
-                               pix[y][x][3] = 255;
-                       }
-                       else
-                       {
-                               pix[y][x][0] = 64;
-                               pix[y][x][1] = 64;
-                               pix[y][x][2] = 64;
-                               pix[y][x][3] = 255;
-                       }
-               }
-       }
-       r_texture_notexture = R_LoadTexture2D(r_main_texturepool, "notexture", 16, 16, &pix[0][0][0], TEXTYPE_BGRA, TEXF_MIPMAP | TEXF_PERSISTENT, -1, NULL);
+       r_texture_notexture = R_LoadTexture2D(r_main_texturepool, "notexture", 16, 16, Image_GenerateNoTexture(), TEXTYPE_BGRA, TEXF_MIPMAP | TEXF_PERSISTENT, -1, NULL);
 }
 
 static void R_BuildWhiteCube(void)
@@ -1370,7 +1347,7 @@ static void R_SetupShader_SetPermutationGLSL(unsigned int mode, uint64_t permuta
                {
                        if (!r_glsl_permutation->compiled)
                        {
-                               Con_DPrintf("Compiling shader mode %u permutation %"PRIx64"\n", mode, permutation);
+                               Con_DPrintf("Compiling shader mode %u permutation %" PRIx64 "\n", mode, permutation);
                                R_GLSL_CompilePermutation(perm, mode, permutation);
                        }
                        if (!r_glsl_permutation->program)
@@ -2847,38 +2824,10 @@ skinframe_t *R_SkinFrame_LoadMissing(void)
 
 skinframe_t *R_SkinFrame_LoadNoTexture(void)
 {
-       int x, y;
-       static unsigned char pix[16][16][4];
-
        if (cls.state == ca_dedicated)
                return NULL;
 
-       // this makes a light grey/dark grey checkerboard texture
-       if (!pix[0][0][3])
-       {
-               for (y = 0; y < 16; y++)
-               {
-                       for (x = 0; x < 16; x++)
-                       {
-                               if ((y < 8) ^ (x < 8))
-                               {
-                                       pix[y][x][0] = 128;
-                                       pix[y][x][1] = 128;
-                                       pix[y][x][2] = 128;
-                                       pix[y][x][3] = 255;
-                               }
-                               else
-                               {
-                                       pix[y][x][0] = 64;
-                                       pix[y][x][1] = 64;
-                                       pix[y][x][2] = 64;
-                                       pix[y][x][3] = 255;
-                               }
-                       }
-               }
-       }
-
-       return R_SkinFrame_LoadInternalBGRA("notexture", TEXF_FORCENEAREST, pix[0][0], 16, 16, 0, 0, 0, false);
+       return R_SkinFrame_LoadInternalBGRA("notexture", TEXF_FORCENEAREST, Image_GenerateNoTexture(), 16, 16, 0, 0, 0, false);
 }
 
 skinframe_t *R_SkinFrame_LoadInternalUsingTexture(const char *name, int textureflags, rtexture_t *tex, int width, int height, qboolean sRGB)
@@ -3148,7 +3097,9 @@ static void gl_main_start(void)
        R_BuildBlankTextures();
        R_BuildNoTexture();
        R_BuildWhiteCube();
+#ifndef USE_GLES2
        R_BuildNormalizationCube();
+#endif //USE_GLES2
        r_texture_fogattenuation = NULL;
        r_texture_fogheighttexture = NULL;
        r_texture_gammaramps = NULL;
@@ -4295,12 +4246,16 @@ void R_HDR_UpdateIrisAdaptation(const vec3_t point)
                Cvar_SetValueQuick(&r_hdr_irisadaptation_value, 1.0f);
 }
 
+extern cvar_t r_lockvisibility;
+extern cvar_t r_lockpvs;
+
 static void R_View_SetFrustum(const int *scissor)
 {
        int i;
        double fpx = +1, fnx = -1, fpy = +1, fny = -1;
        vec3_t forward, left, up, origin, v;
-
+       if(r_lockvisibility.integer || r_lockpvs.integer)
+               return;
        if(scissor)
        {
                // flipped x coordinates (because x points left here)
@@ -4728,7 +4683,7 @@ static void R_Water_StartFrame(int viewwidth, int viewheight)
        waterwidth = (int)bound(16, viewwidth * r_water_resolutionmultiplier.value, viewwidth);
        waterheight = (int)bound(16, viewheight * r_water_resolutionmultiplier.value, viewheight);
 
-       if (!r_water.integer || r_showsurfaces.integer)
+       if (!r_water.integer || r_showsurfaces.integer || r_lockvisibility.integer || r_lockpvs.integer)
                waterwidth = waterheight = 0;
 
        // set up variables that will be used in shader setup