libgdx / gdx-video

A libGDX cross platform video rendering extension
Apache License 2.0
145 stars 50 forks source link

Fixed the many problems with the android video player using a custom mesh #47

Closed mattkwilson closed 7 years ago

mattkwilson commented 7 years ago

The shader and viewport were never instantiated, the mesh vertices were being overwritten, and the viewport was being forced to screen size.

RBogie commented 7 years ago

I'm sorry it took me some time before writing this response.

This pull request would cause the behaviour on android to differ from the desktop player, so at the very least, desktop would have to be adapted as well.

In the documentation, it is mentioned that when using a custom mesh, the resizing is the responsibility of the developer. Originally this was done because when rendering videos to a custom mesh, most of the times, this is done in a complex scene using custom shaders and camera's and such. It is however a mistake that there is no way to set the shader.

What I propose would be the following: Both the Desktop and Android variant get an extra parameter with the custom mesh to set the shader. If null is passed, the default shader is used (It won't be very helpfull with custom meshes though). The viewport is left as is, since with a custom mesh no assumptions can be made on the camera anyway.

mattkwilson commented 7 years ago

I just modified the code to prevent any difference from the desktop player. I removed any modification to the viewport, and kept the changes for the shader and mesh (it is actually the same as the desktop player now). You can add the extra parameter, but I don't need it for it for my application.

RBogie commented 7 years ago

Thank you for the contribution.