0

I'm currently trying to render a couple of webpages with dear ImGui I looked everywhere but couldn't find it so here I am. And I would like to be able to load https://google.com in Window1 per example.

Thank you for your time :)

#include "App.h"
#include "imgui.h"

namespace App {
    void Application() {
        ImGui::Begin("Window1");
        ImGui::End();
        ImGui::Begin("Window2");
        ImGui::End();

        ImGui::Begin("Window3");
        ImGui::End();
    }
}
  • I don't know imgui, but based on the name I assume there's nothing to fetch content over HTTP or parse the result. Am I mistaken? – Stephen Newell Oct 31 '22 at 01:24
  • Yes that's right! – WhiteRose Oct 31 '22 at 01:44
  • Then your question is basically "How do I write a web browser". That's far too broad for this site. – Stephen Newell Oct 31 '22 at 02:18
  • 1
    From my limited experience with imgui theres 0 support for anything resembling this. AFAIK your best bet would be to use an actual library that renders the webpage (chromium?) to a texture and feed the texture to your imgui window. I assume you might be able to intercept imgui window clicks and forward them to the web browser to get it to react. I'm just guessing though. As stephen pointed out this seems out of scope. – Borgleader Oct 31 '22 at 03:04

1 Answers1

2

ImGUI doesn't include a control to render HTML, or anything like that.

If you want to badly enough, you could download the page, use something like WebKit to render it to a texture, then render the texture with ImGui.

Depending on how ambitious you're feeling, you could do the downloading completely on your own using sockets directly, using ASIO, or using libcurl, for only a few of the obvious possibilities.

Building WebKit on Linux is fairly easy, but on Windows it's somewhat non-trivial (or was the last time I did it, anyway).

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111