#include #include #include int gltest() { Display* _display; Window _windowHandle; XVisualInfo* _visual; GLXContext _context; Atom _deleteWindowMessage; Atom _pingWindowMessage; _display = XOpenDisplay( NULL ); int attributes[] = { GLX_RGBA, GLX_DOUBLEBUFFER, GLX_RED_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_ALPHA_SIZE, 8, GLX_DEPTH_SIZE, 8, GLX_STENCIL_SIZE, 0, 0 }; _visual = glXChooseVisual( _display, DefaultScreen( _display ), attributes ); _context = glXCreateContext( _display, _visual, 0, GL_TRUE ); Colormap colormap; colormap = XCreateColormap( _display, RootWindow( _display, _visual->screen ), _visual->visual, AllocNone ); XSetWindowAttributes windowAttributes; windowAttributes.colormap = colormap; windowAttributes.border_pixel = 0; windowAttributes.event_mask = ExposureMask | StructureNotifyMask; _windowHandle = XCreateWindow( _display, RootWindow( _display, _visual->screen ), 0, 0, 1280, 720, 0, // Borderwidth _visual->depth, // Depth InputOutput, _visual->visual, CWBorderPixel | CWColormap | CWEventMask, &windowAttributes ); XFreeColormap( _display, colormap ); XMapWindow( _display, _windowHandle ); glXMakeCurrent( _display, _windowHandle, _context ); sleep( 3 ); XUnmapWindow( _display, _windowHandle ); XDestroyWindow( _display, _windowHandle ); glXMakeCurrent( _display, None, NULL ); glXDestroyContext( _display, _context ); XFree( _visual ); XCloseDisplay( _display ); return 0; }