*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
} vlc_gl_sys_t;
static int MakeCurrent (vlc_gl_t *);
+static void ReleaseCurrent (vlc_gl_t *);
static void SwapBuffers (vlc_gl_t *);
static void *GetSymbol(vlc_gl_t *, const char *);
{
vlc_gl_t *gl = (vlc_gl_t *)obj;
- if (!vlc_xlib_init (obj))
+ if (gl->surface->type != VOUT_WINDOW_TYPE_XID || !vlc_xlib_init (obj))
return VLC_EGENERIC;
/* Initialize GLX display */
goto error;
}
+ /* Initialize OpenGL callbacks */
+ gl->sys = sys;
+ gl->makeCurrent = MakeCurrent;
+ gl->releaseCurrent = ReleaseCurrent;
+ gl->swap = SwapBuffers;
+ gl->getProcAddress = GetSymbol;
+ gl->lock = NULL;
+ gl->unlock = NULL;
+
#ifdef GLX_ARB_get_proc_address
bool is_swap_interval_set = false;
+
+ MakeCurrent (gl);
# ifdef GLX_SGI_swap_control
if (!is_swap_interval_set
&& CheckGLXext (dpy, snum, "GLX_SGI_swap_control"))
is_swap_interval_set = true;
}
# endif
+ ReleaseCurrent (gl);
#endif
- /* Initialize OpenGL callbacks */
- gl->sys = sys;
- gl->makeCurrent = MakeCurrent;
- gl->swap = SwapBuffers;
- gl->getProcAddress = GetSymbol;
- gl->lock = NULL;
- gl->unlock = NULL;
return VLC_SUCCESS;
error:
return VLC_SUCCESS;
}
+static void ReleaseCurrent (vlc_gl_t *gl)
+{
+ vlc_gl_sys_t *sys = gl->sys;
+
+ glXMakeContextCurrent (sys->display, None, None, NULL);
+}
+
static void SwapBuffers (vlc_gl_t *gl)
{
vlc_gl_sys_t *sys = gl->sys;