-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Font bug when using multiple instances #591
Comments
SetInternalState() is only assigning to a pointer so isn't affecting anything font related. How are you creating the second state? Are you reassigning the font atlas pointer? |
I had the same issue few time ago while using 2 different ImGui contexts with their own fonts. After reading the source code I understood that you need to have separate texture atlases too. |
This isn't as intended, you should be able to share the same atlas for two instances. |
I do create an additional atlas for each context. In fact, I have a On Sun, 17 Apr 2016 at 07:08 omar notifications@github.com wrote:
|
Thanks! Similarly, you should be able to reuse the same atlas if they are going to be the same (tho obviously you need to upload texture to your two opengl context and find a way to pass textureid that works for both). This looks fishy so I'll need to give it a closer look. |
This worked for me:
BUT I had to fix code in ImGui_ImplGlfw_NewFrame(), added the else statement else:
Maybe the sample code should be more aware of multiple contexts? Are you using this code as is, or something that made more sense for your own use of multiple contexts? Also the InternalState function names/API sucks (will be renamed). |
I will compare what you have to what I have on Monday and will report in! On Sun, 17 Apr 2016 at 14:11 omar notifications@github.com wrote:
|
Immediately I notice that you're only using one OpenGL context, but if that On Sun, 17 Apr 2016 at 17:22 Matt Davies mattie.davies@gmail.com wrote:
|
@Cthutu Any news on that? I still have to admit that contexts are confusing because a) imgui_impl_xxx files aren't very context aware. b) Font Atlas being shared by default makes things confusing. Would definitively need to clarify the situation with font atlas.
|
I haven't been able to check this out yet. I'm currently busy at ToJam but On Sun, 8 May 2016 at 11:01 omar notifications@github.com wrote:
|
FYI, things have been delayed to Monday so I will look at updating my imgui On Sun, 8 May 2016 at 12:22 Matt Davies mattie.davies@gmail.com wrote:
|
@Cthutu Any news of that? Still looking for a repro :) |
Could we get to the bottom of this topic? AFAIK:
|
This is briefly mentioned in #586 but when I switch state via the
ImGui::SetInternalState()
API, the fonts that is the not most recently created instance get corrupted. There is a work around. I run this code before the draw loops (OpenGL renderer):And immediately I bind the texture:
I am essentially reloading the OpenGL textures. Is this because
ImGui::SetInternalState()
is moving the font texure around in memory and the OpenGL texture is referencing old memory? I haven't analysed the behaviour between switching internal states yet, but I thought I'd let you be aware of it.The text was updated successfully, but these errors were encountered: