Question

I set up the stencil buffer so only parts of the screen are affected by draw calls. Specifically, I want to draw into a small area. It will become an UI, so everything drawn will be some kind of 2D sprite. Using the sprite object works very well. Sprites that are outside of the area are cut off. However, when I add text, everything drawn afterwards and the text itself is not cut off. PIX shows that a new DepthStencilState is set with the stencil buffer turned off as soon as draw text is called. The text is drawn by the same sprite object which is responsible for drawing other sprites.

The drawing is performed through the SlimDX.Direct3D10.Font.Draw method.

Is there a way to force DirectX not to change the state object? I use SlimDX, but according to its code it does not seem to be responsible for the state change.

Nico

Was it helpful?

Solution

If you're switching to D3D11, you might be interested in a font rendering library I've been working on porting to SlimDX (along with some other bits from the DirectX toolkit libraries that have been released over the past few months).

It's still in development, so no guarantees about anything, but you can find it here (SVN): http://code.google.com/p/slimdx/source/browse/#svn%2Fbranches%2Flite%2FSlimDX.Toolkit

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top