/// <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;
}
[.net] [MDX] 2D image filters
Hello, it seems that MDX automatically preforms AntiAliasing on my pixel art. Is there a way to turn this off?
Also, is there a way to check to see if a number is even?
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.
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:
Hope this helps.
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement