| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
| <title>FTGL: FTPolyGlyph.cpp Source File</title> |
| <link href="doxygen.css" rel="stylesheet" type="text/css"> |
| </head><body> |
| <!-- Generated by Doxygen 1.3.6 --> |
| <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div> |
| <h1>FTPolyGlyph.cpp</h1><a href="FTPolyGlyph_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#include "<a class="code" href="FTPolyGlyph_8h.html">FTPolyGlyph.h</a>"</span> |
| 00002 <span class="preprocessor">#include "<a class="code" href="FTVectoriser_8h.html">FTVectoriser.h</a>"</span> |
| 00003 |
| 00004 |
| <a name="l00005"></a><a class="code" href="classFTPolyGlyph.html#a0">00005</a> <a class="code" href="classFTPolyGlyph.html#a0">FTPolyGlyph::FTPolyGlyph</a>( FT_GlyphSlot glyph, <span class="keywordtype">bool</span> useDisplayList) |
| 00006 : <a class="code" href="classFTGlyph.html">FTGlyph</a>( glyph), |
| 00007 glList(0) |
| 00008 { |
| 00009 <span class="keywordflow">if</span>( ft_glyph_format_outline != glyph->format) |
| 00010 { |
| 00011 err = 0x14; <span class="comment">// Invalid_Outline</span> |
| 00012 <span class="keywordflow">return</span>; |
| 00013 } |
| 00014 |
| 00015 <a class="code" href="classFTVectoriser.html">FTVectoriser</a> vectoriser( glyph); |
| 00016 |
| 00017 <span class="keywordflow">if</span>(( vectoriser.<a class="code" href="classFTVectoriser.html#a5">ContourCount</a>() < 1) || ( vectoriser.<a class="code" href="classFTVectoriser.html#a4">PointCount</a>() < 3)) |
| 00018 { |
| 00019 <span class="keywordflow">return</span>; |
| 00020 } |
| 00021 |
| 00022 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> horizontalTextureScale = glyph->face->size->metrics.x_ppem * 64; |
| 00023 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> verticalTextureScale = glyph->face->size->metrics.y_ppem * 64; |
| 00024 |
| 00025 vectoriser.<a class="code" href="classFTVectoriser.html#a2">MakeMesh</a>( 1.0); |
| 00026 |
| 00027 <span class="keywordflow">if</span>( useDisplayList) |
| 00028 { |
| 00029 glList = glGenLists( 1); |
| 00030 glNewList( glList, GL_COMPILE); |
| 00031 } |
| 00032 |
| 00033 <span class="keyword">const</span> <a class="code" href="classFTMesh.html">FTMesh</a>* mesh = vectoriser.<a class="code" href="classFTVectoriser.html#a3">GetMesh</a>(); |
| 00034 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> index = 0; index < mesh-><a class="code" href="classFTMesh.html#a7">TesselationCount</a>(); ++index) |
| 00035 { |
| 00036 <span class="keyword">const</span> <a class="code" href="classFTTesselation.html">FTTesselation</a>* subMesh = mesh-><a class="code" href="classFTMesh.html#a8">Tesselation</a>( index); |
| 00037 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> polyonType = subMesh-><a class="code" href="classFTTesselation.html#a5">PolygonType</a>(); |
| 00038 |
| 00039 glBegin( polyonType); |
| 00040 <span class="keywordflow">for</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pointIndex = 0; pointIndex < subMesh-><a class="code" href="classFTTesselation.html#a3">PointCount</a>(); ++pointIndex) |
| 00041 { |
| 00042 <a class="code" href="classFTPoint.html">FTPoint</a> point = subMesh-><a class="code" href="classFTTesselation.html#a4">Point</a>(pointIndex); |
| 00043 |
| 00044 glTexCoord2f( point.<a class="code" href="classFTPoint.html#a7">X</a>() / horizontalTextureScale, |
| 00045 point.<a class="code" href="classFTPoint.html#a8">Y</a>() / verticalTextureScale); |
| 00046 |
| 00047 glVertex3f( point.<a class="code" href="classFTPoint.html#a7">X</a>() / 64.0f, |
| 00048 point.<a class="code" href="classFTPoint.html#a8">Y</a>() / 64.0f, |
| 00049 0.0f); |
| 00050 } |
| 00051 glEnd(); |
| 00052 } |
| 00053 |
| 00054 <span class="keywordflow">if</span>(useDisplayList) |
| 00055 { |
| 00056 glEndList(); |
| 00057 } |
| 00058 } |
| 00059 |
| 00060 |
| <a name="l00061"></a><a class="code" href="classFTPolyGlyph.html#a1">00061</a> <a class="code" href="classFTPolyGlyph.html#a1">FTPolyGlyph::~FTPolyGlyph</a>() |
| 00062 { |
| 00063 glDeleteLists( glList, 1); |
| 00064 } |
| 00065 |
| 00066 |
| <a name="l00067"></a><a class="code" href="classFTPolyGlyph.html#a2">00067</a> <span class="keyword">const</span> <a class="code" href="classFTPoint.html">FTPoint</a>& <a class="code" href="classFTPolyGlyph.html#a2">FTPolyGlyph::Render</a>( <span class="keyword">const</span> <a class="code" href="classFTPoint.html">FTPoint</a>& pen) |
| 00068 { |
| 00069 glTranslatef( pen.<a class="code" href="classFTPoint.html#a7">X</a>(), pen.<a class="code" href="classFTPoint.html#a8">Y</a>(), 0.0f); |
| 00070 |
| 00071 <span class="keywordflow">if</span>( glList) |
| 00072 { |
| 00073 glCallList( glList); |
| 00074 } |
| 00075 |
| 00076 <span class="keywordflow">return</span> advance; |
| 00077 } |
| </pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Dec 5 22:24:06 2004 for FTGL by |
| <a href="http://www.doxygen.org/index.html"> |
| <img src="doxygen.png" alt="doxygen" align="middle" border=0 > |
| </a>1.3.6 </small></address> |
| </body> |
| </html> |