Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////////////////////////////////////////// testApp.cpp
- #include "testApp.h"
- #include "ofAppGlutWindow.h"
- void testApp::setup() {
- babydj.loadImage("images/babydj.png");
- beer.loadImage("images/beer.png");
- brown.loadImage("images/brown.png");
- cunt1.loadImage("images/cunt1.png");
- dame.loadImage("images/dame.png");
- dope.loadImage("images/dope.png");
- dopeless.loadImage("images/dopeless.png");
- gtfo.loadImage("images/gtfo.png");
- pete.loadImage("images/pete.png");
- simons.loadImage("images/simons.png");
- data = new unsigned char[400*640*3];
- pix[0] = babydj.getPixels();
- pix[1] = beer.getPixels();
- pix[2] = brown.getPixels();
- pix[3] = cunt1.getPixels();
- pix[4] = dame.getPixels();
- pix[5] = dope.getPixels();
- pix[6] = dopeless.getPixels();
- pix[7] = gtfo.getPixels();
- pix[8] = pete.getPixels();
- pix[9] = simons.getPixels();
- tex.allocate(400,640, GL_RGB);
- counter = 0,0;
- pic = 0;
- }
- //------------------------------------------------------------
- void testApp::update(){
- ofBackground(255, 0, 0);
- alpha += 0.0011;
- if (alpha> 1) {
- pic++;
- alpha = 0.0;
- }
- switch(pic%10) {
- case 0: // ---- alpha blend
- int totalPixels = 640*400*3;
- for(int i= 0; i< totalPixels; i++) {
- data[i] = pix[(pic+1)%10] [i]* alpha + pix [(pic)%10] [i]*(1.0-alpha);
- }
- break;
- case 1: // ---- alpha blend
- for(int i= 0; i< totalPixels; i++) {
- data[i] = pix[(pic+1)%10] [i]* alpha + pix [(pic)%10] [i]*(1.0-alpha);
- }
- break;
- case 2: // --- no blend, just image stiwch
- for (int i = 0; i < totalPixels; i++){
- data[i] = pix[(pic+1)%10][i];
- }
- break;
- case 3: // ---- alpha blend
- for(int i= 0; i< totalPixels; i++) {
- data[i] = pix[(pic+1)%10] [i]* alpha + pix [(pic)%10] [i]*(1.0-alpha);
- }
- break;
- case 4: // ---- alpha blend
- for(int i= 0; i< totalPixels; i++) {
- data[i] = pix[(pic+1)%10] [i]* alpha + pix [(pic)%10] [i]*(1.0-alpha);
- }
- break;
- case 5: // ---- alpha blend
- for(int i= 0; i< totalPixels; i++) {
- data[i] = pix[(pic+1)%10] [i]* alpha + pix [(pic)%10] [i]*(1.0-alpha);
- }
- break;
- case 6: // ---- alpha blend
- for(int i= 0; i< totalPixels; i++) {
- data[i] = pix[(pic+1)%10] [i]* alpha + pix [(pic)%10] [i]*(1.0-alpha);
- }
- break;
- case 7: // ---- alpha blend
- for(int i= 0; i< totalPixels; i++) {
- data[i] = pix[(pic+1)%10] [i]* alpha + pix [(pic)%10] [i]*(1.0-alpha);
- }
- break;
- case 8: // ---- alpha blend
- for(int i= 0; i< totalPixels; i++) {
- data[i] = pix[(pic+1)%10] [i]* alpha + pix [(pic)%10] [i]*(1.0-alpha);
- }
- break;
- case 9: // ---- alpha blend
- for(int i= 0; i< totalPixels; i++) {
- data[i] = pix[(pic+1)%10] [i]* alpha + pix [(pic)%10] [i]*(1.0-alpha);
- }
- break;
- }
- tex.loadData(data, 400, 640, GL_RGB); }
- //--------------------------------------------------------------
- void testApp::draw(){
- ofSetColor(255);
- tex.draw(0,0, 400, 640);
- }
- //--------------------------------------------------------------
- void testApp::keyPressed(int key){
- }
- //--------------------------------------------------------------
- void testApp::keyReleased(int key){
- }
- //--------------------------------------------------------------
- void testApp::mouseMoved(int x, int y){
- }
- //--------------------------------------------------------------
- void testApp::mouseDragged(int x, int y, int button){
- }
- //--------------------------------------------------------------
- void testApp::mousePressed(int x, int y, int button){
- }
- //--------------------------------------------------------------
- void testApp::mouseReleased(int x, int y, int button){
- }
- //--------------------------------------------------------------
- void testApp::windowResized(int w, int h){
- }
- //--------------------------------------------------------------
- void testApp::gotMessage(ofMessage msg){
- }
- //--------------------------------------------------------------
- void testApp::dragEvent(ofDragInfo dragInfo){
- };
- /////////////////////////////////////////////////// testApp.h
- #pragma once
- #include "ofMain.h"
- class testApp : public ofBaseApp{
- public:
- void setup();
- void update();
- void draw();
- void keyPressed(int key);
- void keyReleased(int key);
- void mouseMoved(int x, int y);
- void mouseDragged(int x, int y, int button);
- void mousePressed(int x, int y, int button);
- void mouseReleased(int x, int y, int button);
- void windowResized(int w, int h);
- void dragEvent(ofDragInfo dragInfo);
- void gotMessage(ofMessage msg);
- ofImage babydj;
- ofImage beer;
- ofImage brown;
- ofImage cunt1;
- ofImage dame;
- ofImage dope;
- ofImage dopeless;
- ofImage gtfo;
- ofImage pete;
- ofImage simons;
- unsigned char* data;
- ofTexture tex;
- float alpha, counter;
- int pic;
- unsigned char* pix[10];
- };
Add Comment
Please, Sign In to add comment