Example #1
0
/*
 * Closes a window, destroying the frame and OpenGL context
 */
void fgPlatformCloseWindow( SFG_Window* window )
{
#ifdef EGL_VERSION_1_0
    fghPlatformCloseWindowEGL(window);
#else
    if( window->Window.Context )
        glXDestroyContext( fgDisplay.pDisplay.Display, window->Window.Context );
    window->Window.pContext.FBConfig = NULL;
#endif

    if( window->Window.Handle ) {
        XDestroyWindow( fgDisplay.pDisplay.Display, window->Window.Handle );
    }
    /* XFlush( fgDisplay.pDisplay.Display ); */ /* XXX Shouldn't need this */
}
Example #2
0
/*
 * called before exit to wait for all threads to finish
 */
static void
clean_up(void)
{
   int i;

   /* wait for threads to finish */
   for (i = 0; i < NumWinThreads; i++) {
      pthread_join(WinThreads[i].Thread, NULL);
   }

   for (i = 0; i < NumWinThreads; i++) {
      glXDestroyContext(WinThreads[i].Dpy, WinThreads[i].Context);
      XDestroyWindow(WinThreads[i].Dpy, WinThreads[i].Win);
   }
}
Example #3
0
bool CWinSystemX11::DestroyWindowSystem()
{
  //restore desktop resolution on exit
  if (m_bFullScreen)
  {
    XOutput out;
    XMode mode;
    out.name = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).strOutput;
    mode.w   = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).iWidth;
    mode.h   = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).iHeight;
    mode.hz  = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).fRefreshRate;
    mode.id  = CDisplaySettings::GetInstance().GetResolutionInfo(RES_DESKTOP).strId;
    g_xrandr.SetMode(out, mode);
  }

#if defined(HAS_GLX)
  if (m_dpy)
  {
    if (m_glContext)
    {
      glXMakeCurrent(m_dpy, None, NULL);
      glXDestroyContext(m_dpy, m_glContext);
    }

    m_glContext = 0;

    //we don't call XCloseDisplay() here, since ati keeps a pointer to our m_dpy
    //so instead we just let m_dpy die on exit
    // i have seen core dumps on ATI if the display is not closed here
    // crashes when shutting down via cec
//    XCloseDisplay(m_dpy);
  }
#endif

#if defined(HAS_EGL)
  if (m_eglDisplay)
  {
    if (m_eglContext != EGL_NO_CONTEXT)
    {
      eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
      m_eglContext = EGL_NO_CONTEXT;
    }
  }
