【发布时间】:2014-07-21 05:44:25
【问题描述】:
我想剪辑屏幕的某个部分,因此外面的所有内容都不会被绘制。 我的代码如下所示:
public void draw(Camera camera, ShapeRenderer renderer){
Rectangle scissors = new Rectangle();
Rectangle clipBounds = new Rectangle(pos.x, pos.y, pos.x+width, pos.y+height);
ScissorStack.calculateScissors(camera, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), new Matrix4(), clipBounds, scissors);
renderer.begin(ShapeType.Filled);
ScissorStack.pushScissors(scissors);
for(Block[] row : blocks){
for(Block block : row)
block.draw(renderer);// draw some rects
}
ScissorStack.popScissors();
renderer.end();
}
但是这段代码没有任何作用,也就是说,位于 clipBounds 之外的形状也会被绘制出来。 我的代码有什么问题?
问候
【问题讨论】: