do not flip glyphs anymore

This commit is contained in:
jrkb 2023-03-27 18:55:56 +02:00
parent b2b0fafe76
commit 3933e7b2ba

View file

@ -10,13 +10,16 @@ void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <float, 3> bitmap,
void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <float, 3> bitmap, void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <float, 3> bitmap,
ofImage & image){ ofImage & image){
image.allocate(bitmap.width(), bitmap.height(), OF_IMAGE_COLOR); image.allocate(bitmap.width(), bitmap.height(), OF_IMAGE_COLOR);
image.getTexture().getTextureData().bFlipTexture = true;
cout <<
(image.getTexture().getTextureData().bFlipTexture ? "bFlipTexture is true" : "bFlipTexutre? never heard of it") << endl;
ofPixels & pixels = image.getPixels(); ofPixels & pixels = image.getPixels();
int w = bitmap.width(); int w = bitmap.width();
int h = bitmap.height(); int h = bitmap.height();
// TODO: why do we need to flip? // TODO: why do we need to flip?
for(int y = 1; y <= h; y++){ for(int y = 0; y < h; y++){
for(int x = 0; x < w; x++){ for(int x = 0; x < w; x++){
const float * rgb = bitmap(x, h - y); const float * rgb = bitmap(x, y);
int index = 3 * (x + y * w); int index = 3 * (x + y * w);
pixels.getData()[index] = (unsigned char)std::clamp(rgb[0] * 256.0, pixels.getData()[index] = (unsigned char)std::clamp(rgb[0] * 256.0,
0.0, 255.0); 0.0, 255.0);