@@ -501,6 +501,63 @@ static void CL_FillTriAPI( triangleapi_t *dst )
501501 ref .dllFuncs .R_FillTriAPI ( dst );
502502}
503503
504+ static const byte dottexture [8 ][8 ] =
505+ {
506+ { 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 },
507+ { 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 },
508+ { 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 },
509+ { 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 },
510+ { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
511+ { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
512+ { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
513+ { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 },
514+ };
515+
516+ static void R_CreateBuiltinTextures ( void )
517+ {
518+ uint data4x4 [16 ];
519+ uint data16x16 [256 ];
520+ byte particle [8 * 8 * 4 ];
521+ int x , y ;
522+
523+ // default checkerboard
524+ for ( y = 0 ; y < 16 ; y ++ )
525+ {
526+ for ( x = 0 ; x < 16 ; x ++ )
527+ {
528+ if (( y < 8 ) ^ ( x < 8 ))
529+ data16x16 [y * 16 + x ] = 0xFFFF00FF ;
530+ else
531+ data16x16 [y * 16 + x ] = 0xFF000000 ;
532+ }
533+ }
534+ ref .dllFuncs .GL_CreateTexture ( REF_DEFAULT_TEXTURE , 16 , 16 , data16x16 , TF_COLORMAP );
535+
536+ // particle texture
537+ memset ( particle , 0 , sizeof ( particle ));
538+ for ( x = 0 ; x < 8 ; x ++ )
539+ {
540+ for ( y = 0 ; y < 8 ; y ++ )
541+ {
542+ if ( dottexture [x ][y ] )
543+ particle [( y * 8 + x ) * 4 + 3 ] = 255 ;
544+ }
545+ }
546+ ref .dllFuncs .GL_CreateTexture ( REF_PARTICLE_TEXTURE , 8 , 8 , particle , TF_CLAMP );
547+
548+ // solid colors
549+ memset ( data4x4 , 0xFF , sizeof ( data4x4 ));
550+ ref .dllFuncs .GL_CreateTexture ( REF_WHITE_TEXTURE , 4 , 4 , data4x4 , TF_COLORMAP );
551+
552+ for ( x = 0 ; x < 16 ; x ++ )
553+ data4x4 [x ] = 0xFF7F7F7F ;
554+ ref .dllFuncs .GL_CreateTexture ( REF_GRAY_TEXTURE , 4 , 4 , data4x4 , TF_COLORMAP );
555+
556+ for ( x = 0 ; x < 16 ; x ++ )
557+ data4x4 [x ] = 0xFF000000 ;
558+ ref .dllFuncs .GL_CreateTexture ( REF_BLACK_TEXTURE , 4 , 4 , data4x4 , TF_COLORMAP );
559+ }
560+
504561static qboolean R_LoadProgs ( const char * name )
505562{
506563 static ref_api_t gpEngfuncs ;
@@ -544,7 +601,7 @@ static qboolean R_LoadProgs( const char *name )
544601 Cvar_FullSet ( "host_refloaded" , "1" , FCVAR_READ_ONLY );
545602 ref .initialized = true;
546603
547- // initialize TriAPI callbacks
604+ R_CreateBuiltinTextures ();
548605 CL_FillTriAPI ( & gTriApi );
549606
550607 return true;
0 commit comments