How to copy fontTexture to ofImage?


#1

Hi, I’m trying to copy font’s texture to ofImage.
I found this post about how to copy texture to ofImage

So I tried this based on @polyclick’s suggestion

void ofApp::setup(){

    font.load("font.ttf", 50);
    ofPixels pixels;
    font.getFontTexture().readToPixels(pixels);
    image.setFromPixels(pixels); 
}

But when I run it, I see these errors on the console.

[ error ] ofPixels: image type not supported
[ error ] ofPixels: format doesn’t support channels
[ error ] ofGLUtils: ofGetGLFormatFromPixelFormat(): unknown OF pixel format-1, returning GL_LUMINANCE

How can I properly copy font Texture to ofImage?
I use OF 0.9.8 on OSX.
Thank you so much in advance!


#2

https://github.com/openframeworks/openFrameworks/issues/5669