Anti-alias for lines
Monkey Forums/Monkey Programming/Anti-alias for lines
| ||
| Mark, I'm doing some line vector stuff and would like to know if you have any plans for Anti-alias to be turned on? After some investigation: * By default it's enabled on HTML5 (cannot be changed??) * Xna: adding 'deviceManager.PreferMultiSampling = true;' to the gxtkGame constructor. |
| ||
| Re-prompting this one. Anyone know how this might work for GLFW? Thanks |
| ||
| Ok - made extension for this one (XNA at this stage): 1. Create a folder called extension 2. Inside extension folder, create a file called extension.monkey and add this code:
Import "native/extension.${TARGET}.${LANG}"
Extern
#If TARGET="xna" Then
Function SetAntiAlias:Void(value:Bool)="extension.SetAntiAlias"
Function IsAntiAlias:Bool()="extension.IsAntiAlias"
#EndIf
Public
3. Create a folder called native (inside extension folder) 4. Inside native folder, create a file called extension.xna.cs and add this code:
class extension
{
private static Boolean _antiAliasEnabled = false;
public static void SetAntiAlias(Boolean value)
{
gxtkApp.game.deviceManager.PreferMultiSampling = value;
gxtkApp.game.GraphicsDevice.PresentationParameters.MultiSampleCount = (value == true ? 4 : 0);
gxtkApp.game.deviceManager.ApplyChanges();
_antiAliasEnabled = value;
}
public static Boolean IsAntiAlias()
{
return _antiAliasEnabled;
}
}
Some conjecture about what code properly turns on AntiAlias in XNA 4.0 but does a decent job at the moment. |
| ||
| I'd like anti aliased lines as well, for andriod/flash/xcode too. Oh and Matt, thanks for sharing :) |
| ||
| Tibit, No probs - I'm doing some vector stuff too so this is needed :) |