Permalink
Browse files

updated readme

  • Loading branch information...
1 parent a6ab8cd commit 620d2b9ddc8776af8dc6b9a5462e33b6d1080a18 Peter Nitsch committed Jul 25, 2012
Showing with 39 additions and 2 deletions.
  1. +34 −0 README.md
  2. +1 −1 example/src/main.cpp
  3. +3 −1 example/src/testApp.cpp
  4. +1 −0 example/src/testApp.h
View
@@ -0,0 +1,34 @@
+
+# ofxAsciiArt - Real-time ASCII Art filter for oF.
+
+This add-on was inspired by Sol's work with [TextFX](http://sol.gfxile.net/textfx/index.html), the major difference being ofxAsciiArt runs on the GPU. Font data and LUT creation were taken from TextFX.
+
+## Sample Usage
+
+.h:
+
+ ofxAsciiArt asciiArt;
+
+.cpp:
+
+ void testApp::setup(){
+ ofDisableArbTex();
+
+ vidGrabber.initGrabber(512, 512, true);
+
+ asciiArt.init(vidGrabber.getTextureReference(), ofGetWidth(), ofGetHeight());
+ }
+
+ void testApp::update(){
+ ofBackground(0);
+
+ vidGrabber.grabFrame();
+
+ asciiArt.setContrast(contrast_slider.getValue());
+ asciiArt.setColorDepth(depth_slider.getValue());
+ asciiArt.update();
+ }
+
+ void testApp::draw(){
+ asciiArt.draw((ofGetWidth() - asciiArt.getWidth())/2, (ofGetHeight() - asciiArt.getHeight())/2);
+ }
View
@@ -5,6 +5,6 @@
int main(){
ofAppGlutWindow window; // create a window
// set width, height, mode (OF_WINDOW or OF_FULLSCREEN)
- ofSetupOpenGL(&window, 1024, 768, OF_WINDOW);
+ ofSetupOpenGL(&window, 680, 400, OF_WINDOW);
ofRunApp(new testApp()); // start the app
}
View
@@ -5,6 +5,7 @@ void testApp::setup(){
ofDisableArbTex();
ofSetFrameRate(24);
+ draw_gui = true;
gui.setup("controls", 0, 0);
gui.add(contrast_slider.setup("contrast", 1.0, -100.0, 100.0, true));
gui.add(depth_slider.setup("color depth", 8.0, 1.0, 24.0, true));
@@ -39,7 +40,7 @@ void testApp::draw(){
ofSetColor(255);
asciiArt.draw((ofGetWidth() - asciiArt.getWidth())/2, (ofGetHeight() - asciiArt.getHeight())/2);
- gui.draw();
+ if(draw_gui) gui.draw();
}
//--------------------------------------------------------------
@@ -50,5 +51,6 @@ void testApp::keyPressed(int key){
case '1': asciiArt.setMode(ASCII_MODE_COLOR); break;
case '2': asciiArt.setMode(ASCII_MODE_GREEN); break;
case '3': asciiArt.setMode(ASCII_MODE_GRAY); break;
+ case ' ': draw_gui = !draw_gui; break;
}
}
View
@@ -13,6 +13,7 @@ class testApp : public ofBaseApp{
void keyPressed(int key);
+ bool draw_gui;
ofPanel gui;
ofSlider contrast_slider;
ofSlider depth_slider;

0 comments on commit 620d2b9

Please sign in to comment.