Requests that a GLX drawable receive GLX events.
OpenGL C bindings library: libGL.a
void glXSelectEvent(Display *dpy,
GLXDrawable drawable,
unsigned long eventmask)
The glXSelectEvent subroutine is used to allow the application to receive GLX events for a specified GLX drawable (drawable). Calling glXSelectEvent overrides any previous event mask that was set by the application for drawable.
GLX events are returned in the X11 event stream. The GLX event mask is private to GLX (it is separate from the X11 event mask) and a separate GLX event mask is maintained in the server for each client for each drawable.
Currently, only one GLX event can be selected, by setting eventmask to GLX_PBUFFER_CLOBBER_MASK. The data structure describing a GLX pbuffer clobber event is:
typedef struct { | |||
int | event_type; | /* This will have a value of GLX_DAMAGED or GLX_SAVE */ | |
int | draw_type; | /* This will have a value of GLX_WINDOW or GLX_PBUFFER */ | |
unsigned long | serial; | /* Number of last request processed by X server */ | |
Bool | send_event; | /* Whether the event was generated by a SendEvent request */ | |
Display * | display; | /* The display that the event was read from */ | |
GLXDrawable | drawable; | /* XID of the GLX drawable */ | |
unsigned int | buffer_mask; | /* Mask indicating which buffers are affected. */ | |
unsigned int | aux_buffer; | /* Mask indicating which aux buffer was affected */ | |
int | x, y; | /* Location of the area clobbered in the GLX drawable */ | |
int | width, height; | /* Size of the area clobbered in the GLX drawable */ | |
int | count; | /* If non-zero, at least this many more events exist */ | |
} GLX_PbufferClobberEvent; |
The masks that represent the clobbered buffers are defined as:
Bitmask | Corresponding Buffer |
---|---|
GLX_FRONT_LEFT_BUFFER_BIT | Front left color buffer |
GLX_FRONT_RIGHT_BUFFER_BIT | Front right color buffer |
GLX_BACK_LEFT_BUFFER_BIT | Back left color buffer |
GLX_BACK_RIGHT_BUFFER_BIT | Back right color buffer |
GLX_AUX_BUFFERS_BIT | Auxiliary buffer |
GLX_DEPTH_BUFFER_BIT | Depth buffer |
GLX_STENCIL_BUFFER_BIT | Stencil buffer |
GLX_ACCUM_BUFFER_BIT | Accumulation buffer |
A single X server operation can cause several pbuffer clobber events to be sent. Each event specifies one region of the GLX drawable that was affected by the operation. buffer_mask indicates which color or ancillary buffers were affected. When the GLX_AUX_BUFFERS_BIT is set in buffer_mask, then aux_buffer is set to indicate which buffer was affected. If more than one aux buffer was affected then additional events are generated. For non-stereo drawables, GLX_FRONT_LEFT_BUFFER_BIT and GLX_BACK_LEFT_BUFFER_BIT are used to specify the front and back color buffers.
For preserved pbuffers, a pbuffer clobber event, that has event_type set to GLX_SAVED, is generated whenever the contents of a pbuffer has to be moved to avoid being damaged. The event (or events) describes which portions of the pbuffer were affected. Application who receive many pbuffer clobber events, which refer to different save actions, should consider freeing the pbuffer resource to prevent the system from thrashing due to insufficient resources.
For an unpreserved pbuffer, a pbuffer clobber event, that has event_type set to GLX_DAMAGED, is generated whenever a portion of the pbuffer becomes invalid.
dpy | Specifies the connection to the X server. |
drawable | Specifies a GLX window or GLX pbuffer. |
eventmask | Specifies the GLX events that drawable will receive. |
GLXBadDrawable | Is generated if drawable is not a valid GLX window or GLX pbuffer. |
/usr/include/GL/gl.h | Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL. |
/usr/include/GL/glx.h | Contains C language constants, variable type definitions, and ANSI function prototypes for GLX. |
The glXCreatePbuffer subroutine, glXCreateWindow subroutine.
OpenGL in the AIXwindows (GLX) Environment.