Vector<vector<ofBoxPrimitive> > box3;

hi… i am trying to do a 3x3 cube…but i am crashing…
i write in this way

void ofApp::setup(){

   box3.resize(9);
    for(unsigned int i=0; i<3; i++){
            for(int j=0; j<3; j++){
                box3[i][j].set(100);

            }
    }    }


void ofApp::draw(){
ofBackgroundGradient(120, 80);

cam.begin();

   for( int i=0; i<3; i++){
            for(int j=0; j<3; j++){
            ofPushMatrix();
                ofTranslate(-100, 0, -100);
                box3[i][j].setPosition((i*size.x)*offSet,0 ,(j*size.z)*offSet);
                ofSetColor(0, 0, 255, 200);
                box3[i][j].drawWireframe();
            ofPopMatrix();
            }
    }
cam.end();

}

what 's wrong…?

thanks…

Ciso, you should be crashing in this line

As you are resizing in:

box3.resize(9);

You end with 9 empty vectors of ofBoxPrimitive. Thee variable j is pointing to an out of bounds index in those empty vectors.

ok… thanks i will check it…

solution:
box3.resize(3, std::vector(3));
thanks

Exactly, now you have 3 vectors with 3 slots each.