ultralight-ux / Ultralight

Lightweight, high-performance HTML renderer for game and app developers.
https://ultralig.ht
4.65k stars 194 forks source link

OpenGL texture render output is flipped #392

Open Dschadu opened 2 years ago

Dschadu commented 2 years ago

OpenGL assumes (0, 0) to be bottom left, but Ultralight renders the texture with (0, 0) as top left. This results in a flipped texture. The Sample7 shows this: In Sample.cpp from Line 280-287 the quad that is being created is the wrong way around to fix this issue. The only way for me to fix this is to flip the buffer manually before writing the texture, which is inefficient. Furthermore, since Ultralight only renders areas that have been changed, I'm forced to use config.force_repaint = true; to prevent the image from flipping every frame (like when an animated button is used).

I'm developing an OpenVR overlay and OpenVR takes an OpenGL texture. There is no the option to flip it again without causing other issues: Flipping the OpenVR viewports results in inverted coordinates for click-detection.

Is there an option to change this? If not, please add an option to change this behavior.

SupinePandora43 commented 2 years ago

If you don't care about efficiency: use a temporary framebuffer+RT and render to it a flipped texture.