XdrawString+double buffer

dragoran dragoran at feuerpokemon.de
Tue Aug 1 06:03:17 PDT 2006


dragoran wrote:
> Brian Paul wrote:
>> dragoran wrote:
>>> Brian Paul wrote:
>>>
>>>> dragoran wrote:
>>>>
>>>>> 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); }
>>>>
>>>>
>>>> It might work better to put the XDrawString() call after the 
>>>> SwapBuffers().
>>>>
>>>> Also, you may need a glXWaitGL() call between them.
>>>>
>>>> -Brian
>>>>
>>>>
>>> hello
>>> now I have tryed with
>>> pglXSwapBuffers(dpy, drawable);
>>>    glXWaitGL();
>>>    XDrawString(dpy,drawable, maingc, 20, 50, "test",4);
>>> the only thing that this causes are lower framerates but teh 
>>> flickering isn't gone
>>
>> I guess the only flicker-free solution is to draw the text with 
>> OpenGL commands prior to SwapBuffers().  Have you tried 
>> glWindowPos/glBitmap()?
>>
>> -Brian
>>
>>
> will try the glWindowPos stuff now... (and tell you if it worked)
> _______________________________________________
> xorg mailing list
> xorg at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xorg
>
>
use glWindowPos and glDrawPixels works in anything but ut2004
using glWindowPos + glBitmap does not work at all (nothing gots drawn)




More information about the xorg mailing list