- /*
- * The color map is required, too
- */
- winAttr.colormap = XCreateColormap(
- fgDisplay.Display, fgDisplay.RootWindow,
- window->Window.VisualInfo->visual, AllocNone
- );
+ window->State.IsOffscreen = GL_FALSE;
+ if( fgState.DisplayMode & GLUT_OFFSCREEN )
+ {
+ window->State.IsOffscreen = GL_TRUE;
+ window->Window.Pixmap = XCreatePixmap(
+ fgDisplay.Display, fgDisplay.RootWindow,
+ w, h,
+ window->Window.VisualInfo->depth
+ );
+ if( False != window->Window.Pixmap )
+ {
+ window->Window.Handle = glXCreateGLXPixmap(
+ fgDisplay.Display,
+ window->Window.VisualInfo,
+ window->Window.Pixmap
+ );
+ if( False == window->Window.Handle )
+ XFreePixmap( fgDisplay.Display, window->Window.Pixmap );
+ }
+ }
+ else
+ {
+ /*
+ * XXX HINT: the masks should be updated when adding/removing callbacks.
+ * XXX This might speed up message processing. Is that true?
+ * XXX
+ * XXX A: Not appreciably, but it WILL make it easier to debug.
+ * XXX Try tracing old GLUT and try tracing freeglut. Old GLUT
+ * XXX turns off events that it doesn't need and is a whole lot
+ * XXX more pleasant to trace. (Think mouse-motion! Tons of
+ * XXX ``bonus'' GUI events stream in.)
+ */
+ winAttr.event_mask =
+ StructureNotifyMask | SubstructureNotifyMask | ExposureMask |
+ ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyRelease |
+ VisibilityChangeMask | EnterWindowMask | LeaveWindowMask |
+ PointerMotionMask | ButtonMotionMask;
+ winAttr.background_pixmap = None;
+ winAttr.background_pixel = 0;
+ winAttr.border_pixel = 0;
+
+ winAttr.colormap = XCreateColormap(
+ fgDisplay.Display, fgDisplay.RootWindow,
+ window->Window.VisualInfo->visual, AllocNone
+ );