Skip to content

Instantly share code, notes, and snippets.

@moebiussurfing
moebiussurfing / ofApp.cpp
Created June 26, 2020 20:55
openFrameworks two ofParameter linked as references
params.setName("myGroupParameters");
params.add(separation.set("separation", 5, 1, 100));
separationREF.makeReferenceTo(separation);
params.add(separationREF.set("separationREF", 5, 1, 100));
//separationREF - separation are linked
@moebiussurfing
moebiussurfing / ofApp.h
Last active July 16, 2020 01:09
openframeworks | check if a folder path exist and creates one if not
//check if a folder path exist and creates one if not
//many times when you try to save a file, this is not possible and do not happens bc the container folder do not exist
//--------------------------------------------------------------
void CheckFolder(string _path)
{
ofLogNotice(__FUNCTION__) << _path;
ofDirectory dataDirectory(ofToDataPath(_path, true));
@moebiussurfing
moebiussurfing / .cpp
Created July 15, 2020 00:13
openFrameworks / easy simple drawTextBoxed helper util
//ofApp.h
ofTrueTypeFont font;
float fontSize;
//--------------------------------------------------------------
void drawTextBoxed(string text, int x, int y, int alpha = 255)
{
ofPushStyle();
int pad = 20;
@moebiussurfing
moebiussurfing / ofApp.cpp
Created July 19, 2020 05:44
openframeworks / ofxImGui / my custom ImGui helpers: big button and big toggle for bool parameters
//AddBigButton(bRandomizeIndex, 25);//index
AddBigButton(bRandomizeEditor, 25);//preset
AddBigToggle(PLAY_RandomizeTimer, 30);
//--
//my custom ImGui helpers
////toggle ImGui button
////https://github.com/ocornut/imgui/issues/1537
//--------------------------------------------------------------
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active August 3, 2020 21:19
openFrameworks / Windows set window on top
HWND AppWindow = GetActiveWindow();
SetWindowPos(AppWindow, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE);
@moebiussurfing
moebiussurfing / ofApp.cpp
Created August 4, 2020 09:45
openFrameworks / quaternions euler glimbal lock
https://forum.openframeworks.cc/t/best-way-to-convert-between-euler-angles-and-quaternions-avoiding-gimbal-lock/34296/2
@moebiussurfing
moebiussurfing / ofApp.cpp
Created August 5, 2020 22:59
openFrameworks / customize ofxGui theme dark theme
//ofxGui theme
//.cpp
//setup
setTheme_ofxGui();
//ofApp.h
void setTheme_ofxGui()
{
string pathFont = "assets/fonts/overpass-mono-bold.otf";
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active August 22, 2020 16:55
openFrameworks / get a widget/parameter from and ofxGuiGroup
//https://forum.openframeworks.cc/t/can-iterate-though-all-ofxgui-elements/35047/11
//https://forum.openframeworks.cc/t/its-posible-to-avoid-ofxgui-float-ofxslider-label-style-2-8e-15-to-0-000028/35953/2
gui.setup(parameters);
//iterate through all elements of this gui
for (int i = 0; i < gui.getNumControls(); i++) {
auto control = gui.getControl(i);
//check if one of the elements might be a parameterGroup; i.e. parameter contains multiple items
@moebiussurfing
moebiussurfing / CaptureWindow.h
Created September 10, 2020 22:24
openFrameworks / CaptureWindow.h : realtime video capturer for Windows. Using ofxFFmpegRecorder & ofxFastFboReader
#pragma once
#include "ofMain.h"
//TODO: BUG: when enabled antialias 16 or RGBF32 recording goes grey...?
//windows ffmpeg screen recorder
#ifdef TARGET_WIN32
#include "ofxFFmpegRecorder.h"
#include "ofxFastFboReader.h"
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active January 5, 2021 20:19
openFrameworks / ofParameters cast
// casting ofParameters
float v = static_cast<ofParameter<float>&>(parameter);
ofParameter<float> prop = static_cast<ofParameter<float>&>(parameter);
ofParameter<float> prop = parameter.cast<float>();
//which internally does the static cast you are using now.
//https://forum.openframeworks.cc/t/ofparametergroup-best-practices/18752/8
//--