re-enable animation
This commit is contained in:
parent
b4fe28b7d5
commit
358452f98e
1 changed files with 26 additions and 17 deletions
|
@ -2,6 +2,8 @@
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "ofColor.h"
|
#include "ofColor.h"
|
||||||
#include "ofEvents.h"
|
#include "ofEvents.h"
|
||||||
|
#include "ofGraphics.h"
|
||||||
|
#include "ofUtils.h"
|
||||||
|
|
||||||
namespace ofxVariableLab {
|
namespace ofxVariableLab {
|
||||||
|
|
||||||
|
@ -47,20 +49,20 @@ void GPUFontAtlasLayerCombo::setup(const ComboIdentifier & identifier){
|
||||||
cout << "Render type " << r->getType() << endl;
|
cout << "Render type " << r->getType() << endl;
|
||||||
}
|
}
|
||||||
void GPUFontAtlasLayerCombo::update(){
|
void GPUFontAtlasLayerCombo::update(){
|
||||||
//float animationSpeed = ofMap(sin(ofGetElapsedTimef() * 0.01), -1, 1, 0.0, 2);
|
float animationSpeed = ofMap(sin(ofGetElapsedTimef() * 0.01), -1, 1, 0.1, 2);
|
||||||
//float threshold = 5.0;
|
float threshold = 1.0;
|
||||||
//for(int i = 0; i < fontVariationAxes.size(); i++){
|
for(int i = 0; i < fontVariationAxes.size(); i++){
|
||||||
//ofxGPUFont::Font::FontVariationAxis & axis = fontVariationAxes[i];
|
ofxGPUFont::Font::FontVariationAxis & axis = fontVariationAxes[i];
|
||||||
//ofxGPUFont::Font::FontVariationAxisParameters & axisParams = fontVariationAxesParameters[i];
|
ofxGPUFont::Font::FontVariationAxisParameters & axisParams = fontVariationAxesParameters[i];
|
||||||
//double newValue = ofMap(sin(ofGetElapsedTimef() * animationSpeed),
|
double newValue = ofMap(sin(ofGetElapsedTimef() * animationSpeed),
|
||||||
//-1, 1,
|
-1, 1,
|
||||||
//axisParams.minValue, axisParams.maxValue);
|
axisParams.minValue, axisParams.maxValue);
|
||||||
//if(abs(newValue - axis.value) > threshold){
|
if(abs(newValue - axis.value) > threshold){
|
||||||
//font->setFontVariationAxis(library, axis.name, newValue);
|
font->setFontVariationAxis(library, axis.name, newValue);
|
||||||
//axis.value = newValue;
|
axis.value = newValue;
|
||||||
//font->prepareGlyphsForText(mainText, true);
|
font->prepareGlyphsForText(mainText, true);
|
||||||
//}
|
}
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
void GPUFontAtlasLayerCombo::careForChild(shared_ptr <Layer> layer){
|
void GPUFontAtlasLayerCombo::careForChild(shared_ptr <Layer> layer){
|
||||||
}
|
}
|
||||||
|
@ -80,7 +82,7 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
int height = ofGetHeight();
|
int height = ofGetHeight();
|
||||||
glm::vec2 mouse = glm::vec2(ofGetMouseX(), ofGetMouseY());
|
glm::vec2 mouse = glm::vec2(ofGetMouseX(), ofGetMouseY());
|
||||||
|
|
||||||
float targetFontSize = ofGetFrameNum() % 100 < 50 ? 42 : 420;
|
float targetFontSize = 128;
|
||||||
|
|
||||||
float worldSize = targetFontSize / (float)width;
|
float worldSize = targetFontSize / (float)width;
|
||||||
|
|
||||||
|
@ -111,6 +113,8 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendEquation(GL_FUNC_ADD);
|
glBlendEquation(GL_FUNC_ADD);
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
ofDisableDepthTest();
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
|
||||||
int currentProgram;
|
int currentProgram;
|
||||||
glGetIntegerv(GL_CURRENT_PROGRAM, ¤tProgram);
|
glGetIntegerv(GL_CURRENT_PROGRAM, ¤tProgram);
|
||||||
|
@ -136,7 +140,7 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
glUniform1f(location, z);
|
glUniform1f(location, z);
|
||||||
|
|
||||||
location = glGetUniformLocation(fontShaderProgram, "color");
|
location = glGetUniformLocation(fontShaderProgram, "color");
|
||||||
glUniform4f(location, 1.0f, 0.0f, 1.0f, 1.0f);
|
glUniform4f(location, 1.0f, 0.0f, 0.0f, 0.5f);
|
||||||
|
|
||||||
location = glGetUniformLocation(fontShaderProgram, "antiAliasingWindowSize");
|
location = glGetUniformLocation(fontShaderProgram, "antiAliasingWindowSize");
|
||||||
glUniform1f(location, (float)antiAliasingWindowSize);
|
glUniform1f(location, (float)antiAliasingWindowSize);
|
||||||
|
@ -152,7 +156,12 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
cy = 0.5f * (bb.minY + bb.maxY);
|
cy = 0.5f * (bb.minY + bb.maxY);
|
||||||
//ofRectangle rectangle(0, 0, width, height);
|
//ofRectangle rectangle(0, 0, width, height);
|
||||||
//ofDrawRectangle(rectangle);
|
//ofDrawRectangle(rectangle);
|
||||||
font->draw(mouse.x, mouse.y, 0, mainText, vFlip == V_FLIP_ON);
|
font->draw(mouse.x, mouse.y - (200 * sin(ofGetElapsedTimef() * 0.25)), 0, "what", vFlip == V_FLIP_ON);
|
||||||
|
location = glGetUniformLocation(fontShaderProgram, "color");
|
||||||
|
glUniform4f(location, 0.0f, 1.0f, 0.0f, 0.5f);
|
||||||
|
font->draw(mouse.x, mouse.y, 0, "ever", vFlip == V_FLIP_ON);
|
||||||
|
glUniform4f(location, 0.0f, 0.0f, 1.0f, 0.5f);
|
||||||
|
font->draw(mouse.x, mouse.y + (200 * sin(ofGetElapsedTimef() * 0.25)), 0, "verraw", vFlip == V_FLIP_ON);
|
||||||
glUseProgram(currentProgram);
|
glUseProgram(currentProgram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue