Skip to content

Instantly share code, notes, and snippets.

@moebiussurfing
moebiussurfing / ofApp.cpp
Last active May 5, 2020 22:27
openFrameworks / ImGui add ofParamaters as c++ types. plain ImGui without ofxImGui
//h
ofParameter<float> _edgeSlope;
//convert string to char pointer
string _str = parameter.getName();
const char * _name(_str.c_str());
/cpp
//setup
_edgeSlope.set("edgeSlope", 0.3f, 0.0f, 1.0f);
@moebiussurfing
moebiussurfing / ofApp.cpp
Created April 28, 2020 00:47
openFrameworks - ofxImGui customize font
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
io.Fonts->AddFontFromFileTTF(&ofToDataPath("ofxPresetsManager/fonts/overpass-mono-bold.otf")[0], 12.0f);
gui.setup();
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active April 22, 2020 04:39
openFrameworks - file path handling with boost
//split string path using boost
//https://stackoverflow.com/questions/10099206/howto-parse-a-path-to-a-vector-using-c
//boost::filesystem::path p1("/usr/local/bin");
boost::filesystem::path p1(videoFilePath.get());
//boost::filesystem::path p2("c:\\");
std::cout << p1.filename() << std::endl; // prints "bin"
std::cout << p1.parent_path() << std::endl; // prints "/usr/local"
videoName = ofToString(p1.filename());
filename: "NightmoVES4.mov"
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active May 18, 2020 05:34
openFrameworks - bool parameter lambda callback listener: button and toggle
//group
ofAddListener(params.parameterChangedE(), this, &ofxGpuLutCube::Changed_params);
//toggle
ofEventListener listener;
listener = SHOW_CONTROL.newListener([this](bool b) {
OSC_Helper.setVisiblePlots(b);
//std::cout << b << std::endl;
});
@moebiussurfing
moebiussurfing / ofApp.cpp
Created March 15, 2020 19:38
openFrameworks - simplel color param listener
in ofApp.h
ofParameter<ofColor> color;
void updateModel(ofColor&);
ofEventListener colorListener;
ofApp.cpp
void ofApp::setup(){
@moebiussurfing
moebiussurfing / gist:c5ee135ad6624cf41f43de732b7df65e
Last active October 16, 2020 19:37
openFrameworks ofParameter pointers
//pass parameter as reference?
//https://forum.openframeworks.cc/t/its-posible-to-pass-reference-to-an-ofparameter-float-as-a-simple-c-float-type/34301
ofParameter<float> fParam;
ofxPrintMyVars::addFloat("myFloat", (float*)&fParam.get());
//-
ofApp.cpp
setup()
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active February 24, 2020 04:38
openFrameworks - ofxGuiExtended customize widgets
//ofxGuiExtended
gui_VideoFx = gui.addGroup(params_GuiPanel);
//group folding with group names bc by default name is not showed
gFrag1 = gui_VideoFx->addGroup("FRAG1");
gFrag2 = gui_VideoFx->addGroup("FRAG2");
gFrag3 = gui_VideoFx->addGroup("FRAG3");
gFrag1->add(frag1.parameters);
@moebiussurfing
moebiussurfing / gist:508b1325f72873021ab82e0c99abc66e
Created February 21, 2020 22:01
openFrameworks - ofxImGui NOTES & LINKS
EXAMPLES
https://github.com/MacFurax/ofxImGui
https://github.com/MacFurax/ofxPDSPTools
@moebiussurfing
moebiussurfing / gist:d40a065da1935bd22a105d58f2b82594
Created February 21, 2020 21:59
openFrameworks - ofParameterGroup
https://forum.openframeworks.cc/t/ofparametergroup-best-practices/18752/16
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active February 17, 2020 05:42
openFrameworks - ofxGui / ofxPanel. customize panels. get from nested groups to minimize/maximize from added ofParameterGroup
void ofxFontAnimator::refreshGui_AllColors()
{
//gui_All_Colors.minimizeAll();
//collapse groups
auto &gAll = gui_All_Colors.getGroup("ALL COLORS");
auto &gF = gAll.getGroup("FONTS");
auto &gBg = gAll.getGroup("BACKGROUNDS");
auto &gGr = gBg.getGroup("GRADIENT BACKGROUND");