#11 Patch for correct normal calculation in FTExtrudeGlyph

Lars Hofhansl

I noticed that the generated normals are not right for all characters.

o they point the wrong direction
o because a single quad strip is used the normal on sharp edges are interpolated in OpenGL.

Vertexes in quad strips can only really only be shared if they are the same. If they have different normal they are not the same.

This is a 1st attempt to patch the issue. Smooth parts are still rendered with a single quad strip (for example as in '8' 'O' or '0', or parts of '3' 'B', etc).
When a sharp edges (for example in the letter 'H') are detected a new quad strip is started. The smooth angle is currently hardcode to 20 degrees.

A sharp edge is currently defined as "The normal differs by more than 20 degrees". Maybe that should be configurable.

The patch is a bit hacky, but it works for me. I'm happy to provide a better version with suggested changes.


  • Lars Hofhansl
    Lars Hofhansl

    • summary: Patch for correct normal calculated in FTExtrudeGlyph --> Patch for correct normal calculation in FTExtrudeGlyph