draw part of the video to a certain area of the canvas

Basically, I want to draw part of the video to a certain area of the canvas.

firstly, I will do:
textureName.draw(0,0,ofGetWidth(),ofGetHeight());

But instead of drawing the entire texture on the screen, I want to draw only a certain area, say: within the rectangle of (0,0),(80,80), the texture is visible. Otherwise the texture is invisible.

How can I do it?

Thanks ahead for any advice!

There are several ways to do that. One would be to draw the videoTexture into a FBO of the preferred size and then draw that FBO to the screen. … Search for FBO in the forum.

m9d

The easiest way IMO is to make a textured quad where the texture coordinates are are set such that the texture is effectively cropped.

something like this:

  
  
texture.bind();  
glBegin(GL_QUADS);  
glTexCoord2f(0,0);  
glVertex2f(0,0);  
  
glTexCoord2f(80,0);  
glVertex2f(80,0);  
  
glTexCoord2f(80,80);  
glVertex2f(80,80);  
  
glTexCoord2f(0,80);  
glVertex2f(0,80);  
  
glEnd();