Freetype 2.1 and later align bitmap pitch on boundaries of 2 bytes. It is
therefore necessary to use glPixelStorei(..,UNPACK_..., 2). There is an #if() statement that allows the continued use of freetype 2.0 (Rh 7.x), as well as accomodating newer releases.
This commit is contained in:
@@ -39,6 +39,7 @@ FTBitmapGlyph::FTBitmapGlyph( FT_Glyph glyph)
|
||||
|
||||
data = osgNew unsigned char[srcPitch * destHeight];
|
||||
|
||||
// !!!! THIS assumes a positive Pitch value. No allowance for negative pitch
|
||||
for(int y = 0; y < srcHeight; ++y)
|
||||
{
|
||||
--destHeight;
|
||||
|
||||
@@ -45,7 +45,11 @@ void FTGLBitmapFont::render( const char* string,unsigned int renderContext)
|
||||
|
||||
glPixelStorei( GL_UNPACK_LSB_FIRST, GL_FALSE);
|
||||
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0);
|
||||
#if (FREETYPE_MAJOR >= 2) && (FREETYPE_MINOR>=1)
|
||||
glPixelStorei( GL_UNPACK_ALIGNMENT, 2);
|
||||
#else
|
||||
glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
|
||||
#endif
|
||||
|
||||
FTFont::render( string,renderContext);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user