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