Best way to deal with mirrored UV y-coordinate with OpenGL


#1

When switching between OpenGL and Vulkan APIs a texture I’m drawing flips on the y-axis. I think this is because OpenGL uses reversed Y-axis for UV coordinates compared to DirectX and Vulkan. So how can I best handle this difference? Is there some global boolean I can read and then change my UV generations, or should I use #ifdef OPENGL in my shaders and flip it there? I remember Ogre having a render system function that returned true if the y-axis of textures was flipped. Is there something similar for bs::framework?


#2

You can use ct::RenderAPI::getCapabilities(), which returns RenderAPICapabilities which has a conventions field, which contains the UV and NDC axis conventions used.