/********** update mesh部分***********/
for(int i=0;i<4;i++)
{
mesh[i].clear(); //重要,不加的话,移动视频的四个角出现视频的重叠
mesh[i].addVertex(ofPoint(point[i][0]->x,point[i][0]->y));
mesh[i].addVertex(ofPoint(point[i][1]->x,point[i][1]->y));
mesh[i].addVertex(ofPoint(point[i][2]->x,point[i][2]->y));
mesh[i].addTexCoord(ofPoint(0,0));
mesh[i].addTexCoord(ofPoint(LRatio,0));
mesh[i].addTexCoord(ofPoint(0,WRatio));
mesh[i].addVertex(ofPoint(point[i][1]->x,point[i][1]->y));
mesh[i].addVertex(ofPoint(point[i][2]->x,point[i][2]->y));
mesh[i].addVertex(ofPoint(point[i][3]->x,point[i][3]->y));
mesh[i].addTexCoord(ofPoint(LRatio,0));
mesh[i].addTexCoord(ofPoint(0,WRatio));
mesh[i].addTexCoord(ofPoint(LRatio,WRatio));
}
/********** draw()部分***********/
ofBackground(ofColor::black); //背景设成黑色,需要投影播放
ofSetColor(ofColor::white);
fbo.begin();//整体渲染的开始
ofPushMatrix();
ofClear(255); //重要,消除移动时留下重影
ofTranslate(ofGetWindowWidth()*0.5,ofGetWindowHeight()*0.5);
ofRotate(holisticRotate); //整体的旋转
ofScale(holisticScale->x,holisticScale->y); //整体的放大缩小
ofTranslate(holisticPos->x,holisticPos->y); //整体的上下左右移动
for (int i=0;i<4;i++) //分别对四个视频进行相关的操作
{
ofPushMatrix();
ofTranslate(m_video[i].width/2,m_video[i].height/2);
ofRotate(rotatePos[i]); //360度旋转
ofScale(scalePos[i]->x,scalePos[i]->y); //上下左右反转
ofTranslate(m_videoPos[i]->x,m_videoPos[i]->y);
m_video[i].bind(); //绑定视频
mesh[i].draw();
m_video[i].unbind(); //解除绑定
//mesh[i].drawWireframe(); //画边线,不去除在视频中会出现对角线
ofPopMatrix();
}
ofPopMatrix();
fbo.end();//整体渲染的结束
fbo.getTexture().bind();
_mesh.draw();
fbo.getTexture().unbind();
_mesh.clear(); //重要,消除整体移动时的重影