Skip to content

Instantly share code, notes, and snippets.

View moebiussurfing's full-sized avatar
🛴

moebiusSurfing moebiussurfing

🛴
View GitHub Profile
@moebiussurfing
moebiussurfing / ofApp.h
Created November 28, 2019 00:14
create gui from class params post glitch
std::map<std::string, RenderPass::Ptr> passes;
ofxPanel gui;
void toggleListener(const void * sender, bool & value);
//--------------------------------------------------------------
void ofxFontAnimator::saveWindow()
{
//save window settings
ofWindowSettings AppWindow;
AppWindow.setPosition(glm::vec2(ofGetWindowPositionX(), ofGetWindowPositionY()));
AppWindow.setSize(ofGetWindowSize().x, ofGetWindowSize().y);
AppWindow.windowMode = ofGetCurrentWindow()->getWindowMode();
ofJson j;
@moebiussurfing
moebiussurfing / ofApp.cpp
Created November 13, 2019 18:00
ofDataPath set app path
string filepath = ofToDataPath("");
igl::readOBJ(filepath + "armadillo.obj", V, F);
@moebiussurfing
moebiussurfing / ofxColorManager.cpp
Created July 31, 2019 00:17
ImGui color picker
static ImVec4 color;
color.x = color_backGround.get().r;
color.y = color_backGround.get().g;
color.z = color_backGround.get().b;
color.w = color_backGround.get().a;
// squared box
ImGuiColorEditFlags colorEdiFlags =
ImGuiColorEditFlags_NoSmallPreview |
ImGuiColorEditFlags_NoTooltip |
@moebiussurfing
moebiussurfing / cpp
Created February 11, 2020 05:10
openFrameworks - check if file exists
ofFile file(path);
if (file.exists())
{
}
else
{
ofLogError("ofApp") << "loadSettings '" << path << "' NOT FOUND!";
}
@moebiussurfing
moebiussurfing / gist:73953e47d02c7e2bbdb484c42b80d390
Last active February 11, 2020 08:51
openFrameworks - ImGui vec sliders
static float position[] = {0.0f, 0.0f};
ImGui::SliderFloat2("position", position, -1.0f, 1.0f);
static glm::vec3 myVector{0.0f, 0.0f, 0.0f};
ImGui::SliderFloat3("myVector", (float*)&myVector, 0.0f, 1.0f);
static ImVec4 myImVector{1.0f, 1.0f, 1.0f, 1.0f};
ImGui::SliderFloat4("myImVector", (float*)&myImVector, 0.0f, 1.0f);
@moebiussurfing
moebiussurfing / open file system dialog
Last active February 11, 2020 08:51
openFrameworks - open file system dialog // get texture from video
https://forum.openframeworks.cc/t/how-do-i-mix-the-alpha-channel-of-one-video-with-another/18771
ofApp.h file
#pragma once
#include "ofMain.h"
class ofApp : public ofBaseApp{
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active February 11, 2020 08:52
openFrameworks - ofxSerializer OF types easy serialization
// Make vector.
std::vector<ofColor> palette = { ofColor::red };
// Serialize it.
ofJson json = palette;
// Save it.
ofSaveJson("palette.json", json);
// Load it.
ofJson paletteJson = ofLoadJson("palette.json");
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active February 17, 2020 05:41
openFrameworks - ofxGui theme. check font file exist
//ofxGui theme
string path = GLOBAL_Path + "fonts/overpass-mono-bold.otf";
ofFile file(path);
if (file.exists())
{
ofLogNotice("ofxSceneTEST") << "ofxGui theme: LOADED FONT FILE '" << path << "'";
ofxGuiSetFont(path, 9);
}
else
{
@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");