FTTextureGlyph.h

Go to the documentation of this file.
00001 #ifndef     __FTTextureGlyph__
00002 #define     __FTTextureGlyph__
00003 
00004 
00005 #include <ft2build.h>
00006 #include FT_FREETYPE_H
00007 #include FT_GLYPH_H
00008 
00009 #include "FTGL.h"
00010 #include "FTGlyph.h"
00011 
00012 
00013 /**
00014  * FTTextureGlyph is a specialisation of FTGlyph for creating texture
00015  * glyphs.
00016  * 
00017  * @see FTGlyphContainer
00018  *
00019  */
00020 class FTGL_EXPORT FTTextureGlyph : public FTGlyph
00021 {
00022     public:
00023         /**
00024          * Constructor
00025          *
00026          * @param glyph     The Freetype glyph to be processed
00027          * @param id        The id of the texture that this glyph will be
00028          *                  drawn in
00029          * @param xOffset   The x offset into the parent texture to draw
00030          *                  this glyph
00031          * @param yOffset   The y offset into the parent texture to draw
00032          *                  this glyph
00033          * @param width     The width of the parent texture
00034          * @param height    The height (number of rows) of the parent texture
00035          */
00036         FTTextureGlyph( FT_GlyphSlot glyph, int id, int xOffset, int yOffset, GLsizei width, GLsizei height);
00037 
00038         /**
00039          * Destructor
00040          */
00041         virtual ~FTTextureGlyph();
00042 
00043         /**
00044          * Renders this glyph at the current pen position.
00045          *
00046          * @param pen   The current pen position.
00047          * @return      The advance distance for this glyph.
00048          */
00049         virtual const FTPoint& Render( const FTPoint& pen);
00050         
00051         /**
00052          * Reset the currently active texture to zero to get into a known state before
00053          * drawing a string. This is to get round possible threading issues.
00054          */
00055         static void ResetActiveTexture(){ activeTextureID = 0;}
00056         
00057     private:
00058         /**
00059          * The width of the glyph 'image'
00060          */
00061         int destWidth;
00062 
00063         /**
00064          * The height of the glyph 'image'
00065          */
00066         int destHeight;
00067 
00068         /**
00069          * Vector from the pen position to the topleft corner of the pixmap
00070          */
00071         FTPoint pos;
00072         
00073         /**
00074          * The texture co-ords of this glyph within the texture.
00075          */
00076         FTPoint uv[2];
00077         
00078         /**
00079          * The texture index that this glyph is contained in.
00080          */
00081         int glTextureID;
00082 
00083         /**
00084          * The texture index of the currently active texture
00085          *
00086          * We keep track of the currently active texture to try to reduce the number
00087          * of texture bind operations.
00088          */
00089         static GLint activeTextureID;
00090         
00091 };
00092 
00093 
00094 #endif  //  __FTTextureGlyph__

Generated on Tue Jul 5 14:16:16 2011 for ROOT_528-00b_version by  doxygen 1.5.1