/** * compile with: gcc -o displayMultiple02 displayMultiple02.c -lX11 -lGL */ #include #include #include #include #include #include static void testOrder(int reverseDestroyOrder, const char * msg); static int useXInitThreads = 0; static int useXLockDisplay = 0; int main(int nargs, char **vargs) { int arg=1; while(argscreen), vi->visual, AllocNone); attr.colormap = cmap; attr.border_pixel = 0; /* create a window in window mode*/ attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | StructureNotifyMask; *rWin = XCreateWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, width, height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel | CWColormap | CWEventMask, &attr); XMapRaised(dpy, *rWin); } void useGL(Display *dpy, Window win, GLXContext ctx, int width, int height) { glXMakeCurrent(dpy, win, ctx); glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0f); glViewport(0, 0, width, height); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glXSwapBuffers(dpy, win); glXMakeCurrent(dpy, 0, 0); }