Comments (6)
I'll submit a pull request
I'll also add a function to ImGuiIntegration::Context
to get the atlas texture:
GL::Texture2D &getAtlasTexture();
from magnum-integration.
I should explain what I'm doing too, probably helpful (maybe good for documentation?).
Big picture I'm trying to use color emojis, and do it seamlessly. I should be able to put an emoji in a raw string literal and pass it to ImGui::Text() and it renders a color emoji.
I'm very close.
I can create a custom glyph with a codepoint in the atlas and it renders(yay!), but I need:
- Access to the texture in memory after
ImFontAtlas::Build()
or - Access to the
GL::Texture2D
after it is sucked into the GPU memory
Preferably the latter, because this library makes GL texture stuff not painful!
from magnum-integration.
The first option is not possible becuase ImGuiIntegration::Context::relayout()
both calls ImFontAtlas::Build()
and creates a texture out of that, so none of my code can edit the built (and in CPU memory) texture data
from magnum-integration.
Hi again!
Apologies if I'm misunderstanding what you want to do (not using ImGui that much myself, definitely not on the advanced level you're on, haha) -- so you are able to add extraneous glyphs together with their position in the atlas to ImGui, but it doesn't let you upload the data for it, and thus you need to do that manually by accessing the texture after, right?
Adding a texture()
getter is a no-brainer, not sure why that was not done already. I'm not sure what exactly would io.Fonts->SetTexID(reinterpret_cast<ImTextureID>(&_texture));
do, but maybe it simplifies the render to not need this branching here?
magnum-integration/src/Magnum/ImGuiIntegration/Context.cpp
Lines 301 to 302 in 43e86c2
none of my code can edit the built
did you try calling io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height, &pixelSize)
on your side after you have all fonts set up and before calling relayout()
? It should cause the texture to be built slightly earlier, but then you'd somehow need to reset the IsLoaded()
flag so relayout()
knows it needs to repopulate the GPU texture ... and I don't know if/how is that possible. Adding some sort of callback or splitting relayout()
into two parts to make the access possible would be overcomplicating things for everyone else I'm afraid :/ So this texture access is probably the best way to go about it.
maybe good for documentation?
Definitely! If you open a PR, would be great to expand the Context docs with this -- useful for lots of other users :) Thanks in advance.
(Please note I'm going to be without an access to a computer for the whole next week, so won't be able to do any merging or reviewing until I get back.)
from magnum-integration.
Howdy,
Yes, ImFontAtlas::AddCustomRectFontGlyph
lets me specify a Rect to pack into the atlas and map it to a codepoint.
https://github.com/ocornut/imgui/blob/ebe79bbed00a13fd4455f04131b63d49c28ebd5d/imgui.cpp#L230-L234
That is from release v1.69 which is what I think magnum-integration v2019.01 was tested against?
(I am using the unicode branch, which is v1.75 wip)
The comment from the above link says This will be passed back to your via the renderer
.
So I tested simplifying that ternary statement and it works! (obviously doesn't work without TexID being set)
And the tests pass on my machine too.
I agree that splitting relayout would be weird, but what about optionally delaying repopulating the GPU texture until newframe? Im not sure. This isn't the issue i'm trying to solve, i'm just spitballing.
Cool! I'll try to write a snippet or two.
from magnum-integration.
Fixed by #61, thank you!
from magnum-integration.
Related Issues (20)
- Add Support for Dear ImGui extensions HOT 1
- i get an error when i am trying running a robotic simulation with robot_dart and magnum HOT 1
- Crash in magnum-imgui Example Program HOT 1
- Consider switching from the legacy Find*.cmake modules to install(TARGETS ... EXPORT ...) HOT 10
- Could NOT find MagnumIntegration (missing: Dart) HOT 1
- [arch] build fails - lwop_ivec3 not defined HOT 2
- Magnum::ImGuiIntegration missing from debian package HOT 5
- How to use ImGui integration as subdirectory HOT 6
- Custom flags for Dear ImGui integration HOT 4
- Fail to build target iOS HOT 5
- ArchLinux PKGBUILD needs fixes HOT 1
- Linking failure with ImGui HEAD HOT 2
- ImGui integration does not support drawing lots of elements (ImGuiBackendFlags_RendererHasVtxOffset) HOT 7
- ImGui integration does not support adding UserCallback to DrawList HOT 1
- ImGui IdxOffset not honored correctly during frame drawing HOT 4
- Key Events have changed in ImGui HOT 10
- ImGUI IO assertion failure HOT 3
- Imgui_internal.h IMGUI_API inclusion HOT 16
- MSYS .gitattributes typo: Wrong line ending normalization under Windows HOT 2
- ImGuiIO modifier key states incorrect under Linux/X11 (glfw) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magnum-integration.