[PyOpenGL-Users] rendering fonts using pygame
Brought to you by:
mcfletch
From: fulko <vw...@fv...> - 2004-10-14 08:53:39
|
Hello, The font rendering problem kept me busy for some time now. I tried to use OpenGLContext to draw various fonts in OpenGL under Python, unfortunately without success. To solve the problem I started to dissect the files in scenegraph/text, but without much result. My goal is to select one TTF-file (e.g. arial.ttf), use the PyGame library to render the font in a particular size (preferably anti-aliased), and put the result in my OpenGL buffer. This is my understanding of the process until now: Pygamefont.py provides PyGameBitmapFont that can be used to create a font object. Then createChar can be used to compile a display list for each character desired. Font.py seems to provide the routines to convert a string into a list of display lists, and put these in the colour buffer. My idea is changing the routines so I can do something like this: x=PyGameBitmapFont('arial.ttf',20) textstring='My Text' lines=[] for c in textstring: lines.append(x.createChar(c,'anti-aliased')) BitmapFontMixIn.leftJustify(lines,pos) I would like to make the code as lean as possible, so I can understand the process and tune it to my needs. Am I on the right way? Thanks, Fulko |