How to generate meshes/models from points in FBO/image?

I’m trying to use a set of 2D pixels (generated in an FBO) to build a 3D heightmap mesh/model, but am having trouble figuring out how to do it correctly. I’m a bit confused about what the current “right” way to to generate meshes is, and am struggling a bit to find guides and resources online.

I have found resources about using ofMesh, and have seen a couple people talk about using ofVBO, and even a few people talking about ofVBOMesh (which I’m really not sure how to use). There is also a quite old forum post hinting at using things such as ofTessellator or addons like ofxVCG or point-cloud processors, but I haven’t found any information about how these can be used.

The openFrameworks website has a guide on using ofMesh to generate meshes from images using ofMesh, but this method doesn’t produce fully-connected and enclosed models like what I’m looking to do. I’ve attached an image of a sample FBO image that I’m generating, along with a visual representation of what I’m trying to achieve from that FBO image (just found on Google).

From what I learned so far, it seems pretty easy to generate and add the vertices I want to an ofMesh object, but actually connecting these vertices to form a coherent mesh/model is confusing me a bit. So, I feel like what I’m trying to do is learn how to connect these vertices together correctly using indices, rather than just toss all the points into an add-on and hope for the best.

Any tips, guides, resources or advice on doing this would be greatly appreciated!

Jason if you are still looking to do that here is a way

fbo.begin();
/*draw stuff
	shader.begin();
	shader.setUniform1f("time", ofGetElapsedTimef());
	shader.setUniform2f("resolution", 200, 200);
	ofDrawRectangle(0, 0, 200, 200);
	shader.end();
*/
	fbo.end();
	ofPixels pix;
	fbo.readToPixels(pix);
	ofMesh mesh;
	float extrusion = 25.0;
	int w = 200;
	int h = 200;
	for (int x = 0;x < w;x++) {
		for (int y = 0; y < h; y++)
		{
			int index = (x*w)+y;
			ofFloatColor col(pix.getColor(index*3));
			mesh.addVertex(ofVec3f(x, y, ofMap(col.getBrightness(), 0, 1.0, 0, extrusion)));
			mesh.addColor(col.getBrightness());
		}
	}

	for (int y = 0; y<h - 1; y++) {
		for (int x = 0; x<w - 1; x++) {
			mesh.addIndex(x + y* w);               // 0
			mesh.addIndex((x + 1) + y* w);           // 1
			mesh.addIndex(x + (y + 1)* w);           // 10

			mesh.addIndex((x + 1) + y* w);           // 1
			mesh.addIndex((x + 1) + (y + 1)* w);       // 11
			mesh.addIndex(x + (y + 1)* w);           // 10
		}
	}

	ofSetColor(255, 255, 255);
	ofEnableDepthTest();
	mesh.draw();
	//fbo.draw(0,0);
	ofDisableDepthTest();`