App class not getting resize event (OSX 10.14)

Hi,

I’m trying to build an app which redraw manually while keeping a 1:1 mapping between pixels and points coordinates.

My code looks like this :

class MyApp : public ci::App {

     MyApp(){
         setFrameRate(0);
     }

    void mouseDown(MouseEvent e) override {
        do_paint();
    }

    void resize() override {
          // never called
         getRenderer()->defaultResize();
    }

    void do_paint(){
          // this is just here for testing, without this line the subsequent drawing are distorted
         getRenderer()->defaultResize(); 
         
         getRenderer()->startDraw();

         // doesn't draw at the center of the screen after a window resize
         gl::drawString("Test", getWindowSize() / 2);

         getRenderer()->finishDraw();
    }
};

I’m receiving the MouseEvent, however the resize() override is not being called. Furthermore, getWindowSize() do not return the current size anymore, but the size of the window at launch.

Is this a bug?

Thanks,
-JB

I’d say by setting the framerate to zero you’re preventing the app’s base class ::update() from being called which has a lot of logic in it like stepping the timeline, polling the io_service and i’ll bet pumping events. If I were you (and without knowing your specific case) I’d leave the frame rate at v-sync and handle your manual redrawing manually. i.e if ( dirty ) do_paint();

I’d say by setting the framerate to zero you’re preventing the app’s base class ::update() from being called which has a lot of logic in it like stepping the timeline

Yeah, but I don’t understand why I would get all the MouseEvent but not the resize, this sounds like a bug to me.

If I were you (and without knowing your specific case) I’d leave the frame rate at v-sync and handle your manual redrawing manually. i.e if ( dirty ) do_paint();

Actually I just tried that and I’m getting some very weird flicker/glitches on half the frames. I think the App class is doing some stuff in between the draw() call which makes it impossible to just keep the previous frame without drawing to a buffer, which I really don’t want to do.

Hi JB,

which version of Cinder are you using? The release or a current Github branch?

~Paul