[info-performer] Random colors with fonts

Date view Thread view Subject view Author view

From: Tiziano Diamanti (t.diamanti++at++cineca.it)
Date: 09/14/2005 05:29:02


Hi,
I have my OpenGL routine called from the Draw call-back.
Font rendering works nicely on a PC Windows or Linux with
Nvidia card, but on Prism and on a PC with ATI (guess waht...)
card the fonts seem to be rendered with a random color that also
changes per every frame rendered.
On Prism also, the color is differemt per every pipeline where the
font is rendered, and also changes per every frame.
The routine is the classic OpenGL routine for creating display lists
from a system font and then render them (on Windows font loading is
different):

void loadXFont(void)
{
    Display *xdisplay;

    // get font from X Server
    xdisplay = pfGetCurWSConnection();
    fontInfo = XLoadQueryFont(xdisplay, fontName);
    if(fontInfo == NULL){
        pfNotify(PFNFY_FATAL, PFNFY_USAGE, "loadXFont: Couldn't load X
font\n");
        exit(1);
    }

    // Create GL display lists for font
    pfNotify(PFNFY_NOTICE, PFNFY_PRINT, "loadXFont: making X font display "
        "lists\n");
    fontDLHandle = glGenLists((GLuint) LASTGLYPH + 1);
    if(fontDLHandle == 0)
    {
        pfNotify(PFNFY_FATAL, PFNFY_USAGE, "loadXFont: Couldn't get %d "
            "display lists\n", LASTGLYPH + 1);
        exit(1);
    }
    glXUseXFont(fontInfo->fid, FIRSTGLYPH, LASTGLYPH - FIRSTGLYPH + 1,
        fontDLHandle + FIRSTGLYPH);
}

then

glListBase(fontDLHandle);
glCallLists(strlen(s), GL_UNSIGNED_BYTE, (GLubyte *)s);

Thanks

-- 
Tiziano Diamanti
HPC and Visualization
Cineca
Italy

Tel. +39-051-6171717


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Sep 14 2005 - 05:29:21 PDT