Image section switcher

I’m working on a project were I section up multiple images into a grid. They are layered on top of each other. I want to have the ability to switch the section with a section behind. I am wanting to design a class ‘column’ to organise this switching so I can create a vector of this class to create the whole grid.

I think I should be able to use drawSubsection() to choose what section is displayed for each section. Would it be best to create it with shapes then texture map the image to the shape?

Here is a gif illustrating what I want to do:

Hope I’ve made myself clear. Any help would be greatly appreciated.
Thanks!

I got my solution by creating an Image bank class called Grid. This created a vector of images. It had a function inside that would return a reference for that vector of images.

vector<ofImage*> *Grid::getImages(){
    return &images;
}

Then in my ofApp.cpp I loaded the reference to the images along with some modulo maths to set the coordinates for each section. For new grid size 12x6.

 for(auto &sec: grid){
        for(int x = 0; x < 72; x++){
            for(int y = 0; y < 36; y++){
                imSec.push_back(Section(sec.getImages(), (x%12)*75, (y%6)*100));
            }
        }
    }

Then this is receved by the Section class.

In Section.cpp

Section::Section(vector<ofImage*>* imSection, int xPos, int yPos){
    //constructor takes in refrence to images and x, y positions for 
    //where the sections will be displayed.
    imagesSection = imSection;
    x = xPos;
    y = yPos;
    w = 75;
    h = 100;
    counter = true;
    //currentIndex set up randomly to begin with.
    currentIndex = ofRandom(0, 5);
}
void Section::display(){
    
    for (int i = 0; i< imagesSection->size(); i++) {
        vector<ofImage*> &imageRef = *imagesSection;
        //creating new reference imageRef through dereferenced pointer
        imageRef[currentIndex]->drawSubsection(x, y, w, h, x, y);
        //gets section and draws section at x, y position and width and height. 
    }
}

Clicking functionality added with incrementing and decrementing on the currentIndex

if(currentIndex < 5){
    currentIndex++;
} else{
    currentIndex = 0;
}

This was actioned in void ofApp::mousePressed(int x, int y, int button){

Left with result: (With different images)