axmol: Scissor state is not applied for `Renderer::clear()` command
Scissor state is not applied for the clear command generated by Renderer::clear()
, so the command ends up using an old state.
Since the only place where scissor state is applied is Renderer::beginRenderPass()
it means that the scissor state is applied only when something is being drawn on the screen. So if the last command disables scissor state (after it was enabled earlier in the frame), the disabled scissor state is not applied in the next frame when Renderer::clear()
happens and the screen is not cleared. The state is applied only after something is drawn and it triggers Renderer::beginRenderPass()
call.
To setup a repro scene run the following code in an empty scene. Also make sure that nothing else is rendering like ImGui, fps, etc.
auto scene = ax::Director::getInstance()->getRunningScene();
// This should draw an almost invisible fullscreen red quad.
// But since background is not cleared, it's max red.
auto dn = ax::DrawNode::create();
dn->drawSolidRect({ 0, 0 }, { 2000, 2000 }, { 255, 0, 0, 40 });
scene->addChild(dn);
auto dn2 = ax::DrawNode::create();
dn2->drawSolidRect({ 0, 0 }, { 100, 100 }, { 0, 255, 0, 40 });
auto crn = ax::ClippingRectangleNode::create({ 0, 0, 50, 50 });
crn->addChild(dn2);
// Comment this out to see that the issue is gone if scissor state is not being manipulated
scene->addChild(crn);
- axmol version: latest dev branch
- devices test on: macOS+OpenGL
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 16 (12 by maintainers)
Yeah, lgtm