box2d with image

im start working with OF and box2d library, and have a quastion. For example, i have my ofxBox2dCircle circle, and ofImage myimage; with some image. In processing i’m simply set
beginShape();
texture(img);
vertex(-13, -13, 0, 0,0);
vertex(13, -13, 0, img.width, 0);
vertex(13, 13, 0, img.width, img.height);
vertex(-13, 13, 0, 0, img.height);

endShape();

how can i do something like with OF

ok, i made it this way ,
myimage.draw(circles[i].getPosition().x-20,circles[i].getPosition().y-20,myimage.getHeight()/4, myimage.getWidth()/4);

but my image dont rotate, how can i do it?

you want to wrap the draw in ofPush/Pop Matrix
http://www.openframeworks.cc/documentation/graphics/ofGraphics.html#show-ofPushMatrix

Just coding in the browser but it should be something like this:

  
ofPushMatrix();  
  ofTranslate(circles.getPosition().x, circles.getPosition().y, 0);  
  ofRotate(circles.getRotation());  
  myImage.setAnchorPercent(0.5, 0.5);  
  myImage.draw(0, 0);   
ofPopMatrix();  

you can also use an ofMesh to get something like what you were posting in the first example:

  
  
// testApp.h  
ofMesh mesh;  
  
// testApp.cpp  
  
void testApp::setup(){  
    mesh.addVertex(ofVec3f(-13, -13, 0));  
    mesh.addVertex(ofVec3f(13, -13, 0));  
    mesh.addVertex(ofVec3f(13, 13, 0));  
    mesh.addVertex(ofVec3f(-13, 13, 0));  
    mesh.addTexCoord(ofVec2f(0,0));  
    mesh.addTexCoord(ofVec2f(img.getWidth(), 0));  
    mesh.addTexCoord(ofVec2f(img.getWidth(), img.getHeight()));  
    mesh.addTexCoord(ofVec2f(0, getHeight()));  
    ....  
}  
  
  
void testApp::update(){  
    //modify the vertices of the quad to draw them in a different position...  
    mesh.setVertex(0,ofVec3f(....));  
    mesh.setVertex(1,ofVec3f(....));  
    mesh.setVertex(2,ofVec3f(....));  
    mesh.setVertex(3,ofVec3f(....));  
}  
  
void testApp::draw(){  
    image.bind()  
    mesh.draw();  
    image.unbind();  
}  
  

yeah))) thanks) working, and have one more question. How can i destroy my box2d obj when it cross the screen (fall down out)?

okey, i can check ofxBox2dCircle[i] (for exm) position.y and ofxBox2dCircle.destroy() if it is more than my screen. But here i have such problem, my image that i atach to box2d obj is still in the scene with 0 0 coord. and error [error] ofxBox2dBaseShape:: - body is not defined . How can i fixed thith, end delete my image to?

to destroy box2d body you can try this:

  
  
ofxBox2d world;  
ofxBox2dCircle myCircle;  
  
world->getWorld()->DestroyBody(myCircle.body);  
  
  

if it is array:

  
  
ofxBox2d world;  
vector<ofxBox2dCircle> myCircles;  
  
for (int i =0; i<thorns.size(); i++) {  
        world->getWorld()->DestroyBody(myCircles[i].body);  
    }  
myCircles.clear();