Skip to content

Instantly share code, notes, and snippets.

@kylemcdonald
Last active December 24, 2015 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylemcdonald/6878847 to your computer and use it in GitHub Desktop.
Save kylemcdonald/6878847 to your computer and use it in GitHub Desktop.
Render the video stream in a sphere.
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
ofVideoGrabber video;
ofEasyCam cam;
ofSpherePrimitive sphere;
void setup() {
sphere.set(1000, 10);
video.initGrabber(1280, 720);
sphere.mapTexCoordsFromTexture(video.getTextureReference());
}
void update() {
video.update();
}
void draw() {
ofEnableDepthTest();
cam.begin();
video.getTextureReference().bind();
sphere.draw();
video.getTextureReference().unbind();
cam.end();
}
};
int main() {
ofSetupOpenGL(1280, 720, OF_WINDOW);
ofRunApp(new ofApp());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment