Sprite and clipping
Hi
I'm developing yet another GUI in directX. Not for commercial reasons, but Since DirectX is totally new, this is a good point to start.
But is their a way I can do some easy clipping? Something like an easy cliprect? This might be different for each control.
kind regards
Alexander
The easiest is probably to use IDirect3DDevice9::SetScissorRect(). Once a clipping rectangle is set, you can enable/disable the clipping with D3DRS_SCISSORTESTENABLE.
There are other techniques you could use, such as using masks and alpha test; using the stencil buffer; adjusting the vertices in a vertex shader; or manually clipping the input vertices.
There are other techniques you could use, such as using masks and alpha test; using the stencil buffer; adjusting the vertices in a vertex shader; or manually clipping the input vertices.
Hi
Thanks for the Scissor thing.
I'm currently using Managed directX feb 2005 release.
It seems to act a little funny. The code below tries to show what I'm doing.
It clips everything to the second rect. The first sprite is not clipped to big rectangle, but to the small.
What am I forgetting?
sprite.Begin()
device.ScissorRectanle = new Rectangle(0, 0, 50, 50);
device.RenderState.ScissorTestEnable = true;
sprite.draw...
device.RenderState.ScissorTestEnable = false;
device.ScissorRectanle = new Rectangle(0, 0, 10, 10);
device.RenderState.ScissorTestEnable = true;
sprite.drawAnother
device.RenderState.ScissorTestEnable = false;
sprite.End();
Kind regards
Alexander
Thanks for the Scissor thing.
I'm currently using Managed directX feb 2005 release.
It seems to act a little funny. The code below tries to show what I'm doing.
It clips everything to the second rect. The first sprite is not clipped to big rectangle, but to the small.
What am I forgetting?
sprite.Begin()
device.ScissorRectanle = new Rectangle(0, 0, 50, 50);
device.RenderState.ScissorTestEnable = true;
sprite.draw...
device.RenderState.ScissorTestEnable = false;
device.ScissorRectanle = new Rectangle(0, 0, 10, 10);
device.RenderState.ScissorTestEnable = true;
sprite.drawAnother
device.RenderState.ScissorTestEnable = false;
sprite.End();
Kind regards
Alexander
Hi
Thanks for the Scissor thing.
I'm currently using Managed directX feb 2005 release.
It seems to act a little funny. The code below tries to show what I'm doing.
It clips everything to the second rect. The first sprite is not clipped to big rectangle, but to the small.
What am I forgetting?
sprite.Begin()
device.ScissorRectanle = new Rectangle(0, 0, 50, 50);
device.RenderState.ScissorTestEnable = true;
sprite.draw...
device.RenderState.ScissorTestEnable = false;
device.ScissorRectanle = new Rectangle(0, 0, 10, 10);
device.RenderState.ScissorTestEnable = true;
sprite.drawAnother
device.RenderState.ScissorTestEnable = false;
sprite.End();
Kind regards
Alexander
Thanks for the Scissor thing.
I'm currently using Managed directX feb 2005 release.
It seems to act a little funny. The code below tries to show what I'm doing.
It clips everything to the second rect. The first sprite is not clipped to big rectangle, but to the small.
What am I forgetting?
sprite.Begin()
device.ScissorRectanle = new Rectangle(0, 0, 50, 50);
device.RenderState.ScissorTestEnable = true;
sprite.draw...
device.RenderState.ScissorTestEnable = false;
device.ScissorRectanle = new Rectangle(0, 0, 10, 10);
device.RenderState.ScissorTestEnable = true;
sprite.drawAnother
device.RenderState.ScissorTestEnable = false;
sprite.End();
Kind regards
Alexander
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement