Added image background with adjustment sliders

- Brightness/contrast/saturation and RGBA sliders added
- Fullscreen functionality added
This commit is contained in:
James Alliban
2014-01-07 00:48:58 +00:00
parent 3053981175
commit 721d59e5f7
12 changed files with 147 additions and 11 deletions
+15 -1
View File
@@ -17,7 +17,7 @@ void GUI::setup()
dim = 8;
addKeyboardShortcutsGUI();
addGraphAnimationGUI();
//addGraphAnimationGUI();
addBarGraphDesignGUI();
addGraphSimulationGUI();
addBackgroundGUI();
@@ -40,6 +40,8 @@ void GUI::addKeyboardShortcutsGUI()
gui->addLabel("SPACE - SHOW/HIDE GUI", OFX_UI_FONT_SMALL);
gui->addLabel("'[' - PREVIOUS GUI", OFX_UI_FONT_SMALL);
gui->addLabel("']' - NEXT GUI", OFX_UI_FONT_SMALL);
gui->addLabel("'p' - TOGGLE PAUSE ANIMATION", OFX_UI_FONT_SMALL);
gui->addLabel("'f' - TOGGLE FULLSCREEN", OFX_UI_FONT_SMALL);
finaliseCanvas(gui, true);
@@ -96,14 +98,26 @@ void GUI::addBackgroundGUI()
ofxUICanvas* gui = getNewGUI(title);
gui->addLabel("GRADIENT COLOUR");
gui->addSpacer(length, 1);
gui->addSlider("Start red", 0, 255, &app->scene.bgGradStartCol[0], length, dim);
gui->addSlider("Start green", 0, 255, &app->scene.bgGradStartCol[1], length, dim);
gui->addSlider("Start blue", 0, 255, &app->scene.bgGradStartCol[2], length, dim);
gui->addSlider("Start alpha", 0, 255, &app->scene.bgGradStartCol[3], length, dim);
gui->addSpacer(length, 1);
gui->addSlider("End red", 0, 255, &app->scene.bgGradEndCol[0], length, dim);
gui->addSlider("End green", 0, 255, &app->scene.bgGradEndCol[1], length, dim);
gui->addSlider("End blue", 0, 255, &app->scene.bgGradEndCol[2], length, dim);
gui->addSlider("End alpha", 0, 255, &app->scene.bgGradEndCol[3], length, dim);
gui->addSpacer(length, 1);
gui->addLabel("BACKGROUND IMAGE");
gui->addSlider("Brightness", 0, 2, &app->scene.brightness, length, dim);
gui->addSlider("Contrast", 0, 2, &app->scene.contrast, length, dim);
gui->addSlider("Saturation", 0, 2, &app->scene.saturation, length, dim);
gui->addSlider("Red", 0, 2, &app->scene.red, length, dim);
gui->addSlider("Green", 0, 2, &app->scene.green, length, dim);
gui->addSlider("Blue", 0, 2, &app->scene.blue, length, dim);
gui->addSlider("Alpha", 0, 2, &app->scene.alpha, length, dim);
ofAddListener(gui->newGUIEvent, this, &GUI::variousGUIEvent);
finaliseCanvas(gui, true);
+5 -6
View File
@@ -3,11 +3,10 @@
// TODO
// ====
// - Make graph system with 3 simple (for now) but different graphs that can be interchanged
// - Make events system to send data to scene
// - Add image to background and create a mask
// - Use a shader to adjust image brightness/contrast and colour
// -
// -
// - Add to GUI
// - - Publisher choice
// - Add to config
// - - IP address
// - - Host name
// - - App name
@@ -67,7 +66,7 @@ void testApp::mousePressed(int x, int y, int button)
void testApp::keyPressed(int key)
{
if (key == 'p')
{
isPaused = !isPaused;
}
else if (key == 'f')
ofToggleFullscreen();
}
+19
View File
@@ -11,6 +11,8 @@
void Scene::setup()
{
bgImg.loadImage("images/tanks.jpg");
rgbShader.load("shaders/RGBShader");
barGraph.setup();
}
@@ -27,6 +29,23 @@ void Scene::draw()
ofColor(bgGradEndCol[0], bgGradEndCol[1], bgGradEndCol[2], bgGradEndCol[3]),
OF_GRADIENT_CIRCULAR);
rgbShader.begin();
rgbShader.setUniform1f("brightness", brightness);
rgbShader.setUniform1f("contrast", contrast);
rgbShader.setUniform1f("saturation", saturation);
rgbShader.setUniform1f("red", red);
rgbShader.setUniform1f("green", green);
rgbShader.setUniform1f("blue", blue);
rgbShader.setUniform1f("alpha", alpha);
bgImg.draw(0, 0, ofGetWidth(), ofGetHeight());
rgbShader.end();
barGraph.draw();
}
+4
View File
@@ -21,6 +21,10 @@ public:
void draw();
BarGraph barGraph;
ofShader rgbShader;
ofImage bgImg;
float brightness, contrast, saturation, red, green, blue, alpha;
float bgGradStartCol[4];
float bgGradEndCol[4];