Commit 70b4891e authored by Thomas Guillem's avatar Thomas Guillem

vout/gl: ensure that the GL context is attached

parent e8ae4d26
...@@ -167,9 +167,8 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned count) ...@@ -167,9 +167,8 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned count)
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
if (!sys->pool) if (!sys->pool && vlc_gl_MakeCurrent (sys->gl) == VLC_SUCCESS)
{ {
vlc_gl_MakeCurrent (sys->gl);
sys->pool = vout_display_opengl_GetPool (sys->vgl, count); sys->pool = vout_display_opengl_GetPool (sys->vgl, count);
vlc_gl_ReleaseCurrent (sys->gl); vlc_gl_ReleaseCurrent (sys->gl);
} }
...@@ -180,8 +179,8 @@ static void PictureRender (vout_display_t *vd, picture_t *pic, subpicture_t *sub ...@@ -180,8 +179,8 @@ static void PictureRender (vout_display_t *vd, picture_t *pic, subpicture_t *sub
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vlc_gl_MakeCurrent (sys->gl); if (vlc_gl_MakeCurrent (sys->gl) == VLC_SUCCESS)
vout_display_opengl_Prepare (sys->vgl, pic, subpicture); vout_display_opengl_Prepare (sys->vgl, pic, subpicture);
vlc_gl_ReleaseCurrent (sys->gl); vlc_gl_ReleaseCurrent (sys->gl);
} }
...@@ -189,9 +188,11 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic, subpicture_t *su ...@@ -189,9 +188,11 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic, subpicture_t *su
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vlc_gl_MakeCurrent (sys->gl); if (vlc_gl_MakeCurrent (sys->gl) == VLC_SUCCESS)
vout_display_opengl_Display (sys->vgl, &vd->source); {
vlc_gl_ReleaseCurrent (sys->gl); vout_display_opengl_Display (sys->vgl, &vd->source);
vlc_gl_ReleaseCurrent (sys->gl);
}
picture_Release (pic); picture_Release (pic);
if (subpicture != NULL) if (subpicture != NULL)
...@@ -221,7 +222,8 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -221,7 +222,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
vout_display_PlacePicture (&place, src, c, false); vout_display_PlacePicture (&place, src, c, false);
vlc_gl_Resize (sys->gl, place.width, place.height); vlc_gl_Resize (sys->gl, place.width, place.height);
vlc_gl_MakeCurrent (sys->gl); if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
return VLC_EGENERIC;
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height); vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
glViewport (place.x, place.y, place.width, place.height); glViewport (place.x, place.y, place.width, place.height);
vlc_gl_ReleaseCurrent (sys->gl); vlc_gl_ReleaseCurrent (sys->gl);
...@@ -236,7 +238,8 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -236,7 +238,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
vout_display_place_t place; vout_display_place_t place;
vout_display_PlacePicture (&place, src, cfg, false); vout_display_PlacePicture (&place, src, cfg, false);
vlc_gl_MakeCurrent (sys->gl); if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
return VLC_EGENERIC;
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height); vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
glViewport (place.x, place.y, place.width, place.height); glViewport (place.x, place.y, place.width, place.height);
vlc_gl_ReleaseCurrent (sys->gl); vlc_gl_ReleaseCurrent (sys->gl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment