[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re : Re : [Chicken-users] Scheme (LISP) editing

From: minh thu
Subject: Re : Re : [Chicken-users] Scheme (LISP) editing
Date: Fri, 2 Mar 2007 19:19:25 +0100

2007/3/2, Shawn Rutledge <address@hidden>:
On 3/2/07, minh thu <address@hidden> wrote:
> I'm on the gl-display api, have a working gl-display-glx
> implementation, have a working gl-font (based on freetype)
> font-loading and text-printing egg.


How are you rendering the text?  The choices are (AFAICT) use freetype
to generate bitmaps (maybe build a bitmap for each character/font
combination, or maybe render a word at a time or a line at a time) and
display them using glBitmap; use freetype to generate antialiased
pixmaps (same choices for characters, words or lines) and use them as
textures on top of polygons; or somehow convert the font to vertices
and render the text entirely as filled triangles.  I didn't see a way
that the results of glBitmap can be transformed - it goes straight to
the framebuffer, right?  Besides not being antialiased.  The third
method (vertices) might be slow (or is it nowadays?)  So I figured the
second method (textures) has the most promise.  But ideally it should
leverage the power of the GPU somehow, rather than involving Freetype
for every line of text every time it's drawn.  If you render a word at
a time, you can save them to GPU memory as textures and re-use them
every time that word with that font is shown, while still making use
of Freetype's hinting.  If you render a character at a time, the set
of textures becomes smaller, and you gain the ability to transform
each character (like for doing text along a path, for example) but
have to do hinting yourself.

From freetype, I'll query each glyph as a pixmap (8bits) and store
them in a single array of unsigned char. Yes, I do this C side because
I don't want to write a freetype binding.
Once it's done, I upload the array into video memory as a single
texture. Then I create a display list for each char. To render a
string, just call glCallLists. The c array is released since the
texture is held by opengl.
(I say "I" but I just used the technique from fltk and/or fox)

One think is a bit problematic : "each" glyph/char means nearly all
8bits ascii code, i.e. 256 chars. So there's no utf-8 support right
now. I don't know yet how to handle it, probably a system of cache.

The fact it's texture (on quads) means you can render in 3d, not only
in screen pixels.
Changing the color is just a call to glColor*.

If you find the thing not correct, just keep in mind it's early code
and I've nearly no experience ... and of course I accept help :)

> Everything is very loose and I will release them later, when I think
> it's worth to be seen (and ready for discussion (The loose aspect
> would make very poor discussion)).

I'd like to see it because I haven't written anything for text display
yet; maybe now I don't need to.

Well, I'll ask to Felix a little place for me svn-side.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]