Hey all,
I’d like to create a 3d scene and put two different cameras in the scene, rotated 90 degrees apart (but otherwise at the same location).
Right now I’m pu
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
fNear = 0.5f;
//fFov = tan(30 * PI / 360);
fFov = tan(90 * PI / 360.0 );
float ratio = ofGetWidth() / ofGetHeight();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(fNear*(-fFov * ratio + mCameraDirection[0]),
fNear*(fFov * ratio + mCameraDirection[0]),
fNear*(-fFov + mCameraDirection[1]),
fNear*(fFov + mCameraDirection[1]),
fNear, mHorizonDistance);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(mCameraDirection[0]*mCameraDirection[2],
mCameraDirection[1]*mCameraDirection[2],
0,
mCameraDirection[0]*mCameraDirection[2],
mCameraDirection[1]*mCameraDirection[2],
-1,
0,
1,
0);
glTranslatef(mPosition[0], mPosition[1], mPosition[2]);
/***********
* DRAW SCENE
************/
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
And that works fine. However, I’d like to add a second camera and I’m not sure how. The ‘obvious’ way seems to be to put the above in a fbo, and then draw the scene again in a different fbo with different parameters for mCameraDirection
and mCameraPosition
– however, that requires me to draw the same scene twice. Is there a way to draw the scene once and put multiple camera angles into different fbos, or do I need to actually draw the scene twice?
thanks!