thanks for the help @zach and @eight! I realized that I'm actually not familiar enough with pointers and reference to be diving into that area. I took the & out and changed a couple parameters. Instead of having:
ofVec3f getVertexForming(ofImage& img, int x, int y);
i changed it to:
ofVec3f getVertexForming(int x, int y);
It somehow struck me that I didn't need to use an image to create the points on which the mesh will be based on. With this in mind, i changed that section of the code to: (IMAGESIZE is simply 1000 ~ all my images are 1000x1000, MAXIMAGES is still set to 5)
ofVec3f ofApp::getVertexForming(int x, int y) {
ofColor color = img[MAXIMAGES].getColor(x, y);
if(color.a > 0) {
float z = ofMap(color.a, 0, 255, -480, 480);
return ofVec3f(x - IMAGESIZE / 2, y - IMAGESIZE / 2, z);
}else {
return ofVec3f(0, 0, 0);
}
the issue that I am running into now is cycling through the array. I currently have
img[int(ofRandom(0,4))].bind
what happens from this is that my mesh cycles through the entire array on it's own. Any thoughts on how I can change the image on my mesh one by one on click? I know that ofMesh has a mesh.update() function but vboMesh does not seem to have any.
Thank you very much for being so patient with me. I'm relatively new to C++ and still trying to learn as I go.