Rotated objects appear with different offsets and mirrored on Y axis when drawing the camera buffer to FlxEffectSprite

  • Hi! I don't know how big/small this problem is, but it's only affecting my project when exporting to C++/Neko.

    I'm writing a pause screen for my game using a FlxSubState. In this substate, I'm using the same method used on the Polish chapter of the HaxeFlixel tutorial ( to render what's in the camera buffer and apply a 'FlxGlitchEffect'.

    The problem is that the main object of my game, a dial (FlxSprite object) that sits always centered on screen, always renders with a different offset (and mirrored on the Y axis) when its angle is different from 0, 180 or 360 (well, pointing left or right, in general) if I'm exporting the project to Neko or C++. :/

    This video demonstrates what happens (only drawing the buffer, not applying any effects):

    All other objects, with no rotation applied, render normally. Is there anything I have to check before rendering stuff from the camera buffer on CPP/Neko targets?

    Thanks! :)

  • Could you provide a snippet which reproduces your problem so I can look into it and see what's wrong?

  • Thanks, @DleanJeans! :)

    Here's a simple example project that shows what happens: Demo

    The PlayState uses a PauseSubState, while the SecondaryState shows it in real time (this one doesn't work on HTML5 though).

    As I said, the PauseSubStateworks perfectly on flash/html5 targets, but when exporting to Neko/C++, it gives me the behavior in the YT video. :/

    Thanks again!

    P.s.: sorry for the excessive use of comments on the project, I kinda forget stuff, so I always put a lot of it :P

  • At this point I can't point out what really causes this but I can give some hints.
    Look at this block of code in your PauseSubState and SecondaryState

    if ( FlxG.renderBlit ) {
        new Point() 
    } else {
            new Matrix( 1, 0, 0, 1, 0, 0 )

    Since FlxG.renderBlit is always true only Flash and false on Neko (and maybe also C++ since I haven't tried it) so I guess the problem could be the draw() function in the else block or it could be a combination of it and something else.

  • Thanks for checking this and for the hints too! :D

    I'll try to rewrite the piece of code you've pointed out and try every possibility I can find too ;) If I find a solution, I'll post in here, so somebody else can use (if they ever run into this problem).

    Let's see if I can get this done and make a nice game! :sweat_smile:

    Thanks again!

  • I tried reverting to a previous version of OpenFL (3.5.0) and Lime (2.8.0) and found out that, with this setup, the "problem" that occurs with the "Dial" when I capture the screen now happens naturally, I don't even have to draw it! :sweat_smile:

    Gonna try looking a bit more into it, but I might be getting somewhere! :)

    Just one update, I've reverted back to Openfl 3.6.1 and Lime 2.9.1 and tried something, after reading a bit into the FlxCamera object.

    Setting = true on the PlayState made the problem occur naturally too. Lookin' more into it, though I'm quite a bad programmer :P , let's see if I can find the problem!

  • Welp, no luck testing here.

    Tried a few things on a "pure" OpenFL project too and screen grabbing resulted in some problems too (the object wouldn't appear on the screenshot), posting it to the github issue tracker, let's see if someone can give it an in-depth look :)

    For now, I guess I'll have to use another thing for my pause screen :sweat_smile:

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.