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); glActiveTexture(GL_TEXTURE0);
#else #else
GLint toast = glGetUniformLocation(program, "glyphs"); location = glGetUniformLocation(program, "glyphs");
glUniform1i(toast, 2); glUniform1i(location, 2);
curveBuffer = glGetUniformLocation(program, "curves"); location = glGetUniformLocation(program, "curves");
glUniform1i(curveBuffer, 1); glUniform1i(location, 1);
//glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE2);
//glBindTexture(GL_TEXTURE_2D, glyphBuffer); glBindTexture(GL_TEXTURE_2D, glyphBuffer);
//glActiveTexture(GL_TEXTURE1); glActiveTexture(GL_TEXTURE1);
//glBindTexture(GL_TEXTURE_BUFFER, curveBuffer); glBindTexture(GL_TEXTURE_BUFFER, curveBuffer);
//glActiveTexture(GL_TEXTURE0); //glActiveTexture(GL_TEXTURE0);
#endif #endif

View file

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