Re: [PyOpenGL-Users] Exporting 3D extruded text to an OBJ file
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2010-01-13 19:37:17
|
David Morris wrote: > I would like to be able to export a string of 3D extruded text as an > OBJ or similar 3D file format, and I can't find any examples on the > internet. > > I have played around with the solid_font.py demo in the > OpenGLContext/tests/ folder, which uses FontTools to display the text, > but I don't know how to get that mesh data back out. It's not really set up to make it easy to get out. Each glyph that's created has contour and outline arrays, which are extracted by ttfquery.glyph.Glyph, but the advances and the like are all done at the Font level (OpenGLContext.scenegraph.text._fonttools and OpenGLContext.scenegraph.text.fonttools), without those you'd just have characters showing up piled on top of each other. That said, there's only maybe 1000 lines of code in all three modules, so if you want to extract the pieces you need you could likely do it in a few hours. The obscure stuff is all over in ttfquery, the stuff in OpenGLContext just takes the contours for each glyph and figures out how to render them based on a VRML97 font description. Good luck, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |