Dark Bit Factory & Gravity

PROGRAMMING => General coding questions => Topic started by: Raizor on March 01, 2012

Title: Best way to convert windows font to a mesh in OpenGL
Post by: Raizor on March 01, 2012
I've been hunting around trying to find some info on creating a mesh from a windows font on the local system in OpenGL. It seems it's a lot easier to do in DirectX than OpenGL. Has anyone done anything like this before or know of a resource with info please? 
Title: Re: Best way to convert windows font to a mesh in OpenGL
Post by: hellfire on March 01, 2012
How about wglUseFontOutlines (http://msdn.microsoft.com/en-us/library/dd374393%28v=vs.85%29.aspx) ?
Title: Re: Best way to convert windows font to a mesh in OpenGL
Post by: Raizor on March 01, 2012
Yeah, I came across wglUseFontOutlines before Hellfire. Unless I'm mistaken, that's just for drawing characters rather than getting access to vertrices. I'd like to be able to distort the text and do funky stuff with it. Something like D3DXCreateText (http://msdn.microsoft.com/en-us/library/windows/desktop/bb172799(v=vs.85).aspx). Maybe it's time to switch from GL to DirectX, as pretty much everything I do is Windows based at the moment.
Title: Re: Best way to convert windows font to a mesh in OpenGL
Post by: hellfire on March 01, 2012
I'd like to be able to distort the text and do funky stuff with it.
Like... with a vertex shader? ;)

Of course you can use a lib like freetype (http://www.freetype.org/freetype2/index.html) to access the font data.
But you're probably looking for an intro-size compatible solution?
Then again, you probably don't want to use default sytem fonts, either.
So you'll end up converting your data into some custom optimized format anyway...
Title: Re: Best way to convert windows font to a mesh in OpenGL
Post by: Raizor on March 01, 2012
Doh! I didn't think of using a vertex shader. Thanks, that's probably the way to go :)
Title: Re: Best way to convert windows font to a mesh in OpenGL
Post by: energy on March 03, 2012
Hi Raizor.
I have a small solution, but not the best for Intros. If yu are a bit familar with blender
there is an export script in attachment, which writes a c-header file yu can use with vbo.

In Blender:
-Add a text with font yu want to use.
-Be in Object-Mode
-Then use  the Folder "Object"->"Convert to"->"Mesh from Curve/Text"   (It converts text to               Mesh, now yu can switch to wireframe mode to test!)
-now yu can choose to text and export with the export script.

I used blender 2.59 for the script cause with 2.6 they changed things on the script-engine.
yu are also able to improve the script easily eg. if yu dont want normals in export....

Raizor text includes the vertices for the Text "Raizor is coool !!!!"

here is the example to show directly(also as .h in attachment!.)
have fun!

Raizor_Text.h:
Code: [Select]

