[vlc-devel] [PATCH 4/8] opengl: handle the viewpoint changes when rendering
Steve Lhomme
robux4 at videolabs.io
Wed Sep 14 16:32:28 CEST 2016
--
replaces https://patches.videolan.org/patch/14444/ by keeping the values set
even if not used
---
modules/video_output/gl.c | 8 ++++++++
modules/video_output/opengl.c | 17 +++++++++++++++++
modules/video_output/opengl.h | 3 +++
3 files changed, 28 insertions(+)
diff --git a/modules/video_output/gl.c b/modules/video_output/gl.c
index 082aa78..5c8a6b4 100644
--- a/modules/video_output/gl.c
+++ b/modules/video_output/gl.c
@@ -249,6 +249,14 @@ static int Control (vout_display_t *vd, int query, va_list ap)
vlc_gl_ReleaseCurrent (sys->gl);
return VLC_SUCCESS;
}
+ case VOUT_DISPLAY_CHANGE_VIEWPOINT:
+ {
+ const vout_display_cfg_t *p_cfg = va_arg (ap, const vout_display_cfg_t *);
+ vout_display_opengl_SetViewpoint(sys->vgl, p_cfg->viewpoint.f_yaw_degrees,
+ p_cfg->viewpoint.f_pitch_degrees,
+ p_cfg->viewpoint.f_roll_degrees);
+ return VLC_SUCCESS;
+ }
default:
msg_Err (vd, "Unknown request %d", query);
}
diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 6017fdc..c7ec5f6 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -205,6 +205,7 @@ struct vout_display_opengl_t {
/* View point */
float f_teta;
float f_phi;
+ float f_roll;
float f_zoom;
};
@@ -776,6 +777,22 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
free(vgl);
}
+void vout_display_opengl_SetViewpoint(vout_display_opengl_t *vgl,
+ float yaw, float pitch, float roll)
+{
+ const projection_mode proj_mode = vout_display_projection(vgl);
+
+ vgl->f_teta = yaw;
+ if (vgl->f_teta < -M_PI)
+ vgl->f_teta = M_PI;
+ vgl->f_phi = pitch;
+ if (vgl->f_phi < -M_PI / 2)
+ vgl->f_phi = -M_PI / 2;
+ vgl->f_roll = roll;
+ if (vgl->f_roll < -M_PI / 2)
+ vgl->f_roll = -M_PI / 2;
+}
+
picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned requested_count)
{
if (vgl->pool)
diff --git a/modules/video_output/opengl.h b/modules/video_output/opengl.h
index 4ae9400..9e37f61 100644
--- a/modules/video_output/opengl.h
+++ b/modules/video_output/opengl.h
@@ -96,6 +96,9 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl);
picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned);
+void vout_display_opengl_SetViewpoint(vout_display_opengl_t *vgl,
+ float yaw, float pitch, float roll);
+
int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
picture_t *picture, subpicture_t *subpicture);
int vout_display_opengl_Display(vout_display_opengl_t *vgl,
--
2.7.2.windows.1
More information about the vlc-devel
mailing list