static int donesetup=0; if(!donesetup) { XGetWindowAttributes(dpy, win, &gwa); glViewport(0, 0, gwa.width, gwa.height); glClearColor(0, 1, 0, 1); glClear(GL_COLOR_BUFFER_BIT); donesetup = 1; }