XdrawString+double buffer

dragoran dragoran at feuerpokemon.de
Mon Jul 31 08:01:17 PDT 2006


Hello
I am working on a wrapper around glxSwapbuffers. I want to display text 
in openglapps.
I have tryed many different things like textures,gldrawpixels, etc. but 
none of the works in all apps.
ut2004 does not even like the gldrawpixel version.
so I tryed using Xdrawstring which works in all of this apps but it 
flackers because of double buffering.
how can I avoid this?
here is my code, it simply displays "test" on the appwindow...

void glXSwapBuffers(Display* dpy, GLXDrawable drawable) {
#ifdef DEBUG
    fprintf(stderr,"about to draw hud ;)\n");
#endif
    Colormap cmap;
    XColor c0, c1;
    cmap = DefaultColormap(dpy, 0);
    XAllocNamedColor(dpy, cmap, "red", &c1, &c0);
    XGCValues values;
    GC maingc=XCreateGC(dpy, drawable, 0 ,&values);
    XSetForeground(dpy, maingc, c1.pixel);  
    XDrawString(dpy,drawable, maingc, 20, 50, "test",4);
    pglXSwapBuffers(dpy, drawable); 
}



More information about the xorg mailing list