Opengl, Gtkglarea, Resize bug?

When using Gtk apps using gtkglarea (glchess for example), resizing gives me strange behaviour…
I’m using nvidia driver (2880)
Anyone else seen this ?

Can you confirm if you’re using other driver under linux ?

I 've noticed that this bug doesn’t appear in mesa software mode…

Originally posted by Kuranes:

Can you confirm if you’re using other driver under linux ?


Could you be slightly more specific?

– Niels

If when you resize the window of a Gtkglarea application, you get a canvas that is corrupted…
(as when you gldrawpixel a bitmap allocated but without initializing/filling it)
Mail here… with your driver name
And if when you resize a window, all is correct and you have a nvidia card…
Mail here…
So that I can know that it’s my configuration fault or a gtkglarea problem…
(all resize with motif or glut opengl application works fine here, but gtkglarea apps give me corrupted resizing)

Do the window redraws correct if you iconify it and then restore? It does not has to be a bug in Gtkglarena. I know of two traps with resing:

  1. You have to call glXWaitX() in your resize code
  2. This is just a problem if the window is shrinked. I had this problem with Motif programs but found the solution in the programming manual. If you are interested can you download it here

Here is the interesting part:

A frequent problem encountered in using the DrawingArea widget is the need to redraw
after every Resize event. When you enlarge the DrawingArea window, an Expose event
is automatically generated since more of the window becomes exposed. But, if you shrink
the window, no Expose event is generated since no new part of the window is being

The reason why no Expose event is generated when you shrink a DrawingArea widget is
deep inside Xlib. The bit gravity of a window indicates where new bits are placed
automatically by X when a window is resized. If you resize a window larger, then the data
in the window remains in the top-left corner and the application gets a Resize event and
an Expose event. The Expose event just identifies the newly exposed area, not the entire
window. If you make the window smaller, all of the data in the window gets pushed to the
top left; there is no newly exposed area, so there is no Expose event.

The solution is to make the window forget about bit gravity, so every Resize event causes
all of the bits to be cleared. As a result, the Expose event identifies the entire window as
being exposed, instead of just the newly exposed region. This technique has the side effect
of generating an Expose event even when the window is resized smaller.

There is no routine to set the bit gravity of a window individually. It can be set only with
XChangeWindowAttributes(), as in the following code fragment:

		   XSetWindowAttributes attrs;
		   attrs.bit_gravity = ForgetGravity;
		   XChangeWindowAttributes (XtDisplay (drawing_area),
		   XtWindow (drawing_area), CWBitGravity, &attrs);

Once you do this, the DrawingArea widget gets Expose events when you resize it to be

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.