Add and Implement CommandBuffer::SetScissorRect

This commit is contained in:
Corentin Wallez
2018-02-13 14:57:13 -05:00
committed by Corentin Wallez
parent 234111c379
commit a3c89cc27a
9 changed files with 85 additions and 2 deletions

View File

@@ -370,6 +370,8 @@ namespace backend { namespace opengl {
glBlendColor(0, 0, 0, 0);
glViewport(0, 0, currentFramebuffer->GetWidth(),
currentFramebuffer->GetHeight());
glScissor(0, 0, currentFramebuffer->GetWidth(),
currentFramebuffer->GetHeight());
} break;
case Command::CopyBufferToBuffer: {
@@ -539,6 +541,11 @@ namespace backend { namespace opengl {
persistentPipelineState.SetStencilReference(cmd->reference);
} break;
case Command::SetScissorRect: {
SetScissorRectCmd* cmd = mCommands.NextCommand<SetScissorRectCmd>();
glScissor(cmd->x, cmd->y, cmd->width, cmd->height);
} break;
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
glBlendColor(cmd->r, cmd->g, cmd->b, cmd->a);

View File

@@ -40,6 +40,7 @@ namespace backend { namespace opengl {
*device = reinterpret_cast<nxtDevice>(new Device);
glEnable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);
glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
}