Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 May 2012
Offline Last Active Jun 11 2015 08:23 AM

#5228364 [Freetype] Cannot render font to a bitmap

Posted by on 11 May 2015 - 09:00 AM

I finally found what was going on:

    // Load the face
    FT_Face face;
    if (FT_New_Memory_Face(m_library, reinterpret_cast<const FT_Byte*>(data), len, 0, &face) != 0)
        SN_ERROR("Failed to create Freetype font face from memory");
        delete[] data;
        return false;
    delete[] data; // DO NOT DELETE THIS...

When FT_New_Memory_Face is used, it doesn't takes ownership or copies the data, so I must keep it alive somewhere until I call FT_Done_Face.
I added a field in my Font class to hold this data and delete it in the destructor.


Also, it seems I had to include a few more headers so when I initialize the library, Freetype loads appropriate modules to rasterize smoothly.


Now everything works fine smile.png

#5223556 Modern OpenGL Tutorials

Posted by on 15 April 2015 - 05:57 PM

I don't know how "modern" it is, but anyway, here is more for OpenGL 3.3 on Windows, from scratch (without windowing library)