From 1098a7ded18128d5eb1ecec5925ee86c72c4c68b Mon Sep 17 00:00:00 2001 From: Don BURNS Date: Sat, 23 Nov 2002 05:16:47 +0000 Subject: [PATCH] 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. --- src/osgText/FTBitmapGlyph.cpp | 1 + src/osgText/FTGLBitmapFont.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/osgText/FTBitmapGlyph.cpp b/src/osgText/FTBitmapGlyph.cpp index 1e9dde778..fbb4f0e7b 100644 --- a/src/osgText/FTBitmapGlyph.cpp +++ b/src/osgText/FTBitmapGlyph.cpp @@ -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; diff --git a/src/osgText/FTGLBitmapFont.cpp b/src/osgText/FTGLBitmapFont.cpp index 1f8d1a6eb..5ab3314aa 100644 --- a/src/osgText/FTGLBitmapFont.cpp +++ b/src/osgText/FTGLBitmapFont.cpp @@ -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);