SFML/imgui-sfml

Drawing an sf::VertexArray

arnokret opened this issue · 5 comments

Would you know by any chance a good way to render an sf::VertexArray onto an ImGui window?

Hello.
I can recommend drawing it to sf::RenderTexture and then drawing it with ImGui::Image.

Thanks for the response. I thought of that option, but my Vertex array changes every frame, so then with this method of copying textures around, I would get very low frame rate.

But, if I understand it correctly, there is no way to somehow directly map the sf::VertexArray to the drawlist in imgui?

I thought of that option, but my Vertex array changes every frame, so then with this method of copying textures around, I would get very low frame rate.

You must be doing something wrong.

Rendering to a texture shouldn't involve any copying - it's not very different from drawing to a window.

Maybe you're creating sf::RenderTexture in every frame? You shouldn't do that. You should reuse it.

You can also use ImDrawList directly.
See this example

Thanks a lot for your comment, I was indeed doing something wrong and it is working now. The other pointers you gave are also very helpful.

You're welcome :)