Skip to content

Instantly share code, notes, and snippets.

@benben
Created July 10, 2012 15:39
Show Gist options
  • Save benben/3084194 to your computer and use it in GitHub Desktop.
Save benben/3084194 to your computer and use it in GitHub Desktop.
class Quad : public ofNode {
public:
Quad(float x, float y, float z, float width, float height, float depth) {
myMesh.addVertex(ofVec3f(x+width,y,z));
myMesh.addVertex(ofVec3f(x+width,y,z-depth));
myMesh.addVertex(ofVec3f(x,y,z-depth));
myMesh.addVertex(ofVec3f(x,y,z));
myMesh.addVertex(ofVec3f(x+width,y+height,z));
myMesh.addVertex(ofVec3f(x+width,y+height,z-depth));
myMesh.addVertex(ofVec3f(x,y+height,z-depth));
myMesh.addVertex(ofVec3f(x,y+height,z));
myMesh.addTriangle(0, 1, 2);
myMesh.addTriangle(2, 3, 0);
myMesh.addTriangle(4, 5, 6);
myMesh.addTriangle(6, 7, 4);
myMesh.addTriangle(0, 4, 5);
myMesh.addTriangle(0, 1, 5);
myMesh.addTriangle(1, 5, 6);
myMesh.addTriangle(1, 2, 6);
myMesh.addTriangle(2, 3, 6);
myMesh.addTriangle(3, 6, 7);
myMesh.addTriangle(3, 0, 4);
myMesh.addTriangle(3, 7, 4);
}
void customDraw() {
//myMesh.drawWireframe();
ofFill();
//not working
myMesh.drawFaces();
}
private:
ofMesh myMesh;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment