Text particle with openframeworks


#1

hello
does anyone know that if it’s possible to use text as a single particle and create a particle system in openframeworks?
I want to create something similar like the matrix text but with more interaction between every letter/character just like in a particle system
i was looking into optical flow but have no idea what to start with
are there any addons worth checking out?


#2

Check out this example:

https://github.com/SAIC-ATS/ARTTECH-5010/tree/master/Week_09/ParticleText


#3

thank you but it’s failed to compile?
i’m using of 0.9.7 and osx 10.11


#4

What errors are you getting?


#5

i’m getting these

Build target ParticleText of project ParticleText with configuration Debug

CompileC /Users/apple/Library/Developer/Xcode/DerivedData/ParticleText-hcmkveqpbqbycsfrfhcnoztddyto/Build/Intermediates/ParticleText.build/Debug/ParticleText.build/Objects-normal/x86_64/ParticleGroupMember.o src/ParticleGroupMember.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/apple/Desktop/everything/openframeworks/of_v0.9.3_osx_release/apps/myApps/ParticleText
export LANG=en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c++11 -stdlib=libc++ -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wno-unused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Wno-invalid-offsetof -mmacosx-version-min=10.7 -g -mssse3 -Wno-sign-conversion -I/Users/apple/Library/Developer/Xcode/DerivedData/ParticleText-hcmkveqpbqbycsfrfhcnoztddyto/Build/Intermediates/ParticleText.build/Debug/ParticleText.build/ParticleTextDebug.hmap -I/Users/apple/Desktop/everything/openframeworks/of_v0.9.3_osx_release/apps/myApps/ParticleText/bin/include -I…/…/…/libs/openFrameworks -I…/…/…/libs/openFrameworks/.settings -I…/…/…/libs/openFrameworks/3d -I…/…/…/libs/openFrameworks/app -I…/…/…/libs/openFrameworks/communication -I…/…/…/libs/openFrameworks/events -I…/…/…/libs/openFrameworks/gl -I…/…/…/libs/openFrameworks/graphics -I…/…/…/libs/openFrameworks/math -I…/…/…/libs/openFrameworks/sound -I…/…/…/libs/openFrameworks/types -I…/…/…/libs/openFrameworks/utils -I…/…/…/libs/openFrameworks/video -I…/…/…/libs/poco/include -I…/…/…/libs/freetype/include -I…/…/…/libs/freetype/include/freetype2 -I…/…/…/libs/fmodex/include -I…/…/…/libs/glew/include -I…/…/…/libs/FreeImage/include -I…/…/…/libs/tess2/include -I…/…/…/libs/cairo/include/cairo -I…/…/…/libs/rtAudio/include -I…/…/…/libs/glfw/include -I…/…/…/libs/boost/include -I…/…/…/libs/utf8cpp/include -I…/…/…/libs/openssl/include -Isrc -I/Users/apple/Library/Developer/Xcode/DerivedData/ParticleText-hcmkveqpbqbycsfrfhcnoztddyto/Build/Intermediates/ParticleText.build/Debug/ParticleText.build/DerivedSources/x86_64 -I/Users/apple/Library/Developer/Xcode/DerivedData/ParticleText-hcmkveqpbqbycsfrfhcnoztddyto/Build/Intermediates/ParticleText.build/Debug/ParticleText.build/DerivedSources -F/Users/apple/Desktop/everything/openframeworks/of_v0.9.3_osx_release/apps/myApps/ParticleText/bin -F/Users/apple/Desktop/everything/openframeworks/of_v0.9.3_osx_release/apps/myApps/ParticleText/…/…/…/libs/glut/lib/osx -D__MACOSX_CORE__ -mtune=native -MMD -MT dependencies -MF /Users/apple/Library/Developer/Xcode/DerivedData/ParticleText-hcmkveqpbqbycsfrfhcnoztddyto/Build/Intermediates/ParticleText.build/Debug/ParticleText.build/Objects-normal/x86_64/ParticleGroupMember.d --serialize-diagnostics /Users/apple/Library/Developer/Xcode/DerivedData/ParticleText-hcmkveqpbqbycsfrfhcnoztddyto/Build/Intermediates/ParticleText.build/Debug/ParticleText.build/Objects-normal/x86_64/ParticleGroupMember.dia -c /Users/apple/Desktop/everything/openframeworks/of_v0.9.3_osx_release/apps/myApps/ParticleText/src/ParticleGroupMember.cpp -o /Users/apple/Library/Developer/Xcode/DerivedData/ParticleText-hcmkveqpbqbycsfrfhcnoztddyto/Build/Intermediates/ParticleText.build/Debug/ParticleText.build/Objects-normal/x86_64/ParticleGroupMember.o

In file included from /Users/apple/Desktop/everything/openframeworks/of_v0.9.3_osx_release/apps/myApps/ParticleText/src/ParticleGroupMember.cpp:1:
In file included from src/ParticleGroupMember.h:4:
src/BaseParticle.h:23:5: error: use of undeclared identifier ‘glm’
glm::vec3 position;
^
src/BaseParticle.h:24:5: error: use of undeclared identifier ‘glm’
glm::vec3 lastPosition;
^
src/BaseParticle.h:26:5: error: use of undeclared identifier ‘glm’
glm::vec3 velocity;
^
src/BaseParticle.h:27:5: error: use of undeclared identifier ‘glm’
glm::vec3 acceleration;
^
/Users/apple/Desktop/everything/openframeworks/of_v0.9.3_osx_release/apps/myApps/ParticleText/src/ParticleGroupMember.cpp:8:22: error: exception specification in declaration does not match previous declaration
ParticleGroupMember::~ParticleGroupMember()
^
In file included from /Users/apple/Desktop/everything/openframeworks/of_v0.9.3_osx_release/apps/myApps/ParticleText/src/ParticleGroupMember.cpp:1:
src/ParticleGroupMember.h:15:13: note: previous declaration is here
virtual ~ParticleGroupMember();
^
5 errors generated.


#6

Aha – it’s updated for a newer version of openFrameworks. I’ll fix it …


#7

thanks chris i’ve actually got this to work but do you have any idea of how i can draw unicode characters instead of english letters in the particle system?
i’ve tried ofxTrueTypeFontUC but it doesen’t compile


#8

Hm … I thought this was fixed in the latest master with something like this:

void ofApp::setup()
{
    ofSetFrameRate(60);
    ofEnableAlphaBlending();
    ofEnableSmoothing();


    // we load our font with contours (see the docs for more info on the args)
    ofTtfSettings settings(OF_TTF_SANS, 50);

    settings.addRanges(ofAlphabet::Chinese);
    settings.addRanges(ofAlphabet::Japanese);
    settings.addRanges(ofAlphabet::Korean);

    settings.contours = true;
    settings.antialiased = true;

    // Load the settings.
    font.load(settings);

    // we initialize a new particles system and wrap it in a shared pointer
    // so that we don't have to worry about calling `delete`.  Remember, if
    // you use the keyword 'delete' you MUST be sure that the memory is freed
    // via a `delete` OR make sure that mechanism (like a shared pointer) will
    // call it for you.
    particleSystem = std::shared_ptr<ParticleSystem>(new ParticleSystem());

    // an init method for us.
    particleSystem->setup();

    // initialize it!
    currentWord = 0;

    // load our text using our mini text utilities class.
    std::string rawText = TextUtilities::loadFile("Lorem.txt");

    // strip puntuation
    rawText = TextUtilities::stripPunctuation(rawText); // remove (some) punctuation

    // finally, get our words
//    words = TextUtilities::splitIntoWords(rawText);

    // Add some other words.
    words.push_back("Hello");
    words.push_back("여보세요");
//    words.push_back("你好");
//    words.push_back("こんにちは");

}

But I’m not able to get it to work – I’d suggest posting a question on the openFrameworks forum http://forum.openframeworks.cc