Jump to content
  • Advertisement
Sign in to follow this  
Mr_Fhqwhgads

[.net] [MDX] 2D image filters

This topic is 4462 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

Hello, it seems that MDX automatically preforms AntiAliasing on my pixel art. Is there a way to turn this off?
        /// <summary>
        /// Initializes Direct3D
        /// </summary>
        /// <returns>True if succeded</returns>
        private bool initDirect3D()
        {
            // Setup Parameters
            PresentParameters presentParams = new PresentParameters();
            presentParams.IsWindowed = true;
            presentParams.SwapEffect = SwapEffect.Discard;
            presentParams.PresentationInterval = PresentInterval.Immediate;

            try
            {
                _d3dDevice = new Device(0, DeviceType.Hardware, _window.Handle, CreateFlags.SoftwareVertexProcessing, presentParams);

            }
            catch (DirectXException)
            {
                MessageBox.Show("Error initializing Direct3D", "Renderer");
                return false;
            }
            return true;
        }
Also, is there a way to check to see if a number is even?

Share this post


Link to post
Share on other sites
Advertisement
You want to set the MinFilter and MagFilter members of the presentation params to "None", I think. By default MDX resamples magnified or zoomed-out textures. Unless your problem is that anti-aliasing really is on - but that is not the case by default.

Share this post


Link to post
Share on other sites
Also, I have found that setting the filters between the Sprite.Begin() and Sprite.End() calls is the only way to maintain the aliasing of my pixel art.

So, my sprite/tile rendering goes something like this:
Sprite.Begin()
Device.SamplerState[0].MinFilter = TextureFilter.None;
Device.SamplerState[0].MagFilter = TextureFilter.None;

// Draw tiles...
// Draw sprites...
// Draw anything else...

Sprite.End()

Hope this helps.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mr_Fhqwhgads
Also, is there a way to check to see if a number is even?



int number;

//Do something to init 'number' to a non-constant value

if (number % 2 == 0)
//Number is even



That basically checks the remainder of the operation (number / 2) and if it's 0, number is obviously even.

Hope that helps.

-AJ

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!