Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Creating a pointer to a vector of Images

$
0
0

I'm working with openFrameworks to try and create a pointer to a vector of images that are stored in a class. I'm creating a sort of image sequence editor. There is a grid of images on one side and a viewer area on the other. A user can click on a grid cell containing a image sequence to display that in the viewer area.

In my GridElement header I have:

vector<ofImage> *getImages();

In my cpp file for GridElement I have:

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

This is a vector function to return a reference to the vector of images called images.

Then in my viewer class I am trying to access &images in order to display those images according to my viewer class.

I have done this with a for loop to load in all 15 instances of the object.

for(int i = 0; i < 15; i++){
    viewImages = grid[i].getImages();
    }

That shows up no errors. Then I modulo though my images using variable currentFrame which is just an integer that keeps count.

currentFrame = (currentFrame +1)%viewImages->size();
When I then come to draw it in my display function

viewImages[currentFrame].draw(504, 0);
This line doesn't work, error 'no member called draw'

Also tried to call it as a pointer but I get an error in Xcode saying it is not a pointer.

viewImages[currentFrame]->draw(504, 0);
Any suggestions would be greatly appreciated!


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>