A simple warp tool

Hello,

Im new to OF and i wanna make a simple warp tool for a movie.

Can someone help me with this code? i can not bind the movie and i want more then 4 points.

void testApp::setup(){
ofBackground(0);
ofSetVerticalSync(true);
ofSetBackgroundAuto(false);
ofSetFrameRate(60);
v.push_back(ofPoint(0,0));
v.push_back(ofPoint(200,0));
v.push_back(ofPoint(200,200));
v.push_back(ofPoint(0,200));
t=v;

mov.loadMovie(“movies/test.mov”);
mov.stop();
}

//--------------------------------------------------------------
void testApp::update(){
mov.update();
}

//--------------------------------------------------------------
void testApp::draw(){

mov.draw(x,y);

if (mov.isFrameNew()) {
x = x + mov.getWidth();

if (x>ofGetWidth()) {
x = 0;
y = y + mov.getHeight();
}

if (y>ofGetHeight()) {
x = 0;
y = 0;
}
}

glBegin(GL_QUADS);

for (int i=0; i<4; i++) {
glTexCoord2f(t[i].x,t[i].y);
glVertex2f(v[i].x,v[i].y);
}
glEnd();
for (int i=0; i<4; i++) {
ofSetColor(255,0,0);
ofCircle(v[i],6);
ofSetColor(255,255,0);
ofCircle(t[i],3);
}

}

I have simular addons on github

http://www.github.com/fishkingsin/ofxRenderManager

you can check the code for you simple purpose

  
  
getTextureReference().bind();  
	  
    for (int y = 0; y < gridSizeY-1; y++)  
    {  
        for (int x = 0; x < gridSizeX-1; x++)  
        {  
  
            glBegin(GL_QUADS);  
  
            int pt0 = x + y*gridSizeX;  
            int pt1 = (x+1) + y*gridSizeX;  
            int pt2 = (x+1) + (y+1)*gridSizeX;  
            int pt3 = x + (y+1)*gridSizeX;  
  
  
			glTexCoord2f(coor[pt0].x, coor[pt0].y );  
			glVertex2f(  grid[pt0].x, grid[pt0].y);  
  
			glTexCoord2f(coor[pt1].x, coor[pt1].y );  
			glVertex2f(  grid[pt1].x, grid[pt1].y);  
  
			glTexCoord2f(coor[pt2].x, coor[pt2].y );  
			glVertex2f(  grid[pt2].x, grid[pt2].y);  
  
			glTexCoord2f(coor[pt3].x, coor[pt3].y );  
			glVertex2f(  grid[pt3].x, grid[pt3].y);  
  
            glEnd();  
  
        }  
    }  
	getTextureReference().unbind();  
  

Thank you!

I tried the example but i got a error:

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

Do you know what i can do?

And is it possible to combine the alphaMaskingShaderExample and the tool?

i use a lot this great class from patricio to do quad warp and masking, maybe its what you need.

https://github.com/patriciogonzalezvivo/ofxInteractiveSurface/blob/master/src/ofxInteractiveViewPort.h
https://github.com/patriciogonzalezvivo/ofxInteractiveSurface/blob/master/src/ofxInteractiveViewPort.cpp

you need to also clone the dependencies

What do you mean by cloning dependencies? How can i do that?

down load
http://www.github.com/fishkingsin/ofxDraggable
and
http://www.github.com/memo/ofxMSAInteractiveObject