Hi All,
Below is the draw function from my big screen AR application that I am currently working on. It has again exposed my lack of OpenGL knowledge.
void testApp::draw(){
ofSetColor(0xffffff);
grabber.draw(0, 0, ofGetWidth(), ofGetHeight());
//this is where we use the calculated matrix from ARToolkitPlus to put
//in our graphics at the location and orientation of the marker.
//- the matrix has the 0,0 point as the center of the marker.
int numDetected = tracker->getNumDetectedMarkers();
//cout<<"numberofmarkers:"<<numDetected<<endl;
//glViewport(0, 0, 640, 480 );
glViewport(0,0,ofGetWidth(), ofGetHeight());
glMatrixMode( GL_PROJECTION );
glLoadMatrixf(tracker->getProjectionMatrix());
for(int i=0; i<numDetected; i++)
{
ARToolKitPlus::ARMarkerInfo marker = tracker->getDetectedMarker(i);
float m34[ 3 ][ 4 ];
float c[ 2 ] = { 0.0f, 0.0f };
float w = 40.0f;
tracker->rppGetTransMat( &marker, c, w, m34 );
float m[ 16 ]; //this is some crazy matrix transformative stuff. I think initially it came out of one of the arToolkit functions.... but i got it from here: [http://chihara.naist.jp/people/STAFF/imura/computer/OpenGL/artp/disp-content](http://chihara.naist.jp/people/STAFF/imura/computer/OpenGL/artp/disp-content)
for ( int i = 0; i < 3; i++ ) {
for ( int j = 0; j < 4; j++ ) {
m[ j * 4 + i ] = m34[ i ][ j ];
}
}
for ( int j = 0; j < 3; j++ ) {
m[ j * 4 + 3 ] = 0.0f;
}
m[ 3 * 4 + 3 ] = 1.0f;
glMatrixMode( GL_MODELVIEW );
glLoadMatrixf( m );
// glPushMatrix();
// glRotatef(-90, 0, 0, 1);
// ofSetColor(255 , 255, 255 );
// grabber.draw(-30,-20,60,40);
// glPopMatrix();
glPushMatrix();
//glRotatef(-90, 1, 0, 0); //just taking out rotations to be consitent
glRotatef(-180, 1, 0, 0);
//glRotatef(-180, 0, 1, 0);
glRotatef(-180, 0, 0, 1);
ofSetColor(255 , 255, 255 );
//idNumb.drawString(ofToString(marker.id), -idNumb.stringWidth(ofToString(marker.id))/2,0);
glTranslatef(0,75,0);
glEnable (GL_DEPTH_TEST);
heads[currentHead]->draw();
glDisable(GL_DEPTH_TEST);
glPopMatrix();
}
screen.grabScreen(0,0, ofGetWidth(), ofGetHeight());
screenImageToFlip.setFromPixels(screen.getPixels(), screen.getWidth(), screen.getHeight());
screenImageToFlip.mirror(true, false);
screenImageToFlip.draw(0,0);
}
This produces the following result:
[attachment=0:mqyt7ekw]wierd.jpg[/attachment:mqyt7ekw]
I want to redraw the flipped/mirrored image so that when displayed on a big screen, everything feels a bit more natural for the viewer.
How to I get rid of the tranformation and get back to 0,0 being the top left of the screen proper?
Cheers,
JGL