# camera perpendicular plane

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

``````
• 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 = camera.getPosition() + m*m + m*m + m*m;
res = camera.getPosition() + m*m + m*m + m*m;
res = camera.getPosition() + m*m + m*m + m*m;

movie.draw(camera.getPosition() - pos - 800,  180, ofGetWidth(), -ofGetHeight());

``````

any help would be really appreciated all the best,
–k

Hi,
If you just want to draw a fullscreen quad with a texture over/behind a 3D scene, it’s simplest to use orthographic projection. Something like:

``````
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glOrtho(-1., 1., -1., 1., -100, 100);

glMatrixMode(GL_MODELVIEW);
glPushMatrix();

// draw

glMatrixMode(GL_PROJECTION);
glPopMatrix();

glMatrixMode(GL_MODELVIEW);
glPopMatrix();

``````

The above will make the coordinates system go from [-1, 1] x [-1,1].

there is a very simple solution to this but it might not be the fastest. call ofSetupScreen() just before you draw your background. this will reset the screen coordinates to the original values used in OF and you can draw normally like you would in 2d.

hi.

Thank you very much, guys.

Othersides’ solution worked like a charm thanks again,
–k