mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 19:00:14 -05:00
renderer_gl: Clear screen to black before rendering framebuffer.
This commit is contained in:
parent
ebd613c2cc
commit
92801b1c34
2 changed files with 8 additions and 5 deletions
|
@ -293,16 +293,16 @@ void RendererOpenGL::LoadFBToScreenInfo(const FramebufferInfo& framebuffer_info,
|
||||||
* Fills active OpenGL texture with the given RGB color. Since the color is solid, the texture can
|
* Fills active OpenGL texture with the given RGB color. Since the color is solid, the texture can
|
||||||
* be 1x1 but will stretch across whatever it's rendered on.
|
* be 1x1 but will stretch across whatever it's rendered on.
|
||||||
*/
|
*/
|
||||||
void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b,
|
void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a,
|
||||||
const TextureInfo& texture) {
|
const TextureInfo& texture) {
|
||||||
state.texture_units[0].texture_2d = texture.resource.handle;
|
state.texture_units[0].texture_2d = texture.resource.handle;
|
||||||
state.Apply();
|
state.Apply();
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
u8 framebuffer_data[3] = {color_r, color_g, color_b};
|
u8 framebuffer_data[4] = {color_a, color_b, color_g, color_r};
|
||||||
|
|
||||||
// Update existing texture
|
// Update existing texture
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, framebuffer_data);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, framebuffer_data);
|
||||||
|
|
||||||
state.texture_units[0].texture_2d = 0;
|
state.texture_units[0].texture_2d = 0;
|
||||||
state.Apply();
|
state.Apply();
|
||||||
|
@ -364,6 +364,9 @@ void RendererOpenGL::InitOpenGLObjects() {
|
||||||
|
|
||||||
state.texture_units[0].texture_2d = 0;
|
state.texture_units[0].texture_2d = 0;
|
||||||
state.Apply();
|
state.Apply();
|
||||||
|
|
||||||
|
// Clear screen to black
|
||||||
|
LoadColorToActiveGLTexture(0, 0, 0, 0, screen_info.texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
|
void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
|
||||||
|
|
|
@ -60,8 +60,8 @@ private:
|
||||||
|
|
||||||
// Loads framebuffer from emulated memory into the display information structure
|
// Loads framebuffer from emulated memory into the display information structure
|
||||||
void LoadFBToScreenInfo(const FramebufferInfo& framebuffer_info, ScreenInfo& screen_info);
|
void LoadFBToScreenInfo(const FramebufferInfo& framebuffer_info, ScreenInfo& screen_info);
|
||||||
// Fills active OpenGL texture with the given RGB color.
|
// Fills active OpenGL texture with the given RGBA color.
|
||||||
void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, const TextureInfo& texture);
|
void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a, const TextureInfo& texture);
|
||||||
|
|
||||||
EmuWindow* render_window; ///< Handle to render window
|
EmuWindow* render_window; ///< Handle to render window
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue