proper layerPointer and indefinite amount layers per texture array

This commit is contained in:
jrkb 2023-04-29 21:32:38 +02:00
parent 7feb9630e6
commit 1fb3c95eb8

View file

@ -538,11 +538,11 @@ class Font {
widthCurveTextureLayer = curveBufferSize;
glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RG32F, curveBufferSize, 1, neededLayers);
}else{
//cout << ofToString(neededLayers) << "layers needed NEW" << endl;
if(neededLayers > 4){
neededLayers = 4;
//neededLayers = 4;
// TODO: implement multiple arrays
// LOL
//cout << "more layers than 4 needed" << endl;
}else{
}
widthCurveTextureLayer = gl_max_texture_size;
@ -569,9 +569,13 @@ class Font {
for(int i = 0; i < amountCurveTextureLayers; i++){
int width = widthCurveTextureLayer;
int height = 1;
int layerPointer = i == 0 ? 0 :
5461;
//(i * gl_max_texture_size) - (gl_max_texture_size % bufferCurveSize);
int third = (int)std::floor(gl_max_texture_size / 3);
int layerPointer = (i * third) - (third % bufferCurveSize) + 1;
//int layerPointer = i == 0 ? 0 :
////5461;
//(i * gl_max_texture_size / int(3)) - ((gl_max_texture_size / int(3)) % bufferCurveSize) + 1;
//cout << ofToString(i) << " - layer pointer " << ofToString(layerPointer) << endl;
glTexSubImage3D(GL_TEXTURE_2D_ARRAY,
0,
0,
@ -667,10 +671,10 @@ class Font {
}
int i = 0;
string text = "";
stringstream text;
for(const auto & glyphIdentity : variationText){
const uint32_t & charcode = glyphIdentity.charcode;
text += charcode;
if(charcode == '\0'){ // do we need this?
break;
}
@ -698,8 +702,7 @@ class Font {
continue;
}
// LOL
//cout << (char)glyphIdentity.charcode
//text << (char)glyphIdentity.charcode
//<< " " << ofToString(glyphIdentity.coords[0]) << " "
//<< " (" << ofToString(bufferCurves.size()) << ")" << endl;
@ -710,6 +713,7 @@ class Font {
changed = true;
i++;
}
//cout << text.str() << endl;
if(changed){
dirtyBuffers = true;