Hi all,
I’m kinda stuck with a very simple problem and I’d like to ask for help…
I’m using the ofx3D lib to move the camera around, but sometimes I need to draw a fullscreen video as background. Problem is that I can’t position it properly (the camera is orbiting around an axis).
What I’m doing is:
-first undo all rotations
glPushMatrix();
// get the current modelview matrix
glGetFloatv(GL_MODELVIEW_MATRIX , m);
// undo all rotations
// beware all scaling is lost as well
for( i=0; i<3; i++ )
for( j=0; j<3; j++ ) {
if ( i==j )
m[i*4+j] = 1.0;
else
m[i*4+j] = 0.0;
}
// set the modelview with no rotations
glLoadMatrixf(m);
- and secondly I try to position my camera at the correct place (i’ve been tweaking the values but my calculations ain’t rite).
ofxVec3f res = ofxVec3f();
res[0] = camera.getPosition()[0] + m[0]*m[12] + m[1]*m[13] + m[2]*m[14];
res[1] = camera.getPosition()[1] + m[4]*m[12] + m[5]*m[13] + m[6]*m[14];
res[2] = camera.getPosition()[2] + m[8]*m[12] + m[9]*m[13] + m[9]*m[14];
movie.draw(camera.getPosition()[0] - pos[0] - 800, 180, ofGetWidth(), -ofGetHeight());
any help would be really appreciated
all the best,
–k