[GtkGLExt] Pango rendering



   I've been fooling around with gtkglext packages in conjunction
with sonar spectrum analysis (I cant believe my job actualy pays
me for that ;-) to create groovy OpenGL plugins with album jackets
and song titles etc.

   I've noticed in the example codes in gtkglext that rendering fonts
to texture surfaces from pango layouts requires some intimate knowlage
of the FreeType bitmap, i.e. code that looks like:

do {
  row -= bitmap.width;
  for (i = 0; i < bitmap.width; i++)
#if !defined(GL_VERSION_1_2) && G_BYTE_ORDER == G_LITTLE_ENDIAN
     *t++ = rgb | (((guint32) (a * row[i])) << 24);
#else
     *t++ = rgb | ((guint32) (a * row[i]));
#endif
} while (row != row_end);

Right now, the only way I see around this (admitting that I only spent the
afternoon on this bugger) is possibly using gdk_draw_layout() onto an
offscreen GdkPixmap, and obtaining the pixeldata to feed to glTexSubImage2D.

And even there, I might have to go to quite an extent to obtain the pixel
data (GdkPixmap --> GdkPixbuf --> GdkPixdata ?).

As I draft this email, I'm thinking, what if we were to derive a GdkDrawable
that represents an OpenGL texture ? (maybe that would be a little too rigid ?)

Any ideas or views as to how this "should be done" (and "could be done" ;-) ?

Cheers,
                              -Tristan

PS: I'll be gone for the weekend so I wont be around to discuss this
    untill monday.





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