#endif
  // m_SDLSurface is free()'d by SDL_Quit().

  return true;
}
Example #4
0
int
main(int argc, char *argv[])
{
    Display *dpy;
    Window win;
    GLXContext ctx;
    char *dpyName = NULL;
    GLboolean printInfo = GL_FALSE;
    int i;

    for (i = 1; i < argc; i++) {
        if (strcmp(argv[i], "-display") == 0) {
            dpyName = argv[i+1];
            i++;
        }
        else if (strcmp(argv[i], "-info") == 0) {
            printInfo = GL_TRUE;
        }
    }

    dpy = XOpenDisplay(dpyName);
    if (!dpy) {
        printf("Error: couldn't open display %s\n", dpyName);
        return -1;
    }

    make_window(dpy, "glxgears", 0, 0, 300, 300, &win, &ctx);
    XMapWindow(dpy, win);
    glXMakeCurrent(dpy, win, ctx);
    reshape(300, 300);

    if (printInfo) {
        printf("GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
        printf("GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
        printf("GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
        printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
    }

    init();

    event_loop(dpy, win);

    glXDestroyContext(dpy, ctx);
    XDestroyWindow(dpy, win);
    XCloseDisplay(dpy);

    return 0;
}
Example #5
0
void GLWindow::destroy() {
    // hide window
    if (this->window != None) {
        XUnmapWindow(this->display, this->window);
    }

    // destroy opengl framebuffer
    if (this->glxWindow != None) {
        glXDestroyWindow(this->display, this->glxWindow);
        this->glxWindow = None;
    }

    // destroy window
    if (this->window != None) {
        XDestroyWindow(this->display, this->window);
        this->window = None;
    }

    // destroy colormap
    if (this->colormap != None) {
        XFreeColormap(this->display, this->colormap);
        this->colormap = None;
    }

    // destroy framebuffer configuration
    if (this->visualinfo != NULL) {
        XFree(this->visualinfo);
        this->visualinfo = NULL;
    }

    // destroy opengl context
    if (this->glxContext != NULL) {
        glXDestroyContext(this->display, this->glxContext);
        this->glxContext = NULL;
    }

    // free opengl framebuffer configurations
    if (this->glxConfigs != NULL) {
        XFree(this->glxConfigs);
        this->glxConfigs = NULL;
    }

    this->visible = false;
    this->x = this->y = 0;
    this->_width = this->_height = 0;
    this->mouse = false;
    this->mouseX = this->mouseY = 0;
}
int
S9xOpenGLDisplayDriver::init_glx (void)
{
    int glx_attribs[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };

    display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());

    vi = glXChooseVisual (display, DefaultScreen (display), glx_attribs);

    if (!vi)
    {
        fprintf (stderr, _("Couldn't find an adequate OpenGL visual.\n"));
        return 0;
    }

    xcolormap = XCreateColormap (display,
                                GDK_WINDOW_XWINDOW (gtk_widget_get_window (drawing_area)),
                                vi->visual,
                                AllocNone);

    create_window (1, 1);
    gdk_window_hide (gdk_window);

    glx_context = glXCreateContext (display, vi, 0, 1);

    if (!glx_context)
    {
        XFreeColormap (display, xcolormap);
        g_object_unref (gdk_window);
        XDestroyWindow (display, xwindow);

        fprintf (stderr, _("Couldn't create an OpenGL context.\n"));
        return 0;
    }

    if (!glXMakeCurrent (display, xwindow, glx_context))
    {
        XFreeColormap (display, xcolormap);
        g_object_unref (gdk_window);
        XDestroyWindow (display, xwindow);
        glXDestroyContext (display, glx_context);

        fprintf (stderr, "glXMakeCurrent failed.\n");
        return 0;
    }

    return 1;
}
Example #7
0
int
main(int argc, char *argv[])
{
   Display *dpy;
   const char *dpyName = NULL;
   GLboolean printInfo = GL_FALSE;
   struct gears gears;
   int i, width = 200, height = 200;

   for (i = 1; i < argc; i++) {
      if (strcmp(argv[i], "-display") == 0) {
         dpyName = argv[i+1];
         i++;
      }
      else if (strcmp(argv[i], "-info") == 0) {
         printInfo = GL_TRUE;
      }
   }

   dpy = XOpenDisplay(dpyName);
   if (!dpy) {
      printf("Error: couldn't open display %s\n", XDisplayName(dpyName));
      return -1;
   }

   make_window(dpy, "glxgears", 0, 0, width, height, &gears);
   XMapWindow(dpy, gears.win);
   glXMakeCurrent(dpy, gears.glxpixmap, gears.ctx);

   if (printInfo) {
      printf("GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
      printf("GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
      printf("GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
      printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
   }

   init(width, height);

   event_loop(dpy, &gears);

   glXDestroyContext(dpy, gears.ctx);
   XDestroyWindow(dpy, gears.win);
   glXDestroyPixmap(dpy, gears.glxpixmap);
   XFreePixmap(dpy, gears.pixmap);
   XCloseDisplay(dpy);

   return 0;
}
BaseOSDevice::BaseOSDevice(const WindowHandle& srcWainWindowHandle, boolean fullscrean, boolean stereo)
{
	_window = srcWainWindowHandle;
	_externalCreatedWindow = true;
	_fullscreanWindow = fullscrean;
	_glxContext = 0;

	Colormap colormap;
	XVisualInfo *vi = getXVisualInfo(colormap, _window);
	if (vi == 0)
		return;

	int glxMajor=0, glxMinor=0;
	glXQueryVersion(_window.display, &glxMajor, &glxMinor);
	logInfo << "glXQueryVersion " << glxMajor << "." << glxMinor;

	_glxContext = glXCreateContext(_window.display, vi, 0, GL_TRUE);
	if(!_glxContext){
		logError << "glXCreateContext";
		return;
	}

	XSetWindowAttributes windowAttributes;
	windowAttributes.colormap = colormap;
	windowAttributes.border_pixel = 0;
	windowAttributes.override_redirect = True;
	XChangeWindowAttributes(_window.display, _window.window, CWBorderPixel | CWColormap | (fullscrean ? CWOverrideRedirect : 0), &windowAttributes);

	if(fullscrean)
		XMoveResizeWindow(_window.display, _window.window, 0, 0, DisplayWidth(_window.display, _window.screen), DisplayHeight(_window.display, _window.screen));

	//XMapRaised(_window.display, _window.window);

	if(makeCurrentContext())
	{
		logInfo << "Initialization OpenGL with main window - OK";

		if (glXIsDirect(_window.display, _glxContext))
			logInfo << "DRI enabled\n";
		else
			logInfo << "no DRI available\n";
	}
	else{
		logError << "Cant create valid context";
		glXDestroyContext(_window.display, _glxContext);
		_glxContext = 0;
	}
}
Example #9
0
static void
glxglue_contextdata_cleanup(struct glxglue_contextdata * ctx)
{
  if (ctx == NULL) { return; }

  Display * display = glxglue_get_display(NULL);
  if (ctx->glxcontext) glXDestroyContext(display, ctx->glxcontext);
  if (ctx->glxpixmap) {
    if (ctx->pbuffer) { glxglue_glXDestroyPbuffer(display, ctx->glxpixmap); }
    else { glXDestroyGLXPixmap(display, ctx->glxpixmap); }
  }
  if (ctx->pixmap) XFreePixmap(display, ctx->pixmap);
  if (ctx->visinfo) XFree(ctx->visinfo);

  free(ctx);
}
static void
_cairo_boilerplate_gl_cleanup (void *closure)
{
    gl_target_closure_t *gltc = closure;

    cairo_device_finish (gltc->device);
    cairo_device_destroy (gltc->device);

    glXDestroyContext (gltc->dpy, gltc->ctx);

    if (gltc->drawable)
	XDestroyWindow (gltc->dpy, gltc->drawable);
    XCloseDisplay (gltc->dpy);

    free (gltc);
}
Example #11
0
wxGLContext::~wxGLContext()
{
    if (!m_glContext) return;

    if (m_glContext == glXGetCurrentContext())
    {
        if (wxGLCanvas::GetGLXVersion() >= 13)
            // GLX >= 1.3
            glXMakeContextCurrent( GDK_DISPLAY(), None, None, NULL);
        else
            // GLX <= 1.2
            glXMakeCurrent( GDK_DISPLAY(), None, NULL);
    }

    glXDestroyContext( GDK_DISPLAY(), m_glContext );
}
Example #12
0
void
dev_close(void)			/* close our display and free resources */
{
	glXMakeCurrent(ourdisplay, None, NULL);
	glXDestroyContext(ourdisplay, gctx);
	XDestroyWindow(ourdisplay, gwind);
	gwind = 0;
	XCloseDisplay(ourdisplay);
	ourdisplay = NULL;
	qtFreeLeaves();
	tmDone(tmGlobal);
	freecones();
	odev.v.type = 0;
	odev.hres = odev.vres = 0;
	odev.ifd = -1;
}
Example #13
0
void tear_down_window() {
	glDeleteShader(wa.vHandle);
	glDeleteShader(wa.fHandle);
	glDeleteProgram(wa.pHandle);

#ifdef SHOW_TEXT
	if (wa.font) XFreeFont(wa.dpy, wa.font);
#endif
	if (wa.cmap) XFreeColormap(wa.dpy, wa.cmap);
	if (wa.glx_context) {
		glXMakeCurrent(wa.dpy, None, NULL);
		glXDestroyContext(wa.dpy, wa.glx_context);
	}
	if (wa.w) XDestroyWindow(wa.dpy, wa.w);
	if (wa.dpy) XCloseDisplay(wa.dpy);
}
static void *
thread1_func(void *arg)
{
	get_lock_for_step(1);
	glXMakeCurrent(dpy, win, ctx);
	glColor4f(0.0, 1.0, 0.0, 1.0);
	piglit_draw_rect(10, 10, 10, 10);
	pthread_mutex_unlock(&mutex);

	get_lock_for_step(3);
	glXMakeCurrent(dpy, None, None);
	glXDestroyContext(dpy, ctx);
	pthread_mutex_unlock(&mutex);

	return NULL;
}
bool window_gl_context(Display *display,Window win,
                       glXCreateContextAttribsARBProc glXCreateContextAttribsARB,
                       GLXFBConfig bestFbc,GLXContext *ctx,
                       int major,int minor,bool core) {

  int context_attribs[] ={
    GLX_CONTEXT_MAJOR_VERSION_ARB,major,
    GLX_CONTEXT_MINOR_VERSION_ARB,minor,
    GLX_CONTEXT_FLAGS_ARB,0,
    // GLX_CONTEXT_FLAGS_ARB,GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
    // GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
    GLX_CONTEXT_PROFILE_MASK_ARB,core?GLX_CONTEXT_CORE_PROFILE_BIT_ARB:GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
    None
  };

  //
  if(*ctx) {
    glXMakeCurrent(display,0,0);
    glXDestroyContext(display,*ctx);
  }

  //
  windowData.ctxErrorOccurred=false;
  int(*oldHandler)(Display*,XErrorEvent*)=XSetErrorHandler(&window_ctx_error_handler);

  //
  *ctx=glXCreateContextAttribsARB(display,bestFbc,0,True,context_attribs);

  if(!ctx || windowData.ctxErrorOccurred) {
    fprintf(stderr,"gl context %i.%i unsupported.\n",major,minor);
    *ctx=0;
    return false;
  }

  //
  XSync(display,False);
  XSetErrorHandler(oldHandler);

  //
  glXMakeCurrent(display,win,*ctx);

  //
  fprintf(stdout,"GL %s\n",glGetString(GL_VERSION));
  fprintf(stdout,"GLSL %s\n",glGetString(GL_SHADING_LANGUAGE_VERSION));
  return true;

}
BaseOSDevice::BaseOSDevice(const DisplayHandle& display)
{
	_window.display = display.display;
	_window.screen = display.screen;
	_externalCreatedWindow = false;
	_fullscreanWindow = false;
	_glxContext = 0;

	Colormap colormap;
	XVisualInfo *vi = getXVisualInfo(colormap, display);
	if (vi == 0)
		return;

	int glxMajor=0, glxMinor=0;
	glXQueryVersion(_window.display, &glxMajor, &glxMinor);
	logInfo << "glXQueryVersion " << glxMajor << "." << glxMinor;

	_glxContext = glXCreateContext(_window.display, vi, 0, GL_TRUE);
	if(!_glxContext){
		logError << "glXCreateContext";
		return;
	}

	XSetWindowAttributes windowAttributes;
	windowAttributes.colormap = colormap;
	windowAttributes.border_pixel = 0;

	_window.window = XCreateWindow(_window.display, RootWindow(_window.display, vi->screen),
		0, 0, 32, 32, 0, vi->depth, InputOutput, vi->visual,
		CWBorderPixel | CWColormap, &windowAttributes);

	if(!_window.window){
		logError << "Cant create internal main window";
		return;
	}

	XSelectInput(_window.display, _window.window, 0);
	//XMapRaised(_window.display, _window.window);

	if(makeCurrentContext())
		logInfo << "Initialization OpenGL with internal window - OK";
	else{
		logError << "Cant create valid context";
		glXDestroyContext(_window.display, _glxContext);
		_glxContext = 0;
	}
}
void HeadlessView::createContext() {
    if (!display) {
        throw std::runtime_error("Display is not set");
    }

#if MBGL_USE_CGL
    CGLError error = CGLCreateContext(display->pixelFormat, NULL, &glContext);
    if (error != kCGLNoError) {
        throw std::runtime_error(std::string("Error creating GL context object:") + CGLErrorString(error) + "\n");
    }

    error = CGLEnable(glContext, kCGLCEMPEngine);
    if (error != kCGLNoError) {
        throw std::runtime_error(std::string("Error enabling OpenGL multithreading:") + CGLErrorString(error) + "\n");
    }
#endif

#if MBGL_USE_GLX
    xDisplay = display->xDisplay;
    fbConfigs = display->fbConfigs;

    if (!glContext) {
        // Try to create a legacy context
        glContext = glXCreateNewContext(xDisplay, fbConfigs[0], GLX_RGBA_TYPE, None, True);
        if (glContext) {
            if (!glXIsDirect(xDisplay, glContext)) {
                Log::Error(Event::OpenGL, "failed to create direct OpenGL Legacy context");
                glXDestroyContext(xDisplay, glContext);
                glContext = 0;
            }
        }
    }

    if (glContext == 0) {
        throw std::runtime_error("Error creating GL context object.");
    }

    // Create a dummy pbuffer. We will render to framebuffers anyway, but we need a pbuffer to
    // activate the context.
    int pbufferAttributes[] = {
        GLX_PBUFFER_WIDTH, 8,
        GLX_PBUFFER_HEIGHT, 8,
        None
    };
    glxPbuffer = glXCreatePbuffer(xDisplay, fbConfigs[0], pbufferAttributes);
#endif
}
Example #18
0
void XvMCTextures::DeInit(void)
{
    VERBOSE(VB_IMPORTANT, LOC + "DeInit");
    if (!XJ_disp)
        return; // already called

    X11L;
    glXMakeContextCurrent(XJ_disp, None, None, NULL);
    glXDestroyContext(XJ_disp, glx_context); glx_context = 0;
    glXDestroyWindow( XJ_disp, glx_window);  glx_window  = 0;
    glXDestroyPbuffer(XJ_disp, glx_pbuffer); glx_pbuffer = 0;
    XDestroyWindow(   XJ_disp, gl_window);   gl_window   = 0;
    gl_vid_textures.clear();
    gl_osd_textures.clear();
    XJ_disp = NULL;
    X11U;
}
Example #19
0
static void
borisgl_cleanup(void)
{
	if (ctx != None) {
		glXMakeCurrent(dpy, win, 0);
		glXDestroyContext(dpy, ctx);
		ctx = None;
	}
	if (win != None) {
		XDestroyWindow(dpy, win);
		win = None;
	}
	if (dpy) {
		XCloseDisplay(dpy);
		dpy = NULL;
	}
}
static void
_cairo_boilerplate_vg_cleanup_glx (void *closure)
{
    vg_closure_glx_t *vgc = closure;

#ifdef USE_AMANITH
    vgDestroyContextAM ();
#endif
#ifdef USE_SHIVA
    vgDestroyContextSH ();
#endif

    glXDestroyContext (vgc->dpy, vgc->ctx);
    XDestroyWindow (vgc->dpy, vgc->win);
    XCloseDisplay (vgc->dpy);
    free (vgc);
}
Example #21
0
mitk::GPGPU::~GPGPU()
{
#ifdef _WIN32
  
  wglDeleteContext( openGLContext );
  
#else

  if(openGLContext)
    glXDestroyContext(X_display,openGLContext);

  if(X_display)
    XCloseDisplay(X_display);
    
#endif

}
Example #22
0
void CStdGLCtx::Clear(bool multisample_change)
{
	Deselect();
	if (ctx)
	{
		Display * const dpy = gdk_x11_display_get_xdisplay(gdk_display_get_default());
		glXDestroyContext(dpy, (GLXContext)ctx);
		ctx = 0;
	}
	pWindow = 0;

	if (this_context != contexts.end())
	{
		contexts.erase(this_context);
		this_context = contexts.end();
	}
}
Example #23
0
static void
clutter_backend_glx_dispose (GObject *gobject)
{
  ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (gobject);
  ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (gobject);

  /* Unrealize all shaders, since the GL context is going away */
  _clutter_shader_release_all ();

  if (backend_glx->gl_context)
    {
      glXDestroyContext (backend_x11->xdpy, backend_glx->gl_context);
      backend_glx->gl_context = None;
    }

  G_OBJECT_CLASS (clutter_backend_glx_parent_class)->dispose (gobject);
}
Example #24
0
                   P3DGLMemoryContextPBuffer::~P3DGLMemoryContextPBuffer
                                      ()
 {
  if (Ok)
   {
    glXDestroyContext(Connection,OffScreenGLXContext);
    glXDestroyPbuffer(Connection,PBuffer);
   }

  if (OwnConnection)
   {
    if (Connection != NULL)
     {
      XCloseDisplay(Connection);
     }
   }
 }
Example #25
0
static void
gst_gl_context_glx_destroy_context (GstGLContext * context)
{
  GstGLWindow *window;
  GstGLContextGLX *context_glx;
  Display *device;

  context_glx = GST_GL_CONTEXT_GLX (context);
  window = gst_gl_context_get_window (context);
  device = (Display *) gst_gl_display_get_handle (window->display);

  glXDestroyContext (device, context_glx->glx_context);

  context_glx->glx_context = 0;

  gst_object_unref (window);
}
Example #26
0
    WindowLinux::~WindowLinux()
    {
        if (display)
        {
            if (context)
            {
                glXDestroyContext(display, context);
            }

            if (window)
            {
                XDestroyWindow(display, window);
            }

            XCloseDisplay(display);
        }
    }
Example #27
0
/*
 * Name      : int get_GC( Window win, XVisualInfo *visual, GLXContext *gc )
 *
 * Parameters: win    - the X window use to the OpenGL context with
 *             visual - The visual to create the context for
 *             gc     - a pointer to a GLXContext structure. This is how
 *                      the created context will be returned to the caller
 *
 * Returns   : a pointer to a created GLXContext is returned through the
 *             gc argument.
 *             int - an error code: 0 means everything was fine
 *                                 -1 context creation failed
 *                                 -2 context/window association failed
 *
 * Purpose   : create an X window Graphics context and assocaite it with
 *             the window. It returns 0 if everything was fine, -1 if the
 *             context could not be created, -2 if the context could not
 *             be associated with the window
 */
static int get_GC( Window win, XVisualInfo *visual, GLXContext *gc )
{
    *gc = glXCreateContext( display, visual, None, True );

    /* check if the context could be created */
    if( *gc == NULL ) {
        fprintf( stderr, "get_GC: Could not allocate an OpenGL context\n");
        return( -1 );
    }
    /* associated the context with the X window */
    if( glXMakeCurrent( display, win, *gc ) == False) {
        fprintf( stderr,
                 "get_GC: Could not attach the OpenGL context to the X window\n");
        glXDestroyContext( display, *gc );
        return( -2 );
    }
    return (0);
}
Example #28
0
                   P3DGLMemoryContextPixmap::~P3DGLMemoryContextPixmap
                                      ()
 {
  if (Ok)
   {
    glXDestroyContext(Connection,OffScreenGLXContext);
    glXDestroyGLXPixmap(Connection,TargetGLXPixmap);
    XFreePixmap(Connection,TargetPixmap);
   }

  if (OwnConnection)
   {
    if (Connection != NULL)
     {
      XCloseDisplay(Connection);
     }
   }
 }
Example #29
0
void OpenGLApp::exitAPI(){
	delete renderer;

    glXMakeCurrent(display, None, NULL);
    glXDestroyContext(display, glContext);

	if (fullscreen){
		if (XF86VidModeSwitchToMode(display, screen, dmodes[0])){
			XF86VidModeSetViewPort(display, screen, 0, 0);
		}
	}
    XFree(dmodes);
	XFreeCursor(display, blankCursor);

	XDestroyWindow(display, window);

	XSync(display, False);
}
Example #30
0
File: gl_x11.c Project: Bilalh/mpv
/**
 * \brief free the VisualInfo and GLXContext of an OpenGL context.
 * \ingroup glcontext
 */
static void releaseGlContext_x11(MPGLContext *ctx)
{
    struct glx_context *glx_ctx = ctx->priv;
    XVisualInfo **vinfo = &glx_ctx->vinfo;
    GLXContext *context = &glx_ctx->context;
    Display *display = ctx->vo->x11->display;
    GL *gl = ctx->gl;
    if (*vinfo)
        XFree(*vinfo);
    *vinfo = NULL;
    if (*context) {
        if (gl->Finish)
            gl->Finish();
        glXMakeCurrent(display, None, NULL);
        glXDestroyContext(display, *context);
    }
    *context = 0;
}