Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when rendering to two OpenGL3 / SDL2 Windows #3053

Closed
hires opened this issue Mar 10, 2020 · 3 comments
Closed

Error when rendering to two OpenGL3 / SDL2 Windows #3053

hires opened this issue Mar 10, 2020 · 3 comments

Comments

@hires
Copy link

hires commented Mar 10, 2020

Hi, I'm new to Dear Imgui and so far it's very cool.

But I'm trying to make a modular API for my application that can open multiple SDL2 / OpenGL3 windows. Imgui works fine in a single window, but when I make two Imgui contexts and two GL contexts, I get the following error when running calling: ImplSDL2_NewFrame()

Assertion io.Fonts->IsBuilt() && "Font atlas not built! It is generally built by the renderer back-end. Missing call to renderer _NewFrame() function? e.g. ImGui_ImplOpenGL3_NewFrame()."' failed.

I didn't do anything with the fonts so I don't understand this error.

@ocornut
Copy link
Owner

ocornut commented Mar 10, 2020

Hello,

  1. You didn’t fill issue template. Please fill requested issue template when creating an issue.

  2. which is the reason you want to create two windows, wouldn’t the Multi-viewport feature solve your problem? (See Multi-viewports / virtual viewports #1542)

  3. you are essentially hitting on the fact that most backends assume 1 instance of each. There are discussions here about this (see eg Nesting multiple imgui contexts (glfw+opengl3) #2004).

@hires
Copy link
Author

hires commented Mar 10, 2020

Okay thanks I will try follow those links.

@ocornut
Copy link
Owner

ocornut commented Mar 10, 2020

It's an open problem, even though I think most users would be better off using multi-viewports with a single context, I still appreciate it can be useful or required in some cases you use multiple contexts, and I hoping to rework the backends accordingly.

Essentially the issue is we need to either change the backends API to use explicit an backend context structure, either we can magically attempt to have the backend use a key>map where the key is the imgui context itself. The earlier would be more sane and explicit (and faster too) so I feel this is the better solution but that's a breaking change, so if we do it we should do it right and once, so maybe that's something we can schedule for 1.80.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants