我想將單色FreeType字形轉換爲RGBA無符號字節OpenGL紋理。紋理中的像素的顏色(X,Y)是(255,255,阿爾法),其中在單色FreeType字形緩衝區中索引像素
alpha = glyph->bitmap.buffer[pixelIndex(x, y)] * 255
我使用
FT_Load_Char(face, glyphChar, FT_LOAD_RENDER | FT_LOAD_MONOCHROME | FT_LOAD_TARGET_MONO)
目標紋理具有的glyph->bitmap.width * glyph->bitmap.rows
尺寸加載我字形。我已經能夠索引灰度字形(加載只使用FT_Load_Char(face, glyphChar, FT_LOAD_RENDER)
)與
glyph->bitmap.buffer[(glyph->bitmap.width * y) + x]
這似乎不是一個單色的緩衝工作,雖然和我的最終結構的字符混亂。
在單色字形緩衝區中獲得像素(x,y)值的正確方法是什麼?