Allow FrameBuffer clear color to be customized.

This commit is contained in:
Paul Chote
2019-08-31 18:21:30 +01:00
committed by teinarss
parent 09dd66fd5a
commit d2298b6f04
4 changed files with 27 additions and 7 deletions

View File

@@ -20,12 +20,14 @@ namespace OpenRA.Platforms.Default
{
readonly ITexture texture;
readonly Size size;
readonly Color clearColor;
uint framebuffer, depth;
bool disposed;
public FrameBuffer(Size size, ITextureInternal texture)
public FrameBuffer(Size size, ITextureInternal texture, Color clearColor)
{
this.size = size;
this.clearColor = clearColor;
if (!Exts.IsPowerOf2(size.Width) || !Exts.IsPowerOf2(size.Height))
throw new InvalidDataException("Frame buffer size ({0}x{1}) must be a power of two".F(size.Width, size.Height));
@@ -94,7 +96,7 @@ namespace OpenRA.Platforms.Default
OpenGL.CheckGLError();
OpenGL.glViewport(0, 0, size.Width, size.Height);
OpenGL.CheckGLError();
OpenGL.glClearColor(0, 0, 0, 0);
OpenGL.glClearColor(clearColor.R, clearColor.G, clearColor.B, clearColor.A);
OpenGL.CheckGLError();
OpenGL.glClear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
OpenGL.CheckGLError();