Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen orientation on Android #1242

Open
Duron27 opened this issue Jul 20, 2024 · 5 comments
Open

Screen orientation on Android #1242

Duron27 opened this issue Jul 20, 2024 · 5 comments

Comments

@Duron27
Copy link

Duron27 commented Jul 20, 2024

There seems to be an issue with android screen orientation.

In swapchain.cpp changing This line to createInfo.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; allows the screen to rotate but seems to solve it but cause performance issues.

I'm stuck on 1.0.9 at the moment, sorry if this is fixed in a later release.

@robertosfield
Copy link
Collaborator

There hasn't been anyone else reporting this issue and no fixes have submitted for this so it's very unlikely that any of the VSG-1.1.x developer releases or VSG master will have addressed the issue.

I don't have any Android experience myself so can't provide insights in how we might address the problem - I rely on those who have Android setup and expertise to help support the platform, as it's still a niche platform for the VSG community it does unfortunately mean there aren't many engineers that help shake down the platform, so I you can investigate and resolve the issue it would be much appreciated.

If you come across discussions online about the problem and fixes for it let me know - a link to online docs/discussions or just explanations would help myself and other gain insight to what might need to be done.

@Duron27
Copy link
Author

Duron27 commented Jul 20, 2024

There's a vulkan dev helping me with this issue so maybe we will figure it out. Has anyone tried changing the screen orientation? I'm not sure it's android specific.

@robertosfield
Copy link
Collaborator

I don't recall any discussions about changing screen orientation. So far the VSG user base has been mainly desktop based.

If you can provide any information/insights that you've come across then I can considering this w.r.t any general changes to the core VSG that might be required. Presently there is a WindowResizeHandler that updates projection matrices and any affected graphics piplines when the window size is resized, perhaps this can be generalized to handle the case of orientation changes as well as there may be an overlap if what changes need to be applied.

There may also be an need to extend the vsg::Window base class to handle the case of window orientation changes as the code right now assumes a consistent orientation.

@Duron27
Copy link
Author

Duron27 commented Jul 21, 2024

Im going to see if this will work in the swapchain.cpp file
vulkan-prerotation

@robertosfield
Copy link
Collaborator

Thanks for the link. I think Option 3 would be the best. If we can get an orientation message from the OS/Windowing system rather than recreate the viewport we could just rotate the camera - perhaps rotation of the projection matrix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants