remove drawing debug sdfatlas

This commit is contained in:
jrkb 2023-04-02 17:15:45 +02:00
parent d894c07d3e
commit eeb211844e
2 changed files with 24 additions and 26 deletions

View file

@ -735,16 +735,16 @@ class Font {
glActiveTexture(GL_TEXTURE0);
#else
GLint toast = glGetUniformLocation(program, "glyphs");
glUniform1i(toast, 2);
curveBuffer = glGetUniformLocation(program, "curves");
glUniform1i(curveBuffer, 1);
location = glGetUniformLocation(program, "glyphs");
glUniform1i(location, 2);
location = glGetUniformLocation(program, "curves");
glUniform1i(location, 1);
//glActiveTexture(GL_TEXTURE0);
//glBindTexture(GL_TEXTURE_2D, glyphBuffer);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, glyphBuffer);
//glActiveTexture(GL_TEXTURE1);
//glBindTexture(GL_TEXTURE_BUFFER, curveBuffer);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_BUFFER, curveBuffer);
//glActiveTexture(GL_TEXTURE0);
#endif

View file

@ -94,11 +94,6 @@ start. I hope to capture something essential.)DONE";
}
currentFontPath = "data/celines-fonts/Version-1-var.ttf";
tryUpdateMainFont(library,
currentFontPath,
mainText,
font,
bb);
transform = Transform();
@ -123,6 +118,7 @@ start. I hope to capture something essential.)DONE";
cout << "Render type " << r->getType() << endl;
backgroundColor = ofFloatColor::red;
r->setBackgroundAuto(false);
}
//--------------------------------------------------------------
@ -158,6 +154,13 @@ void ofApp::draw(){
int currentProgram;
glGetIntegerv(GL_CURRENT_PROGRAM, &currentProgram);
if(!font){
tryUpdateMainFont(library,
currentFontPath,
mainText,
font,
bb);
}
if(font){
GLuint program = fontShader->program;
@ -187,10 +190,10 @@ void ofApp::draw(){
location = glGetUniformLocation(program, "enableControlPointsVisualization");
glUniform1i(location, enableControlPointsVisualization);
debug_font_location = glGetUniformLocation(program, "iChannel0");
glUniform1i(debug_font_location, 3);
//debug_font_location = glGetUniformLocation(program, "iChannel0");
//glUniform1i(debug_font_location, 3);
if(!debug_font.isAllocated()){
if(!debug_font.isAllocated() && false){
debug_font.setUseTexture(false);
debug_font.load("sdfatlas.png");
//debug_font.getTexture().getTextureData().textureID = debug_font_location;
@ -213,23 +216,18 @@ void ofApp::draw(){
GL_UNSIGNED_BYTE,
pixels.getData());
glGenerateMipmap(GL_TEXTURE_2D);
}
//debug_font.bind(debug_font_location);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
}
//debug_font.bind(debug_font_location);
float cx = 0.5f * (bb.minX + bb.maxX);
float cy = 0.5f * (bb.minY + bb.maxY);
font->draw(-cx, -cy, 0, mainText);
glUseProgram(currentProgram);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
}
glDisable(GL_BLEND);