Render QWidget to texture #1504
-
How to dynamically re-render every frame QWidget to already existing model's mesh's texture and how to handle that from beginning they have different sizes? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you can get a texture containing the QWidget's pixels, it should be fairly straightforward to use a visitor to replace the mesh's existing texture with the new one, and things like mismatched size won't matter. However, getting an arbitrary QWidget into a texture could be difficult. From the cursory investigation I've just done, it doesn't look like Qt provides a cross-platform way to do this, so you'll need to come up with a platform-specific system to do this. E.g. on Windows, every QWidget has a native window, and you could get that window's device context and blit its pixels into another one which you control and have mapped to a texture, and on a modern Wayland-based Linux distro, the |
Beta Was this translation helpful? Give feedback.
If you can get a texture containing the QWidget's pixels, it should be fairly straightforward to use a visitor to replace the mesh's existing texture with the new one, and things like mismatched size won't matter.
However, getting an arbitrary QWidget into a texture could be difficult. From the cursory investigation I've just done, it doesn't look like Qt provides a cross-platform way to do this, so you'll need to come up with a platform-specific system to do this. E.g. on Windows, every QWidget has a native window, and you could get that window's device context and blit its pixels into another one which you control and have mapped to a texture, and on a modern Wayland-based Linux distro,…