fontSize randomly animated with multiple pseudolayers
This commit is contained in:
parent
358452f98e
commit
7016b0629f
1 changed files with 13 additions and 7 deletions
|
@ -49,6 +49,13 @@ void GPUFontAtlasLayerCombo::setup(const ComboIdentifier & identifier){
|
||||||
cout << "Render type " << r->getType() << endl;
|
cout << "Render type " << r->getType() << endl;
|
||||||
}
|
}
|
||||||
void GPUFontAtlasLayerCombo::update(){
|
void GPUFontAtlasLayerCombo::update(){
|
||||||
|
//#ifndef TARGET_OPENGLES
|
||||||
|
//if(ofGetFrameNum() % 10 == 0){
|
||||||
|
//shaderCatalog->requestUpdate("font");
|
||||||
|
//}else if(ofGetFrameNum() % 10 == 5){
|
||||||
|
//shaderCatalog->update();
|
||||||
|
//}
|
||||||
|
//#endif
|
||||||
float animationSpeed = ofMap(sin(ofGetElapsedTimef() * 0.01), -1, 1, 0.1, 2);
|
float animationSpeed = ofMap(sin(ofGetElapsedTimef() * 0.01), -1, 1, 0.1, 2);
|
||||||
float threshold = 1.0;
|
float threshold = 1.0;
|
||||||
for(int i = 0; i < fontVariationAxes.size(); i++){
|
for(int i = 0; i < fontVariationAxes.size(); i++){
|
||||||
|
@ -84,10 +91,6 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
|
|
||||||
float targetFontSize = 128;
|
float targetFontSize = 128;
|
||||||
|
|
||||||
float worldSize = targetFontSize / (float)width;
|
|
||||||
|
|
||||||
font->setWorldSize(targetFontSize);
|
|
||||||
|
|
||||||
float width_unit = 1;
|
float width_unit = 1;
|
||||||
float height_unit = (float)height / width;
|
float height_unit = (float)height / width;
|
||||||
|
|
||||||
|
@ -97,6 +100,7 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
glm::mat4 projection = transform.getOrthoProjectionMatrix(width,
|
glm::mat4 projection = transform.getOrthoProjectionMatrix(width,
|
||||||
height,
|
height,
|
||||||
Transform::TOP_LEFT);
|
Transform::TOP_LEFT);
|
||||||
|
//Transform::CENTERED);
|
||||||
glm::mat4 view = transform.getViewMatrix();
|
glm::mat4 view = transform.getViewMatrix();
|
||||||
glm::mat4 model = glm::mat4(1.0f);
|
glm::mat4 model = glm::mat4(1.0f);
|
||||||
|
|
||||||
|
@ -150,18 +154,20 @@ void GPUFontAtlasLayerCombo::draw(){
|
||||||
glUniform1i(location, enableControlPointsVisualization);
|
glUniform1i(location, enableControlPointsVisualization);
|
||||||
|
|
||||||
|
|
||||||
|
//mouse.x = 0;
|
||||||
|
//mouse.y = 0;
|
||||||
float mx = ofMap(mouse.x, 0, width, -0.5 * width_unit, 0.5 * width_unit);
|
float mx = ofMap(mouse.x, 0, width, -0.5 * width_unit, 0.5 * width_unit);
|
||||||
float my = ofMap(mouse.y, 0, height, -0.5 * height_unit, 0.5 * height_unit);
|
float my = ofMap(mouse.y, 0, height, -0.5 * height_unit, 0.5 * height_unit);
|
||||||
cx = 0.5f * (bb.minX + bb.maxX);
|
cx = 0.5f * (bb.minX + bb.maxX);
|
||||||
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 - (200 * sin(ofGetElapsedTimef() * 0.25)), 0, "what", vFlip == V_FLIP_ON);
|
font->draw(mouse.x, mouse.y - (200 * sin(ofGetElapsedTimef() * 0.25)), 0, "what", vFlip == V_FLIP_ON, 128.0f);
|
||||||
location = glGetUniformLocation(fontShaderProgram, "color");
|
location = glGetUniformLocation(fontShaderProgram, "color");
|
||||||
glUniform4f(location, 0.0f, 1.0f, 0.0f, 0.5f);
|
glUniform4f(location, 0.0f, 1.0f, 0.0f, 0.5f);
|
||||||
font->draw(mouse.x, mouse.y, 0, "ever", vFlip == V_FLIP_ON);
|
font->draw(mouse.x, mouse.y, 0, "ever", vFlip == V_FLIP_ON, 64.0f);
|
||||||
glUniform4f(location, 0.0f, 0.0f, 1.0f, 0.5f);
|
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);
|
font->draw(mouse.x, mouse.y + (200 * sin(ofGetElapsedTimef() * 0.25)), 0, "verraw", vFlip == V_FLIP_ON, 256.0f);
|
||||||
glUseProgram(currentProgram);
|
glUseProgram(currentProgram);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue