mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-26 07:35:40 +00:00
clear scissored out areas
This commit is contained in:
parent
6075352868
commit
08eeb20033
|
@ -524,7 +524,7 @@ void CRender2D::DisplaySurface(int surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up viewport and OpenGL state for 2D rendering (sets up blending function but disables blending)
|
// Set up viewport and OpenGL state for 2D rendering (sets up blending function but disables blending)
|
||||||
void CRender2D::Setup2D(bool isBottom, bool clearAll)
|
void CRender2D::Setup2D(bool isBottom)
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha of 1.0 is opaque, 0 is transparent
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha of 1.0 is opaque, 0 is transparent
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
@ -536,11 +536,13 @@ void CRender2D::Setup2D(bool isBottom, bool clearAll)
|
||||||
glUseProgram(m_shaderProgram);
|
glUseProgram(m_shaderProgram);
|
||||||
|
|
||||||
// Clear everything if requested or just overscan areas for wide screen mode
|
// Clear everything if requested or just overscan areas for wide screen mode
|
||||||
if (clearAll || isBottom)
|
if (isBottom)
|
||||||
{
|
{
|
||||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||||
glViewport(0, 0, m_totalXPixels, m_totalYPixels);
|
glViewport(0, 0, m_totalXPixels, m_totalYPixels);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glDisable(GL_SCISSOR_TEST); // scissor is enabled to fix the 2d/3d miss match problem
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT); // we want to clear outside the scissored areas so must disable it
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the viewport and orthogonal projection
|
// Set up the viewport and orthogonal projection
|
||||||
|
@ -576,7 +578,7 @@ void CRender2D::PreRenderFrame(void)
|
||||||
void CRender2D::RenderFrameBottom(void)
|
void CRender2D::RenderFrameBottom(void)
|
||||||
{
|
{
|
||||||
// Display bottom surface if anything was drawn there, else clear everything
|
// Display bottom surface if anything was drawn there, else clear everything
|
||||||
Setup2D(true, m_surfaces_present.second == false);
|
Setup2D(true);
|
||||||
if (m_surfaces_present.second)
|
if (m_surfaces_present.second)
|
||||||
DisplaySurface(1);
|
DisplaySurface(1);
|
||||||
}
|
}
|
||||||
|
@ -586,7 +588,7 @@ void CRender2D::RenderFrameTop(void)
|
||||||
// Display top surface only if it exists
|
// Display top surface only if it exists
|
||||||
if (m_surfaces_present.first)
|
if (m_surfaces_present.first)
|
||||||
{
|
{
|
||||||
Setup2D(false, false);
|
Setup2D(false);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
DisplaySurface(0);
|
DisplaySurface(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ private:
|
||||||
// Private member functions
|
// Private member functions
|
||||||
std::pair<bool, bool> DrawTilemaps(uint32_t *destBottom, uint32_t *destTop);
|
std::pair<bool, bool> DrawTilemaps(uint32_t *destBottom, uint32_t *destTop);
|
||||||
void DisplaySurface(int surface);
|
void DisplaySurface(int surface);
|
||||||
void Setup2D(bool isBottom, bool clearAll);
|
void Setup2D(bool isBottom);
|
||||||
|
|
||||||
// Run-time configuration
|
// Run-time configuration
|
||||||
const Util::Config::Node &m_config;
|
const Util::Config::Node &m_config;
|
||||||
|
|
Loading…
Reference in a new issue