openframeworks / openframeworks/openFrameworks
ofTexture::readToPixels(...) calls ofGetImageTypeFromGLType(), which fails in many cases.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
Hi, I'm trying to copy font's texture to ofImage.
I found this post about how to copy ofTexture to ofImage
https://forum.openframeworks.cc/t/oftexture-to-ofimage/4451/6
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!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the font texture copy shown in the issue with OF 0.9.8 on OSX, then trace ofTexture::readToPixels(...) through ofGetImageTypeFromGLType() and the reported ofPixels/ofGLUtils errors. Done means the font texture can be copied into ofImage without the unsupported image type, channel, or pixel-format errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100