diff --git a/src/GPUFontAtlasLayerCombo.cpp b/src/GPUFontAtlasLayerCombo.cpp index 2a880e5..4f2c089 100644 --- a/src/GPUFontAtlasLayerCombo.cpp +++ b/src/GPUFontAtlasLayerCombo.cpp @@ -1,12 +1,14 @@ #include "GPUFontAtlasLayerCombo.h" #include "Utils.h" #include "font.hpp" +#include "ofAppRunner.h" #include "ofColor.h" #include "ofEvents.h" #include "ofGraphics.h" #include "ofRectangle.h" #include "ofUtils.h" #include "quaternion.hpp" +#include namespace ofxVariableLab { @@ -149,16 +151,22 @@ void GPUFontAtlasLayerCombo::draw(){ glm::mat4 view = transform.getViewMatrix(); glm::mat4 model = glm::mat4(1.0f); + //glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // background color + //glClear(GL_COLOR_BUFFER_BIT); // clear background with background color + // Uses premultiplied-alpha. + ofDisableDepthTest(); glEnable(GL_BLEND); glBlendEquation(GL_FUNC_ADD); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - ofDisableDepthTest(); - ofEnableAlphaBlending(); + //glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE); + //ofEnableAlphaBlending(); int currentProgram; glGetIntegerv(GL_CURRENT_PROGRAM, ¤tProgram); + antiAliasingWindowSize = ofMap(ofGetMouseX(), 0, ofGetWidth(), 0, 8); + enableSuperSamplingAntiAliasing = ofGetMouseY() > ofGetHeight() / 2; float superLineHeight = 0; if(font){ OFX_PROFILER_SCOPE("draw font"); @@ -314,6 +322,8 @@ void GPUFontAtlasLayerCombo::draw(){ "fps: " + ofToString(ofGetFrameRate()) + "\n" + "font: " + this->identifier.fontPath + "\n" + "lineHEight: " + ofToString(superLineHeight) + "\n" + + "antiAliasingWindowSize: " + ofToString(antiAliasingWindowSize) + "\n" + + "SSAA: " + (enableSuperSamplingAntiAliasing ? "on" : "off") + "\n" , 20, 20); } diff --git a/src/GPUFontAtlasLayerCombo.h b/src/GPUFontAtlasLayerCombo.h index df9701e..d83e4fc 100644 --- a/src/GPUFontAtlasLayerCombo.h +++ b/src/GPUFontAtlasLayerCombo.h @@ -101,7 +101,7 @@ class GPUFontAtlasLayerCombo : public AtlasLayerCombo { // 0 - no anti-aliasing // 1 - normal anti-aliasing // >=2 - exaggerated effect - int antiAliasingWindowSize = 1; + float antiAliasingWindowSize = 2; // Enable a second ray along the y-axis to achieve 2-dimensional anti-aliasing. bool enableSuperSamplingAntiAliasing = true; // Draw control points for debugging (green - on curve, magenta - off curve).