Possible to render a framebuffer inside a div or img? #632
-
Hi there! I've been switching my codebase from Dear ImGui to RmlUI for the customisation and more user facing stuff. It's been great so far :) ! Just wondering if there's a way to render from a GL framebuffer into a window? You could do this in ImGui by rendering the framebuffer to a texture and then adding that as an image to ImGui (https://www.codingwiththomas.com/blog/rendering-an-opengl-framebuffer-into-a-dear-imgui-window). Is there something similar I can do with RmlUI? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey, glad to hear the transition has been smooth so far! Certainly, there are various ways to achieve this. The easiest I would say is simply to dedicate some kind of texture name for this purpose. Then, in your render interface, whenever you see this texture name, you plug in your framebuffer, and have that one render like other textures. In your document, you would just add this as a normal image or decorator. You might want to give it a name like If you want more power and flexibility, you could implement a custom decorator. This allows you to customize what you're rendering with your own properties, nicely integrated with style sheets. Also, you can create your framebuffer after layout, when the size is known, if you want it to be reactive to layouting. Hope that gives you some pointers to start with. Good luck, and let us know if you need some more help implementing this. |
Beta Was this translation helpful? Give feedback.
Hey, glad to hear the transition has been smooth so far!
Certainly, there are various ways to achieve this. The easiest I would say is simply to dedicate some kind of texture name for this purpose. Then, in your render interface, whenever you see this texture name, you plug in your framebuffer, and have that one render like other textures. In your document, you would just add this as a normal image or decorator. You might want to give it a name like
/my_framebuffer
so that it is resolved like an absolute path instead of being resolved relative to the document, but those are implementation details.If you want more power and flexibility, you could implement a custom decorator. This allows …