<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>notes from the bigfug &#187; freetype2</title>
	<atom:link href="http://www.bigfug.com/tag/freetype2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bigfug.com</link>
	<description>programming light and other strange tales</description>
	<lastBuildDate>Mon, 07 Jun 2010 13:47:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding FreeType2 support to PatchBox</title>
		<link>http://www.bigfug.com/2009/06/05/adding-freetype2-support-to-patchbox/</link>
		<comments>http://www.bigfug.com/2009/06/05/adding-freetype2-support-to-patchbox/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 16:50:09 +0000</pubDate>
		<dc:creator>Alex May</dc:creator>
				<category><![CDATA[PatchBox]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[freetype2]]></category>
		<category><![CDATA[GLU]]></category>
		<guid isPermaLink="false">http://www.bigfug.com/2009/06/05/adding-freetype2-support-to-patchbox/</guid>
		<description><![CDATA[It?s well overdue, but am finally getting around to adding font support to PatchBox.&#160; Rather than using bitmap based fonts, I thought it would be fun to use the font outlines and create proper 3D models.&#160; Here?s how it went:
&#160;
Having extracted the glyph outline using FreeType2, let?s draw it with GL_LINES? ah?
GL_LINE_STRIP isn?t correct either?
Ah, [...]]]></description>
			<content:encoded><![CDATA[<p>It?s well overdue, but am finally getting around to adding font support to PatchBox.&#160; Rather than using bitmap based fonts, I thought it would be fun to use the font outlines and create proper 3D models.&#160; Here?s how it went:</p>
<p><a href="http://www.bigfug.com/wp-content/uploads/2009/06/200906050002.png"><img title="2009-06-05 - 0002" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="188" alt="2009-06-05 - 0002" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050002-thumb.png" width="244" border="0" /></a>&#160;</p>
<p>Having extracted the glyph outline using FreeType2, let?s draw it with GL_LINES? ah?</p>
<p><a href="http://www.bigfug.com/wp-content/uploads/2009/06/200906050006.png"><img title="2009-06-05 - 0006" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="184" alt="2009-06-05 - 0006" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050006-thumb.png" width="244" border="0" /></a></p>
<p>GL_LINE_STRIP isn?t correct either?</p>
<p><a href="http://www.bigfug.com/wp-content/uploads/2009/06/200906050007.png"><img title="2009-06-05 - 0007" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="184" alt="2009-06-05 - 0007" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050007-thumb.png" width="244" border="0" /></a></p>
<p>Ah, good old GL_LINE_LOOP?</p>
<p><a href="http://www.bigfug.com/wp-content/uploads/2009/06/200906050005.png"><img title="2009-06-05 - 0005" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="184" alt="2009-06-05 - 0005" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050005-thumb.png" width="244" border="0" /></a>&#160; </p>
<p>Initially, adding conic and cubic curves didn?t go quite as planned?</p>
<p><img title="2009-06-05 - 0008" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="184" alt="2009-06-05 - 0008" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050008-thumb.png" width="244" border="0" /></p>
<p>Better, but FreeType2 uses long?s to position data, resulting in the rather wobbly lines.</p>
<p><a href="http://www.bigfug.com/wp-content/uploads/2009/06/200906050009.png"><img title="2009-06-05 - 0009" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="184" alt="2009-06-05 - 0009" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050009-thumb.png" width="244" border="0" /></a></p>
<p>Converting to double?s does the trick nicely?</p>
<p><img title="2009-06-05 - 0010" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="184" alt="2009-06-05 - 0010" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050010-thumb.png" width="244" border="0" /></p>
<p>Now, lets? fill the outlines using gluTesselate() ? oh, FreeType2 uses NONZERO winding by default, whereas GLU uses ODD?</p>
<p><a href="http://www.bigfug.com/wp-content/uploads/2009/06/200906050013.png"><img title="2009-06-05 - 0013" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="172" alt="2009-06-05 - 0013" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050013-thumb.png" width="244" border="0" /></a></p>
<p>That?s looking better, but there?s still a problem?</p>
<p><img title="2009-06-05 - 0014" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="161" alt="2009-06-05 - 0014" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050014-thumb.png" width="244" border="0" /></p>
<p>Some characters are being drawn weirdly!&#160; Turns out to be a problem with my GLU_TESS_COMBINE_DATA routine.&#160; I?m using a custom vertex format, which I thought was what you returned from your combine callback, but no, you have to return an allocated GLdouble[ 3 ] and remember it so it can be freed later.</p>
<p><img title="2009-06-05 - 0015" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="174" alt="2009-06-05 - 0015" src="http://www.bigfug.com/wp-content/uploads/2009/06/200906050015-thumb.png" width="244" border="0" /></p>
</p>
<p>The finished result!&#160; All nice and smooth and stored away in vertex array ready for dumping to a VBO?</p>
<p>Next up will be creating a whole string, then multiple lines, then adding depth, colours, textures, etc!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bigfug.com/2009/06/05/adding-freetype2-support-to-patchbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
