Background Image in openFrameworks app

I have an openFrameworks program in which I am trying to set a background image inside the draw method.
I stumbled upon how processing handles this and it is done by passing the image to the Background(img). Perhaps, there isn’t an analogus overload with openFrameworks ofBackground.

If I try to draw the image (loaded in setup: bgImage.loadImage(“bg.png”)), and draw it everytime in the draw function, the background comes over everything else.

  
bgImage.draw(0,0);  
//Ohter stuff drawn here  

Also, disabling the openGL depth doesn’t help either.

  
ofPushStyle();  
glDisbale(GL_DEPTH_TEST);  
bgImage.draw(0,0);  
glEnable(GL_DEPTH_TEST);  
ofPopStyle();  

How do I get the background image (format that I have here for the bg image is png)

i think you need to do something like that:

glPolygonMode (GL_BACK,GL_FILL);
backgoundimage.draw(0,0);

glPolygonMode (GL_FRONT, GL_FILL);
imagefront.draw(10,10);

If you disable the depth testing and draw the background image before everything else, it should remain behind all other elements… However, perhaps you mean that you are trying to reproduce the effect of layering up over time ( quite typical in Processing) and so not clearing the background every frame. In this case you would need to call ofSetBackgroundAuto(false) in the setup.

i have also found while i was googling for Qt and OFintegration this:
http://xinyustudio.wordpress.com/2012/06/06/c-show-full-screen-images-in-a-ui-part-ii-using-openframework/
since i’haven’t tested yet i can’t say anything . only one thing in my opinion this:

  
 class FullScreenApp : public Application   

should be instead :

  
class FullScreenApp : public ofBaseApp