[vlc-devel] [vlc-commits] OpenGL: draw 360° frames on a sphere or a cube

Filip Roséen filip at atch.se
Fri Aug 12 17:19:04 CEST 2016


Hi Adrian,

On 16/08/12 16:08, Adrien Maglo wrote:

> vlc | branch: master | Adrien Maglo <magsoft at videolan.org> | Wed May 25 19:55:24 2016 +0200| [63337cab3bc1aa3391721372c27ded107767ea4c] | committer: Jean-Baptiste Kempf
> 
> OpenGL: draw 360° frames on a sphere or a cube
> 

Potential division-by-zero?
----------------------------------------------------------------------

> @@ -1217,6 +1529,25 @@ static void DrawWithShaders(vout_display_opengl_t *vgl,
>  
>      orientationTransformMatrix(orientationMatrix, vgl->fmt.orientation);
>  
> +    if (vgl->fmt.projection_mode == PROJECTION_MODE_EQUIRECTANGULAR
> +        || vgl->fmt.projection_mode == PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD)
> +    {
> +        float sar = vgl->fmt.i_visible_width / vgl->fmt.i_visible_height;
> +        getProjectionMatrix(sar, projectionMatrix);
> +        getViewMatrix(viewMatrix);
> +        getYRotMatrix(vgl->f_teta, yRotMatrix);
> +        getXRotMatrix(vgl->f_phi, xRotMatrix);
> +        getZoomMatrix(vgl->f_zoom, zoomMatrix);
> +    }

 - Is `vgl->fmt.i_visible_height` really guaranteed to not be `0` at
   this stage?

Certainly such value would not make a lot of sense, but I am not sure
whether protection against it is present elsewhere, nor do I think
there actually is something in the codebase stating the equivalent of
`assert( x.i_visible_height != 0 )` (where `x` is `struct
video_format_t`).

In other words; mostly asking out of curiosity because it caught my
attention reading the diff.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160812/7496b95d/attachment.html>


More information about the vlc-devel mailing list