0
\$\begingroup\$

I've been developing a 2D Engine using SFML + ImGui.

Here you can see an image:

The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.

Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine.

I've managed to render the editor like I did in the 2D Engine using this Example that comes with ImGui.

But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.

If you can provide code will be better. And if you want me to provide any specific code tell me.

Thanks!

\$\endgroup\$
1
\$\begingroup\$

Afaik this function could be of help:

https://wiki.libsdl.org/SDL_SetRenderTarget

Do you really need to rely on SDL2? SFML has built-in support for OpenGL and would be the better choice.

\$\endgroup\$
  • \$\begingroup\$ This is currently a link-only answer. If the URL changes in future, or the site's server becomes unreachable for a particular reader, then that reader won't be able to learn what you're trying to show them. We recommend that answers always include at least a rough summary of the points you hope users will learn from the external link, so they remain useful no matter what. Links are great to give credit and further reading, but your answer should always be able to stand on its own. \$\endgroup\$ – DMGregory Jul 21 '18 at 13:03
  • \$\begingroup\$ @DMGregory I think the link is fine. It is official documentation so is unlikely to change. Even so, SDL_SetRenderTarget is enough information to go off, as it's a simple function. OP has demonstrated understanding of the concept of rendering to texture, so there's not much to elaborate on. \$\endgroup\$ – congusbongus Dec 5 '18 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.