From 8f2abab0d991211a5acc99877180c35f27e73e45 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 25 Feb 2019 21:55:14 -0500 Subject: [PATCH] Ensures texture targets are initially clear. --- Outputs/OpenGL/Primitives/TextureTarget.cpp | 3 +++ Outputs/OpenGL/Primitives/TextureTarget.hpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Outputs/OpenGL/Primitives/TextureTarget.cpp b/Outputs/OpenGL/Primitives/TextureTarget.cpp index 02aac2ed5..175ebff09 100644 --- a/Outputs/OpenGL/Primitives/TextureTarget.cpp +++ b/Outputs/OpenGL/Primitives/TextureTarget.cpp @@ -70,6 +70,9 @@ TextureTarget::TextureTarget(GLsizei width, GLsizei height, GLenum texture_unit, break; } } + + // Clear the framebuffer. + test_gl(glClear, GL_COLOR_BUFFER_BIT); } TextureTarget::~TextureTarget() { diff --git a/Outputs/OpenGL/Primitives/TextureTarget.hpp b/Outputs/OpenGL/Primitives/TextureTarget.hpp index 59fd42d51..22321ed08 100644 --- a/Outputs/OpenGL/Primitives/TextureTarget.hpp +++ b/Outputs/OpenGL/Primitives/TextureTarget.hpp @@ -77,9 +77,9 @@ class TextureTarget { private: GLuint framebuffer_ = 0, texture_ = 0, renderbuffer_ = 0; - GLsizei width_ = 0, height_ = 0; + const GLsizei width_ = 0, height_ = 0; GLsizei expanded_width_ = 0, expanded_height_ = 0; - GLenum texture_unit_ = 0; + const GLenum texture_unit_ = 0; mutable std::unique_ptr pixel_shader_; mutable GLuint drawing_vertex_array_ = 0, drawing_array_buffer_ = 0;