Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: OpenGL fonts

  1. #1
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Pennsylvannia
    Posts
    103

    OpenGL fonts

    I'm still learning the basics of openGL but I wanted to try adding some on screen text to one of my practice applications. I peaked ahead a little in my book and was surprised to find openGL offers only very low level support for creating fonts. I assumed therefore, that someone has probably built a library to allow more sophisticated text drawing.

    So I read the FAQ and they mentioned FreeType. Looks interesting. But I wanted to get some user opinions. Whats a good extension for simple text to screen drawing? I'd like, if at all possible, something simple, that doesn't take long to learn. I'd rather spend time learning openGL right now.

    I'm also using GLUT to handle the windowing, so anything that works well with that is preferable.
    Striving for proficiency...

  2. #2
    Senior Member Regular Contributor
    Join Date
    Aug 2007
    Location
    USA
    Posts
    243

    Re: OpenGL fonts

    I highly recommend quesoglc.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Pennsylvannia
    Posts
    103

    Re: OpenGL fonts

    Interesting! Though that claims TrueType is a prerequisite. Which is annoying...

    in any case, I'll look over the tutorials and see what its like.

    Any more suggestions?
    Striving for proficiency...

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: OpenGL fonts

    I only see "FreeType 2" as requirement ? And not TrueType.

  5. #5
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Pennsylvannia
    Posts
    103

    Re: OpenGL fonts

    Thanks, ZbuffeR, I meant to say FreeType.

    But now I've got an interesting problem. I installed the FreeType 2 library (with some difficulty) and tried to run a test application to see if it was properly installed. And basically the worst thing imaginable happened, a syntax error was found in a header file of the library. Looking in, I found the following struct: (note the 'generic' and 'internal' fields)

    Code :
     typedef struct  FT_FaceRec_
      {
        FT_Long           num_faces;
        FT_Long           face_index;
     
        FT_Long           face_flags;
        FT_Long           style_flags;
     
        FT_Long           num_glyphs;
     
        FT_String*        family_name;
        FT_String*        style_name;
     
        FT_Int            num_fixed_sizes;
        FT_Bitmap_Size*   available_sizes;
     
        FT_Int            num_charmaps;
        FT_CharMap*       charmaps;
     
        FT_Generic        generic; 
     
        /*# The following member variables (down to `underline_thickness') */
        /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size    */
        /*# for bitmap fonts.                                              */
        FT_BBox           bbox;
     
        FT_UShort         units_per_EM;
        FT_Short          ascender;
        FT_Short          descender;
        FT_Short          height;
     
        FT_Short          max_advance_width;
        FT_Short          max_advance_height;
     
        FT_Short          underline_position;
        FT_Short          underline_thickness;
     
        FT_GlyphSlot      glyph;
        FT_Size           size;
        FT_CharMap        charmap;
     
        /*@private begin */
     
        FT_Driver         driver;
        FT_Memory         memory;
        FT_Stream         stream;
     
        FT_ListRec        sizes_list;
     
        FT_Generic        autohint;
        void*             extensions;
     
        FT_Face_Internal  internal;
     
        /*@private end */
     
      } FT_FaceRec;

    both fields, 'generic' and 'internal' of this struct, are recognized as keywords by my compiler (they are color coded in my editor) and so it naturally creates a syntax error.

    I googled the particular error, and found this post from a guy claiming to have the exact same problem: http://bytes.com/forum/thread655129.html

    a solution someone suggested in reply, was to try to use the preprocessor to redefine the term 'generic'. But I'm concerned about how to do that safely. I feel like I'd need to define the generic keyword, and then un-define it as soon as possible, in order to not screw up possible correct use of the 'generic' and 'internal' keywords.

    Still, this library seems to be widely used, how could this obvious problem exist?
    Striving for proficiency...

  6. #6
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,931

    Re: OpenGL fonts

    What compiler do you use?

  7. #7
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Pennsylvannia
    Posts
    103

    Re: OpenGL fonts

    Visual C++ 9.0 Express Edition
    Striving for proficiency...

  8. #8
    Senior Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    913

    Re: OpenGL fonts

    The generic keyword should be active only when the code is compiled with support for .NET (the /clr family of options). Unless you need that support for something, you can disable it and the default will again become ordinary identifier.

  9. #9
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Pennsylvannia
    Posts
    103

    Re: OpenGL fonts

    I see. How can I disable it?
    Striving for proficiency...

  10. #10
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Pennsylvannia
    Posts
    103

    Re: OpenGL fonts

    Hey, guys. I succesfully installed freetype on my system, but I'm finding precious little information on how to install quesoGLC. The docs folder has no installation info.

    I downloaded the binary files, with some libraries and dll's, and i THINK i put them in the right places. I'm able to compile and build quesoGLC but the program crashes at runtime, claiming fontconfig failed.

    I kind of thought the fontconfig library came with quesogGLC but i think I was mistaken now.

    In anycase, does anyone anything about this? I've been finding very little info on the web about it, for some odd reason.
    Striving for proficiency...

Page 1 of 3 123 LastLast

Similar Threads

  1. OpenGL and fonts
    By imported_xargon in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-10-2005, 10:44 AM
  2. bitmap fonts vs texture fonts
    By ehsan2004 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-31-2005, 03:24 AM
  3. Qt OpenGL and fonts help
    By itsmatt in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-01-2001, 05:41 AM
  4. Fonts in OpenGL
    By deepak_bajaj in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 02-04-2001, 12:41 PM
  5. Fonts in OpenGL
    By jesusgumbau in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 12-04-2000, 07:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean