POCO draw events before standard draw events

Currently in ofAppGlutWindow::display, you call ofAppPtr->draw() before ofNotifyEvent(ofEvents.draw…). This means that any ofAddListener-type draw events obscure anything created in the normal draw() routine. I’d love to have the option of both pre-draw and post-draw events, so you can draw on top of listener-added events, perhaps something like this:

#ifdef OF_USING_POCO
ofNotifyEvent( ofEvents.predraw, voidEventArgs );
#endif

if(ofAppPtr)
ofAppPtr->draw();

#ifdef OF_USING_POCO
ofNotifyEvent( ofEvents.postdraw, voidEventArgs );
#endif

an easy way to do this is just to register the testApp and use that draw instead of the normal one:

  
  
  
void setup(){  
ofAddListener(ofEvents.draw,this,&testApp:draw);  
}  
  
void draw(){  
//this is empty  
}  
  
void draw(ofEventArgs & args){  
//draw here  
}  

the events are FIFO so everything will be drawn in the order you add the listeners

Excellent idea. Thanks.

On the other hand, that might be a bit problematic. I’m writing a library that does a bunch of custom drawing, and the idea is that the user of the library can draw on top of it with the standard draw function. Doing what you suggest would mean that the user of the library would have to add the extra line of code to the setup routine (the library wouldn’t know the name of the testApp class, were it to change) as well as the extra draw function, which would compromise the ‘it just works’ approach of the library.