Sketch 2015-05-16
void ofApp::setupAnim() {
ofDisableArbTex();
setupImage("building.png", &img, &tex);
plane.set(width, height);
plane.setPosition(width * 0.5, height * 0.5, 0);
plane.setResolution(2, 2);
}
void ofApp::drawAnim() {
ofBackground(0, 0, 0);
ofSetColor(255, 255, 255);
ofEnableBlendMode(OF_BLENDMODE_ADD);
drawLayers();
rotateScreen(90);
drawLayers();
rotateScreen(90);
drawLayers();
rotateScreen(90);
drawLayers();
ofDisableBlendMode();
if(ofGetFrameNum() == 200) renderGif();
}
void ofApp::drawLayers() {
tx0 = -0.4;
ty0 = ofGetFrameNum() * 0.01;
tx1 = tx0 + 1;
ty1 = ty0 + 0.25;
drawLayer();
ty0 = -ofGetFrameNum() * 0.01;
ty1 = ty0 + 0.25;
drawLayer();
}
void ofApp::drawLayer() {
plane.mapTexCoords(tx0, ty0, tx1, ty1);
plane.mapTexCoords(tx1, ty1, tx0, ty0);
tex.bind();
plane.draw();
tex.unbind();
}
void ofApp::setupImage(string file, ofImage *img, ofTexture *tex) {
img->loadImage(file);
*tex = img->getTextureReference();
tex->setTextureWrap(GL_MIRRORED_REPEAT, GL_MIRRORED_REPEAT);
}
void ofApp::rotateScreen(float degrees) {
ofTranslate(halfWidth, halfHeight, 0);
ofRotate(90);
ofTranslate(-halfWidth, -halfHeight, 0);
}
Framing nothing.