Anti-aliasing fails with Stage3D for native Windows cpp target

I’m having some trouble getting anti-aliasing to work correctly on native (non-AIR) Mac and Windows targets for a Stage3D project. Because the AIR target renders fine, I assume it’s cpp-related.

Textures themselves seem to antialias okay, but when I draw shapes—with either solid color or texture fills—the outlines are ragged (left). For the AIR target (right), antialiasing works as expected.

CPP AIR

Setting the antialias parameter by calling:

_myContext3D.configureBackBuffer(..., 4)

…or by adding the following to my project.xml:

<window... antialiasing="4" if="cpp" />

…has no discernible effect.

In case it’s helpful, my simple fill shader (which draws directly to the Context3D’s backbuffer) looks like this:

// vertex
"m44 op, va0, vc0", 
"mov v0, va1"

// fragment
"mov oc, v0"

…although the problem also affects shapes drawn with a texture-fill shader.

I’m using OpenFl 8.8.0 (can’t use the latest because it needs to be compatible with Switch development).

Anybody know what’s going on here?

Okay, I’ve solved this, more or less. [Update: Turns out this solution works for Mac only. I’m still unable to anti-alias the Windows native executable.]

Poking around for solutions, I found this, which suggests adding to the project.xml:

<define name="openfl-share-context" value="" if="cpp" />

…and it’s now anti-aliasing correctly on MacOS.

Any idea why it wouldn’t be working on Windows as well?

3 Likes

Do you have a high DPI monitor? One thing worth mentioning is that <window allow-high-dpi="true"/> in project.xml does not work on Windows cpp yet. With that in mind, on a high DPI monitor, it will always look somewhat pixelated because it will be scaled up from a lower resolution.

If you don’t have a high DPI monitor, and are not using <window allow-high-dpi="true"/>, please ignore. :wink:

1 Like

Thank you!

I am on a 5K display, but the issue is definitely not just upscaling—it’s showing 100% hard edges rather than pixelated anti-aliasing.

However, I’m using a virtualized Windows environment, and it seems as though that may be the issue, although I haven’t yet had a chance to test it on a native Windows machine.

Okay, this antialiased correctly on a native Windows machine, so the issue is very likely that OpenGL multisampling doesn’t work in Parallels.

1 Like