Jump to content
  • Advertisement
Sign in to follow this  
chevluh

[DirectX] how to enable point sampling for sprites?

This topic is 3538 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm building a small 2D application mostly using the sprite (ID3DXSprite) interface and it's working well so far. Except... I'd like to use point sampling for the textures because I need the texels to appear sharp'n'square when I zoom in. Normally I'd do that by setting the device's magfilter to TextureFilter.Point. However, When I call Sprite.End() to actually draw my sprites, the sprite sets its own various render states, including, going by the visual result, setting the magfilter back to linear. That's my problem right there. The first thing that comes to mind would be to use SpriteFlags.DoNotModifyRenderState, but in this case the sprite class won't set even the most basic settings needed to render the sprites and naturally the DirectX docs are rather evasive on what exactly needs to be done. It's in managed DirectX but the smae problem would pop up in C++ DirectX, and if someone can explain it to me in C++ I'll be able to convert it to C# easily.

Share this post


Link to post
Share on other sites
Advertisement
The documentation page for the native version of ID3DXSprite shows you all of the render states it sets, so if you can translate that to MDX you should be good to go. [smile]

Share this post


Link to post
Share on other sites
D'oh! Now I feel silly for missing that.

Thanks a lot for the help!

EDIT: Actually, while it *is* very informative, it doesn't offer any insight on how the vertex pipeline is set up, which is the bit that actually seems to be preventing me from drawing sprites with DoNotModifyRenderState enabled. Looks like I'm not out of pixhell yet.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!