Is there an openframeworks function that can do image-rectification on an ofMesh or plane do i need to use ofxPimapper of similar?
Related to my earlier post:
Is there an openframeworks function that can do image-rectification on an ofMesh or plane do i need to use ofxPimapper of similar?
Related to my earlier post:
What I do is
texture = fbo.getTexture();
)texture.draw(corners[0], corners[1], corners[2], corners[3]);
Where my corners is originally set up to be the screen corners in setup like this:
corners.resize(4);
corners[0] = glm::vec3(0, 0, 0);
corners[1] = glm::vec3(640, 0, 0);
corners[2] = glm::vec3(640, 360, 0);
corners[3] = glm::vec3(0, 360, 0);
And then, I have this piece of code in my keyPressed.
void ofApp::keyPressed(int key){
if(calibrating){
switch (key) {
case '1':
selectedCorner = 0;
break;
case '2':
selectedCorner = 1;
break;
case '3':
selectedCorner = 2;
break;
case '4':
selectedCorner = 3;
break;
case OF_KEY_UP:
corners[selectedCorner].y--;
break;
case OF_KEY_DOWN:
corners[selectedCorner].y++;
break;
case OF_KEY_LEFT:
corners[selectedCorner].x--;
break;
case OF_KEY_RIGHT:
corners[selectedCorner].x++;
break;
case ' ':
calibrating = !calibrating;
break;
}
} else {
if (key == ' ' ) calibrating = true;
}
}
Could also move them in z if I so wanted (and had setup key commands for it). I also have some extra things being drawn on the corners if calibrating == true
.
Don’t know if this is the most elegant solution out there, but it definitely works.
I’m still getting the quad warping with this method though. Should I be “disabling arb tex” or something, or setting resolution of my texture somehow?
Hmm, I just looked at your original questions (the other thread) - I’m not sure exactly what’s going on there. Just a guess, is the order of your triangles correct? When setting up tris, doesn’t texcoordinates also need to be set up?