]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_video.c
add DeviceLost and DeviceRestored functions to R_Modules system
[xonotic/darkplaces.git] / cl_video.c
index 90f93069e26e4a85588aba12e34e475e00a1530c..afba2119b5a968068258cc641b3c919f72ef2248 100644 (file)
@@ -51,7 +51,7 @@ static void VideoUpdateCallback(rtexture_t *rt, void *data) {
 
 static void LinkVideoTexture( clvideo_t *video ) {
        video->cpif.tex = R_LoadTexture2D( cl_videotexturepool, video->cpif.name,
-               video->cpif.width, video->cpif.height, NULL, TEXTYPE_BGRA, TEXF_PERSISTENT | TEXF_ALLOWUPDATES, NULL );
+               video->cpif.width, video->cpif.height, NULL, TEXTYPE_BGRA, TEXF_PERSISTENT | TEXF_ALLOWUPDATES, -1, NULL );
        R_MakeTextureDynamic( video->cpif.tex, VideoUpdateCallback, video );
        CL_LinkDynTexture( video->cpif.name, video->cpif.tex );
 }
@@ -437,6 +437,10 @@ void CL_DrawVideo(void)
        if (cl_video_brightness.value <= 0 || cl_video_brightness.value > 10)
                Cvar_SetValueQuick( &cl_video_brightness, 1);
 
+       // draw black bg in case stipple is active or video is scaled
+       if (cl_video_stipple.integer || cl_video_scale.value != 1)
+               DrawQ_Fill(0, 0, vid_conwidth.integer, vid_conheight.integer, 0, 0, 0, 1, 0);
+
        // enable video-only polygon stipple (of global stipple is not active)
        if (qglPolygonStipple && !scr_stipple.integer && cl_video_stipple.integer)
        {
@@ -464,7 +468,6 @@ void CL_DrawVideo(void)
                int py = (int)(vid_conheight.integer * (1 - cl_video_scale.value) * ((bound(-1, cl_video_scale_vpos.value, 1) + 1) / 2));
                int sx = (int)(vid_conwidth.integer * cl_video_scale.value);
                int sy = (int)(vid_conheight.integer * cl_video_scale.value);
-               DrawQ_Fill(0, 0, vid_conwidth.integer, vid_conheight.integer, 0, 0, 0, 1, 0);
                DrawQ_Pic(px, py, &video->cpif, sx , sy, cl_video_brightness.value, cl_video_brightness.value, cl_video_brightness.value, 1, 0);
        }
 
@@ -609,6 +612,6 @@ void CL_Video_Init( void )
        Cvar_RegisterVariable(&cl_video_brightness);
        Cvar_RegisterVariable(&cl_video_stipple);
 
-       R_RegisterModule( "CL_Video", cl_video_start, cl_video_shutdown, cl_video_newmap );
+       R_RegisterModule( "CL_Video", cl_video_start, cl_video_shutdown, cl_video_newmap, NULL, NULL );
 }