Fixed a rendering issue when resizing the main window

This commit is contained in:
codeimp 2009-05-14 19:23:27 +00:00
parent 2fd192479d
commit 542d68370d
2 changed files with 15 additions and 0 deletions

View file

@ -474,6 +474,19 @@ namespace CodeImp.DoomBuilder.Rendering
}
}
// This clears a target
public void ClearRendertarget(Color4 backcolor, Surface target, Surface depthbuffer)
{
// Set rendertarget
device.DepthStencilSurface = depthbuffer;
device.SetRenderTarget(0, target);
if(depthbuffer != null)
device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, backcolor, 1f, 0);
else
device.Clear(ClearFlags.Target, backcolor, 1f, 0);
}
// This ends a drawing session
public void FinishRendering()
{

View file

@ -432,6 +432,8 @@ namespace CodeImp.DoomBuilder.Rendering
//StartPlotter(true); Finish();
//StartThings(true); Finish();
//StartOverlay(true); Finish();
graphics.ClearRendertarget(General.Colors.Background.WithAlpha(0).ToColorValue(), thingstex.GetSurfaceLevel(0), null);
graphics.ClearRendertarget(General.Colors.Background.WithAlpha(0).ToColorValue(), overlaytex.GetSurfaceLevel(0), null);
// Create font
font = new SlimDX.Direct3D9.Font(graphics.Device, FONT_WIDTH, FONT_HEIGHT, FontWeight.Bold, 1, false, CharacterSet.Ansi, Precision.Default, FontQuality.Antialiased, PitchAndFamily.Default, FONT_NAME);