Flip videograbber?

**Hello again!

How can I flip videograbber in openframeworks?

Cheers bassd**

You can use the ofxCvImage mirror like this…

  
  
colorImg = vidGrabber.getPixels();  
colorImg.mirror( flipVert, flipHoriz );  
  
  
  
//--------------------------------------------------------------------------------  
void ofxCvImage::mirror( bool bFlipVertically, bool bFlipHorizontally ) {  
	int flipMode = 0;  
  
	if( bFlipVertically && !bFlipHorizontally ) flipMode = 0;  
	else if( !bFlipVertically && bFlipHorizontally ) flipMode = 1;  
	else if( bFlipVertically && bFlipHorizontally ) flipMode = -1;  
	else return;  
  
	cvFlip( cvImage, cvImageTemp, flipMode );  
	swapTemp();  
}  

you can also just scale the video texture using negative values.

glScalef(-1, 1); // flipping horizontally
glScalef(1, -1); // flipping vertically
glScalef(-1, -1);// if you’re hanging a screen upside down

it’s useful to keep the calls to scale within a new transformation matrix, by calling glPushMatrix and glPopMatrix. also, make sure to call translate before scale, otherwise, you’ll move the position of your video in the opposite direciton.

glPushMatrix();
glTranslate(30, 100);
glScalef(-1, 1);
video.draw(0, 0);
glPopMatrix();

jeremy

Thx a lot :slight_smile: