remove grey antialias border

This commit is contained in:
jrkb 2023-04-22 16:01:40 +02:00
parent 7a39530cfe
commit 2117df65c4
2 changed files with 14 additions and 4 deletions

View file

@ -1,12 +1,14 @@
#include "GPUFontAtlasLayerCombo.h" #include "GPUFontAtlasLayerCombo.h"
#include "Utils.h" #include "Utils.h"
#include "font.hpp" #include "font.hpp"
#include "ofAppRunner.h"
#include "ofColor.h" #include "ofColor.h"
#include "ofEvents.h" #include "ofEvents.h"
#include "ofGraphics.h" #include "ofGraphics.h"
#include "ofRectangle.h" #include "ofRectangle.h"
#include "ofUtils.h" #include "ofUtils.h"
#include "quaternion.hpp" #include "quaternion.hpp"
#include <GL/gl.h>
namespace ofxVariableLab { namespace ofxVariableLab {
@ -149,16 +151,22 @@ void GPUFontAtlasLayerCombo::draw(){
glm::mat4 view = transform.getViewMatrix(); glm::mat4 view = transform.getViewMatrix();
glm::mat4 model = glm::mat4(1.0f); 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. // Uses premultiplied-alpha.
ofDisableDepthTest();
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(); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
ofEnableAlphaBlending(); //ofEnableAlphaBlending();
int currentProgram; int currentProgram;
glGetIntegerv(GL_CURRENT_PROGRAM, &currentProgram); glGetIntegerv(GL_CURRENT_PROGRAM, &currentProgram);
antiAliasingWindowSize = ofMap(ofGetMouseX(), 0, ofGetWidth(), 0, 8);
enableSuperSamplingAntiAliasing = ofGetMouseY() > ofGetHeight() / 2;
float superLineHeight = 0; float superLineHeight = 0;
if(font){ if(font){
OFX_PROFILER_SCOPE("draw font"); OFX_PROFILER_SCOPE("draw font");
@ -314,6 +322,8 @@ void GPUFontAtlasLayerCombo::draw(){
"fps: " + ofToString(ofGetFrameRate()) + "\n" "fps: " + ofToString(ofGetFrameRate()) + "\n"
+ "font: " + this->identifier.fontPath + "\n" + "font: " + this->identifier.fontPath + "\n"
+ "lineHEight: " + ofToString(superLineHeight) + "\n" + "lineHEight: " + ofToString(superLineHeight) + "\n"
+ "antiAliasingWindowSize: " + ofToString(antiAliasingWindowSize) + "\n"
+ "SSAA: " + (enableSuperSamplingAntiAliasing ? "on" : "off") + "\n"
, 20, 20); , 20, 20);
} }

View file

@ -101,7 +101,7 @@ class GPUFontAtlasLayerCombo : public AtlasLayerCombo {
// 0 - no anti-aliasing // 0 - no anti-aliasing
// 1 - normal anti-aliasing // 1 - normal anti-aliasing
// >=2 - exaggerated effect // >=2 - exaggerated effect
int antiAliasingWindowSize = 1; float antiAliasingWindowSize = 2;
// Enable a second ray along the y-axis to achieve 2-dimensional anti-aliasing. // Enable a second ray along the y-axis to achieve 2-dimensional anti-aliasing.
bool enableSuperSamplingAntiAliasing = true; bool enableSuperSamplingAntiAliasing = true;
// Draw control points for debugging (green - on curve, magenta - off curve). // Draw control points for debugging (green - on curve, magenta - off curve).