OpenFL 9.2.0 Contex3D changes

I`m using Starling and after updating to latest OpenFL/Lime one feature seems to be broken (comparing to previous version) - sprite rectangular masks. I checked rendering up to setting Scissor mask on context Context3D

// private var _context:Context3D;
_context.setScissorRectangle(sScissorRect);

sScissorRect seems to be correct (like before, nothing changes), but instead of proper rectangular area, it is seems to be a partial square. Target is HTML5

UPD: Strangely this happens on MacOs, but not on Windows (with the same HTML target)

any advice / any special fixes needed for scissors to work as before? //

Some additional discoveries: the problem seems to be in window scale handling. Seems it is handled ok in every place EXCEPT scissor rect. On Mac scissor rect is exactly half of needed size. On windows exactly the same html5 code works fine. Same rect for scissorRect, same everything and no problems with mask. The difference is on MacOs “this.__stage.window.__scale” == 2. On windows it is 1. Looking at changelog seems this is related to “HI DPI” support.

The problem is in line in AppMain.js. scissorWidth, scissorHeight needs to be adjusted (as well as X/Y? probably)

this.gl.scissor(scissorX,scissorY,scissorWidth,scissorHeight);

@singmajesty Sorry to bother, does it rings any bells for you?

1 Like

This definitely sounds like a bug in the new scaling code. As a workaround, you might be able to use the openfl_dpi_aware define, which should restore the old behavior.

In project.xml:

<haxedef name="openfl_dpi_aware"/>

I tried and this has partial success:

  • masks started indeed work as before
  • but strangely some text labels (via openfl.text.TextField) started to draw itself at (X*0.5, Y*0.5) positions (no code was changed, so this is obviously side effect of define) //

This definitely sounds like a bug in the new scaling code

Should i create issue or something? i can try to make pr for this, but seems scissor code is intermixed with some backbuffer renderings source paths - so not sure for the possible side effects for direct scale adjustments //

There’s another new define, openfl_disable_hdpi, that may also be worth trying to see if it restores the behavior that you expect.

You can also try:

<window allow-high-dpi="false"/>

I’m going to look at the scissor rect scaling issue today.

1 Like

Thanks! Tried your suggestions:

  • openfl_disable_hdpi did not help (same as initial behaviour - masks halfed)
  • allow-high-dpi=“false” indeed helped, everything same as before

So will stick with <window allow-high-dpi=“false”/> for now :slight_smile:

Alright, the HiDPI scissor rectangle issue should be fixed in this commit:

I will make sure that it gets included in the next release.

2 Likes