cleanup and flip y axis for memcpy
This commit is contained in:
parent
f81faaa42a
commit
521816920c
1 changed files with 1 additions and 3 deletions
|
@ -11,12 +11,9 @@ void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <float, 3> bitmap,
|
|||
ofImage & image){
|
||||
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();
|
||||
int w = bitmap.width();
|
||||
int h = bitmap.height();
|
||||
// TODO: why do we need to flip?
|
||||
for(int y = 0; y < h; y++){
|
||||
for(int x = 0; x < w; x++){
|
||||
const float * rgb = bitmap(x, y);
|
||||
|
@ -36,6 +33,7 @@ void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <float, 3> bitmap,
|
|||
void ofxMsdfgen::toOfImage(const msdfgen::Bitmap <byte, 3> bitmap,
|
||||
ofImage & image){
|
||||
image.allocate(bitmap.width(), bitmap.height(), OF_IMAGE_COLOR);
|
||||
image.getTexture().getTextureData().bFlipTexture = true;
|
||||
memcpy(image.getPixels().getData(), static_cast <const byte *>(bitmap), bitmap.width() * bitmap.height() * 3 * sizeof(byte));
|
||||
|
||||
image.update();
|
||||
|
|
Loading…
Reference in a new issue