0
RenderTarget2D 및 ScissorRectangle이있는 스크롤 가능한 로그 창을 만들려고합니다. 그러나 ScissorRectangle은 효과가없는 것 같습니다. 코드는 다음과 같습니다.MonoGame - ScissorRectangle not working
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, new RasterizerState() { ScissorTestEnable = true });
Rectangle scissor = new Rectangle(0, Constants.GAME_AREA_HEIGHT, Constants.GAME_AREA_WIDTH, Constants.LOG_HEIGHT);
Rectangle scissorBackup = this.graphicsDevice.ScissorRectangle;
this.graphicsDevice.ScissorRectangle = scissor;
spriteBatch.Draw(logRenderTarget,
new Rectangle(0, Constants.GAME_AREA_HEIGHT, Constants.GAME_AREA_WIDTH, Constants.LOG_HEIGHT),
Color.White
);
this.graphicsDevice.ScissorRectangle = scissorBackup;
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null);
나는 가위 사각형이 'SpriteBatch.End' 호출 중에 * only * 적용된다는 것이 확실하다. 위의 코드에서 너무 일찍 재설정하고 있습니다. – craftworkgames