Is the space distortion app, that enables the viewer to change her mundane reality into a colorful, nauseous, inverted world.
The app is developed with Openframeworks platform, using the Virtual Reality glasses set.
Link:
https://youtu.be/R8oeeZt4Fgo
Source Code:
Main.cpp
#include "ofMain.h"
#include "ofApp.h"
//========================================================================
int main( ){
ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
ofRunApp(new ofApp());
}
ofApp.h
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
cam.setup(960,720); //960,720
//cam.setup(720,360);
//Fill the table by random values from 0 to 255
for ( int i=0; i<16; i++ ) {
table[i] = ofRandom( 0, 255 );
}
}
//--------------------------------------------------------------
void ofApp::update(){
cam.update();
//Do computing only if a new frame was obtained
if ( cam.isFrameNew() ) {
//Getting pixels
ofPixels pixels = cam.getPixelsRef();
//Scan all the pixels
for (int y=0; y<pixels.getHeight(); y++) {
for (int x=0; x<pixels.getWidth(); x++) {
//Getting pixel (x,y) color
ofColor col = pixels.getColor( x, y );
//Change color components of col
//using table
col.r = table [ col.r/10];
col.g = table [ col.g/8];
col.b = table [ col.b/24];
//Set the color back to the pixel (x,y)
pixels.setColor( x, y, col );
}
}
//Set pixel array to the image
image.setFromPixels( pixels );
}
}
//--------------------------------------------------------------
void ofApp::draw(){
image.draw(0,0);
image.draw(960,0);
ofBackground( 0,0,0 ); //Set white background
//Draw the image
ofSetColor( 255, 255, 255 );
image.draw(0,0);
image.draw(700,0);
}
ofApp.h
#pragma once
#include "ofMain.h"
;
class ofApp : 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 mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofVideoGrabber cam;
ofImage image;
int table[16];
};