[.net] [MDX] 2D image filters

Started by
2 comments, last by u235 17 years, 9 months ago
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?
Blupix Games
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.

Shedletsky's Bits: A Blog | ROBLOX | Twitter
Time held me green and dying
Though I sang in my chains like the sea...

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.
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 valueif (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
V/R,-AJThere are 10 kinds of people in the world: Those who understand binary and those who don't...

This topic is closed to new replies.

Advertisement