Search code examples
haxehaxeflixel

Graphics get aliased when go fullscreen in HaxeFlixel?


The graphics in Flash and non-fullscreen is anti-aliased and really smooth. But when go fullscreen or on mobile, the graphics become aliased. Even when I use SVG image.


Solution

  • Yes Flash has some great aliasing with software cpu based rendering. In the mobile targets of HaxeFlixel there is a method for drawing that is very different, mostly for performance reasons.

    In HaxeFlixel the mobile and cpp targets will use the gpu which is more like webgl or Flash's Stage3d. This means that there will be differences in the way things like edges of images and text look.

    Flixel and OpenFL do a very good job in making these two methods as similar as possible. Some recent work on text for cpp in OpenFL has been very impressive. I am not aware of any solution that makes the two pixel perfect in a complex game engine for every use case. You will find similar differences with aliasing in flash game engines like Starling which also use the gpu.

    Some things you can try:

    For OpenFL/HaxeFlixel I have set gpu antialiasing before, this should be the default:

    <window antialiasing="4" />
    

    If you are wanting to test, you will loose performance however I believe you can still set software rendering in cpp with.

    FlxG.camera.antialiasing = true;
    

    You mention SVG, I think you are assuming since its a vector format it should render perfectly. The gpu rendering first rasterises the image to a bitmap so if you are expecting it to scale etc like it does in the browser it wont. You could in this case use a higher resolution image and scale it down first.