[vlc-devel] [PATCH 14/20] opengl: flip the alignment once on Open

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 25 12:03:02 CEST 2020

On 2020-08-25 11:48, Steve Lhomme wrote:
> On 2020-08-25 11:36, Alexandre Janniaux wrote:
>> Hi,
>> On Tue, Aug 25, 2020 at 11:16:13AM +0200, Steve Lhomme wrote:
>>> On 2020-08-25 10:39, Alexandre Janniaux wrote:
>>>> Hi,
>>>> This seems wrong. Alignment is reversed in OpenGL because
>>>> coordinate system is reversed too, so ppicture_place data
>>>> need to be reversed too.
>>>> We don't want to report anything to the core and we want
>>>> the correct behaviour when doing control. This breaks both
>>>> points.
>>>> I'm not sure why you remove the FlipVerticalAlign too.
>>> I forgot to add more comments to the commit.
>>> Right now the align.vertical is set when enabling the window. After that
>>> it's never changed after that (in the core). It's only used inside
>>> vout_display_PlacePicture() and nowhere else.
>> In the future, it could also set by the interface. I don't
>> really know why it's not bindable to hotkeys but it makes
>> as much sense as other keys like `o` imho.
>>> Moving this hack to where the actual vout_display_PlacePicture() 
>>> calls are
>>> done (in the core after this patchset) seem logical.
>>> As explained in the rational for this patchset, the goal is to have the
>>> mouse translation using the proper video placement. It's possible that
>>> OpenGL is doing things backward.
>> It's not that OpenGL is doing it backward, it's that OpenGL
>> is doing it with a different coordinate system, thus you
>> have to adapt what the core request into how OpenGL
>> understand it, meaning reverse the y axis.
>> To be clear, VLC is using usual window coordinates,
>> while OpenGL has origin in bottom left corner
>>     VLC           OpenGL
>>     +---->        A
>>     |             |
>>     |             |
>>     V             +------>
>> Thus, if you don't inverse alignment before placing, the core
>> will place the image at the top when it should have been the
>> bottom or the opposite.
> Given the code uses tricks like this, maybe it's possible to use place.y 
> and height-place.y in some places
> vout_display_opengl_Viewport(sys->vgl, sys->place.x,
>                                  bounds.size.height - (sys->place.y + 
> sys->place.height),
>                                  sys->place.width, sys->place.height);

nope, we have to compute the inverted values :(

> It could be off by one pixel when center aligned vertically.

More information about the vlc-devel mailing list