mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Disable scissor for clearing the framebuffer
This commit is contained in:
parent
96d7a9d0d9
commit
ca2926335b
|
@ -966,8 +966,18 @@ void CCommandProcessorFragment_OpenGL::Cmd_TextTextures_Create(const CCommandBuf
|
|||
|
||||
void CCommandProcessorFragment_OpenGL::Cmd_Clear(const CCommandBuffer::SCommand_Clear *pCommand)
|
||||
{
|
||||
// if clip is still active, force disable it for clearing, enable it again afterwards
|
||||
bool ClipWasEnabled = m_LastClipEnable;
|
||||
if(ClipWasEnabled)
|
||||
{
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
glClearColor(pCommand->m_Color.r, pCommand->m_Color.g, pCommand->m_Color.b, 0.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
if(ClipWasEnabled)
|
||||
{
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL::Cmd_Render(const CCommandBuffer::SCommand_Render *pCommand)
|
||||
|
|
|
@ -756,12 +756,22 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_TextTextures_Create(const CCommand
|
|||
|
||||
void CCommandProcessorFragment_OpenGL3_3::Cmd_Clear(const CCommandBuffer::SCommand_Clear *pCommand)
|
||||
{
|
||||
// if clip is still active, force disable it for clearing, enable it again afterwards
|
||||
bool ClipWasEnabled = m_LastClipEnable;
|
||||
if(ClipWasEnabled)
|
||||
{
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
if(pCommand->m_Color.r != m_ClearColor.r || pCommand->m_Color.g != m_ClearColor.g || pCommand->m_Color.b != m_ClearColor.b)
|
||||
{
|
||||
glClearColor(pCommand->m_Color.r, pCommand->m_Color.g, pCommand->m_Color.b, 0.0f);
|
||||
m_ClearColor = pCommand->m_Color;
|
||||
}
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
if(ClipWasEnabled)
|
||||
{
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
void CCommandProcessorFragment_OpenGL3_3::UploadStreamBufferData(unsigned int PrimitiveType, const void *pVertices, size_t VertSize, unsigned int PrimitiveCount, bool AsTex3D)
|
||||
|
|
Loading…
Reference in a new issue