Using an FBO to solve an 'augmented reality' visualization problem

Hey folks! I’m currently working on an HUD display simulator for an auto company and using OF. I am generating one vector-based visualization to make the driver aware of potential hazards behind their vehicle and a secondary one that would overlay similar awareness type graphics onto the actual environment if those hazards were to move to the front of the vehicle. Some of the transitions between rear-view and front-view can actually be solved within OpenGL, but it’s getting the point where I think I might benefit from an FBO for rendering and clipping the vector-based graphics along both views as they pass from one plane to the next. Does anyone have any experience with this kind of problem?

For starters I would like to simply be able to clip vector-based graphics which exceed a circular boundary. Seems like creating an FBO to contain those graphics, and then clipping it in a circular shape would be a start. I’ve looked through the documentation, but am not sure how that is done. Any ideas?

I found my solution for the circular FBO. Had to be a little cautious with vertex winding, but binded a series of GL_TRIANGLES that form the outline of an ellipse, and it’s working great.

frontalHazardElements.getTextureReference().bind();

for (int i = 0; i < hudBoundaryPoints.size(); i++) {

glBegin(GL_TRIANGLES);
glNormal3f(0.0f,0.0f,1.0f);

glTexCoord2f(hudBoundaryPoints[i].x + ofGetWidth()/2.0,
hudBoundaryPoints[i].y + ofGetHeight()/2.0);
glVertex3f(hudBoundaryPoints[i].x + ofGetWidth()/2.0,
hudBoundaryPoints[i].y + ofGetHeight()/2.0,
hudBoundaryPoints[i].z);

glTexCoord2f(ofGetWidth()/2.0, ofGetHeight()/2.0);
glVertex3f(ofGetWidth()/2.0, ofGetHeight()/2.0, 0);

glTexCoord2f(hudBoundaryPoints[i+1].x + ofGetWidth()/2.0,
hudBoundaryPoints[i+1].y + ofGetHeight()/2.0);
glVertex3f(hudBoundaryPoints[i+1].x + ofGetWidth()/2.0,
hudBoundaryPoints[i+1].y + ofGetHeight()/2.0,
hudBoundaryPoints[i+1].z);

//final triangle of the ellipse
if (i == (hudBoundaryPoints.size()-2)) {

glVertex3f(hudBoundaryPoints[i+1].x + ofGetWidth()/2.0,
hudBoundaryPoints[i+1].y + ofGetHeight()/2.0,
hudBoundaryPoints[i+1].z);

glTexCoord2f(ofGetWidth()/2.0, ofGetHeight()/2.0);
glVertex3f(ofGetWidth()/2.0, ofGetHeight()/2.0, 0);

glTexCoord2f(hudBoundaryPoints[0].x + ofGetWidth()/2.0,
hudBoundaryPoints[0].y + ofGetHeight()/2.0);
glVertex3f(hudBoundaryPoints[0].x + ofGetWidth()/2.0,
hudBoundaryPoints[0].y + ofGetHeight()/2.0,
hudBoundaryPoints[0].z);

}

glEnd();

}

frontalHazardElements.getTextureReference().unbind();