/* Exported from Blender */
#define VERTEX_COUNT 1517
#define FACES_COUNT 1487
#ifndef VERTEX_STRUCT
#define VERTEX_STRUCT
struct vertex_struct{
float x, y, z;
float nx,ny,nz;
float u,v;
};
#endif
struct vertex_struct vertexs[]=
{
{7.587888, 0.110450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.604113, 0.110450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.596001, 0.111000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.580098, 0.108847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.611903, 0.108847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.572703, 0.106266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.619297, 0.106266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.565778, 0.102778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.626222, 0.102778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.559394, 0.098457, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.632606, 0.098457, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.553625, 0.093375, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.638375, 0.093375, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.548543, 0.087606, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.643457, 0.087606, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.544222, 0.081222, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.647778, 0.081222, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.540734, 0.074297, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.651266, 0.074297, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.538153, 0.066903, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.653848, 0.066903, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.536550, 0.059113, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.655450, 0.059113, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.656001, 0.051000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.536001, 0.051000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.536551, 0.042887, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.655451, 0.042887, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.653849, 0.035097, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.538154, 0.035097, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.651267, 0.027703, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.540735, 0.027703, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.647779, 0.020778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.544223, 0.020778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.548544, 0.014394, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.643458, 0.014394, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.553626, 0.008625, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.638376, 0.008625, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.559395, 0.003543, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.632607, 0.003543, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.565779, -0.000778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.626223, -0.000778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.572704, -0.004266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.619298, -0.004266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.580099, -0.006847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.611904, -0.006847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.587889, -0.008450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.604114, -0.008450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.596001, -0.009000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.585916, 0.689979, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.604085, 0.689979, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.595001, 0.691000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.577658, 0.686912, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.612343, 0.686912, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.570219, 0.681797, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.619781, 0.681797, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.563593, 0.674630, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.626408, 0.674630, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.557772, 0.665407, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.632228, 0.665407, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.552750, 0.654125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.637250, 0.654125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.548520, 0.640781, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.641481, 0.640781, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.545074, 0.625370, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.644927, 0.625370, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.542406, 0.607891, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.647594, 0.607891, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.540509, 0.588338, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.649491, 0.588338, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.539376, 0.566709, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.650624, 0.566709, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.539001, 0.543000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.651000, 0.543000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.539042, 0.532167, 0.000000, 0.000000, -0.000000, 1.000000, 0.0, 0.0},
{7.650959, 0.532167, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.650834, 0.521671, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.539167, 0.521671, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.650626, 0.511516, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.539375, 0.511516, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.650334, 0.501704, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.539667, 0.501704, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.649959, 0.492239, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.540042, 0.492239, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.649501, 0.483125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.540500, 0.483125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.648959, 0.474365, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.541042, 0.474365, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.648334, 0.465963, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.541667, 0.465963, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.647625, 0.457922, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.542376, 0.457922, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.646834, 0.450245, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.543167, 0.450245, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.645959, 0.442937, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.544042, 0.442937, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.645000, 0.436000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.545001, 0.436000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.570001, 0.264000, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.620000, 0.264000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.571505, 0.253517, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.618496, 0.253517, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.573033, 0.244056, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.616968, 0.244056, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.574610, 0.235594, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.615391, 0.235594, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.576260, 0.228111, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.613741, 0.228111, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.578007, 0.221587, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.611994, 0.221587, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.579875, 0.216000, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.610126, 0.216000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.581890, 0.211330, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.608111, 0.211330, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.584074, 0.207556, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.605927, 0.207556, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.586453, 0.204656, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.603548, 0.204656, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.589051, 0.202611, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.600950, 0.202611, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.591892, 0.201399, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.598109, 0.201399, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.595001, 0.201000, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.316888, 0.110450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.333113, 0.110450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.325001, 0.111000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.309098, 0.108847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.340903, 0.108847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.301703, 0.106266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.348297, 0.106266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.294778, 0.102778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.355222, 0.102778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.288394, 0.098457, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.361606, 0.098457, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.282625, 0.093375, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.367375, 0.093375, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.277544, 0.087606, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.372457, 0.087606, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.273222, 0.081222, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.376778, 0.081222, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.269734, 0.074297, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.380266, 0.074297, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.267153, 0.066903, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.382848, 0.066903, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.265550, 0.059113, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.384450, 0.059113, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.385001, 0.051000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.265001, 0.051000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.265551, 0.042887, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.384451, 0.042887, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.382849, 0.035097, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.267154, 0.035097, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.380267, 0.027703, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.269735, 0.027703, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.376779, 0.020778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.273223, 0.020778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.277544, 0.014394, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.372458, 0.014394, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.282626, 0.008625, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.367376, 0.008625, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.288395, 0.003543, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.361607, 0.003543, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.294779, -0.000778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.355223, -0.000778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.301704, -0.004266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.348298, -0.004266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.309099, -0.006847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.340904, -0.006847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.316889, -0.008450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.333114, -0.008450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.325001, -0.009000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.314916, 0.689979, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.333085, 0.689979, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.324001, 0.691000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.306658, 0.686912, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.341343, 0.686912, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.299219, 0.681797, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.348782, 0.681797, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.292593, 0.674630, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.355408, 0.674630, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.286772, 0.665407, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.361228, 0.665407, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.281750, 0.654125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.366251, 0.654125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.277520, 0.640781, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.370481, 0.640781, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.274074, 0.625370, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.373927, 0.625370, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.271406, 0.607891, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.376595, 0.607891, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.269509, 0.588338, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.378491, 0.588338, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.268376, 0.566709, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.379624, 0.566709, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.268001, 0.543000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.380001, 0.543000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.268042, 0.532167, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.379959, 0.532167, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.379834, 0.521671, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.268167, 0.521671, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.379626, 0.511516, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.268375, 0.511516, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.379334, 0.501704, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.268667, 0.501704, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.378959, 0.492239, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.269042, 0.492239, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.378501, 0.483125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.269500, 0.483125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.377959, 0.474365, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.270042, 0.474365, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.377334, 0.465963, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.270667, 0.465963, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.376626, 0.457922, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.271376, 0.457922, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.375834, 0.450245, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.272167, 0.450245, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.374959, 0.442937, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.273042, 0.442937, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.374001, 0.436000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.274001, 0.436000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.299001, 0.264000, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.349000, 0.264000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.300505, 0.253517, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.347497, 0.253517, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.302033, 0.244056, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.345968, 0.244056, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.303610, 0.235594, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.344391, 0.235594, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.305260, 0.228111, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.342741, 0.228111, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.307007, 0.221587, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.340994, 0.221587, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.308876, 0.216000, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.339126, 0.216000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.310890, 0.211330, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.337111, 0.211330, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.313075, 0.207556, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.334927, 0.207556, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.315454, 0.204656, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.332548, 0.204656, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.318051, 0.202611, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.329950, 0.202611, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.320892, 0.201399, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.327109, 0.201399, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.324001, 0.201000, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.045888, 0.110450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.062113, 0.110450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.054001, 0.111000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.038098, 0.108847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.069903, 0.108847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.030704, 0.106266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.077297, 0.106266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.023778, 0.102778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.084222, 0.102778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.017395, 0.098457, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.090606, 0.098457, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.011625, 0.093375, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.096375, 0.093375, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.006544, 0.087606, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.101457, 0.087606, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.002223, 0.081222, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.105778, 0.081222, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.998734, 0.074297, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.109266, 0.074297, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.996153, 0.066903, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.111848, 0.066903, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.994550, 0.059113, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.113451, 0.059113, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.114001, 0.051000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.994001, 0.051000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.994551, 0.042887, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.113451, 0.042887, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.111849, 0.035097, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.996154, 0.035097, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.109267, 0.027703, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.998735, 0.027703, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.105779, 0.020778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.002223, 0.020778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.006545, 0.014394, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.101458, 0.014394, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.011626, 0.008625, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.096376, 0.008625, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.017395, 0.003543, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.090607, 0.003543, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.023779, -0.000778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.084223, -0.000778, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.030704, -0.004266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.077298, -0.004266, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.038099, -0.006847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.069904, -0.006847, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.045889, -0.008450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.062114, -0.008450, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.054001, -0.009000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.043916, 0.689979, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.062085, 0.689979, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.053001, 0.691000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.035658, 0.686912, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.070343, 0.686912, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.028219, 0.681797, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.077782, 0.681797, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.021593, 0.674630, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.084408, 0.674630, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.015772, 0.665407, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.090229, 0.665407, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.010750, 0.654125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.095251, 0.654125, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.006520, 0.640781, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.099481, 0.640781, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.003074, 0.625370, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.102927, 0.625370, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.000406, 0.607891, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.105595, 0.607891, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.998509, 0.588338, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.107491, 0.588338, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.997376, 0.566709, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.108624, 0.566709, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.997001, 0.543000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.109001, 0.543000, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
{6.997042, 0.532167, 0.000000, -0.000000, 0.000000, 1.000000, 0.0, 0.0},
{7.108959, 0.532167, 0.000000, 0.000000, 0.000000, 1.000000, 0.0, 0.0},
(...)
Edited by Padman. Code tags fixed and example shortened due to display problems.
Title: Re: Best way to convert windows font to a mesh in OpenGL
Post by: Raizor on March 03, 2012
Thanks Energy, very kind of you to take the time to put this together :)

This would certainly be a good solution for using non-standard fonts, so I'll certainly keep it for reference.

I have an idea using the wglUseFontOutlines stuff Hellfire mentioned. I should be able to use that with a vertex shader and then pass the vertex info onto a fragment shader and store the coordinates in a texture. Hopefully I can then pull the vertex info back out of the texture and construct a mesh. If that works it should have very little overhead size wise. It won't work for non standard fonts though.

Cheers,

Raizor
Title: Re: Best way to convert windows font to a mesh in OpenGL
Post by: energy on March 03, 2012
that would be nice, if yu ll post the solution, if yu find a way to do... ;)