document.write('<div class="cpp" style="font-family: monospace;"><br />');
document.write('<span style="color: #0000ff;">void</span> displayString<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">char</span> string<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span>, <span style="color: #0000ff;">float</span> r, <span style="color: #0000ff;">float</span> g, <span style="color: #0000ff;">float</span> b, <span style="color: #0000ff;">int</span> cx, <span style="color: #0000ff;">int</span> y<span style="color: #000000;">&#41;</span><br />');
document.write('<span style="color: #000000;">&#123;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; glColor3f<span style="color: #000000;">&#40;</span>r, g, b<span style="color: #000000;">&#41;</span>; <span style="color: #ff0000;">// our fonts color</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">/* think of the following this way:<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * our center x is x.<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * take the length of our string and * by 9 for the char width<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * and thats how wide in pixels the resulting thing will be.<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * right?<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; * now, divide that by 2 to center it<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; */</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">int</span> x = cx - <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #0000dd;">strlen</span><span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span> * <span style="color: #0000dd;">9</span><span style="color: #000000;">&#41;</span> / <span style="color: #0000dd;">2</span><span style="color: #000000;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; y = y - <span style="color: #0000dd;">7</span>; <span style="color: #ff0000;">// y - ~(15 / 2). id rather not use float, so 7 isn\'t too diff than 7.5</span><br />');
document.write('<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">for</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i = <span style="color: #0000dd;">0</span>; i != <span style="color: #0000dd;">strlen</span><span style="color: #000000;">&#40;</span>string<span style="color: #000000;">&#41;</span> - <span style="color: #0000dd;">1</span>; ++i<span style="color: #000000;">&#41;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glRasterPos3f<span style="color: #000000;">&#40;</span>x, y, <span style="color: #0000dd;">0</span><span style="color: #000000;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glutBitmapCharacter<span style="color: #000000;">&#40;</span>GLUT_BITMAP_9_BY_15, string<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;<br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x = x + <span style="color: #0000dd;">9</span>; <span style="color: #ff0000;">// accomidate for the next letter</span><br />');
document.write('&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />');
document.write('<span style="color: #000000;">&#125;</span><br />');
document.write('&nbsp;</div>');
document.write('<br />&nbsp;<br /><div style="font-size: 12px">Brought to you by the community at <a href="http://www.bytemycode.com/snippets/snippet/431/1/" target="_blank">byteMyCode</a>.</div>');
