libgdx ScissorStack not working as expected

后端 未结 1 1662
南笙
南笙 2020-12-11 22:22

I\'m trying to create a \"progress bar\" of sorts but the clipping doesn\'t seem to work the way I expect it to. Is this something I am doing wrong or something I\'ve misint

相关标签:
1条回答
  • 2020-12-11 23:16

    Actual drawing doesn't happen until the Batch "flushes", its not the draw call you need to wrap, as that just queues up drawing to be done later.

    You need to make sure the OpenGL draw calls happen between enabling and disabling your scissors, so add a flush after the draw. See https://github.com/libgdx/libgdx/wiki/Clipping,-with-the-use-of-scissorstack

    Because a draw call might cause a flush to happen, you need to keep the draw calls inside the active-scissor region. You may also need to flush or end the batch before starting the active scissor region to prevent queued draw calls from before the scissor start getting flushed inside the active scissor region.

    0 讨论(0)
提交回复
热议问题