Open swhoro opened 2 months ago
I find it is because in line484, I set wrong scissor.
But why window border can display correctly? It seems when drawing window border, the pcmd->ClipRect
is {0,0,1080,720}
,which is the whole imgui viewport, but when drawing the button, the pcmd->ClipRect
is {1,1,499,499}
, which only contain the button area. What exactly does pcmd->ClipRect
mean?
Backends don't currently support transforming inputs or render. You can modify ImDrawData::DisplayPos from (0,0) to (-100,0) and it will look right, but inputs will be incorrect anyhow.
I don't see/understand the reason for setting VkViewport{x=100,y=0,width=1080,height=720}
and already DisplayPos. Why not giving access to the full platform window to dear imgui ?
Backends don't currently support transforming inputs or render. You can modify ImDrawData::DisplayPos from (0,0) to (-100,0) and it will look right, but inputs will be incorrect anyhow.
I don't see/understand the reason for setting
VkViewport{x=100,y=0,width=1080,height=720}
and already DisplayPos. Why not giving access to the full platform window to dear imgui ?
I am coding for an engine and in that engine, I can only draw on a certain area on the screen.
For example, I write a text_layer
for the engine. Every time they use the text_layer
, they will tell me where to draw the text, how big it should be and what the content is, but will not give me the screen size. I can only code for the text_layer
, and outside the layer, I can not call ImGui::*
functions. So for each layer, I maintain a standalone ImGui context, and set the viewport offset and size to what they give.
The code I list above is only a simple example to reproduce the problem what I get in that engine.
It seems a bad design but I can do nothing about this.
By the way, it seems pcmd->ClipRect
meaning the "parent" elmenet size? For imgui window, it is the whole imgui viewport, and for a button, it is the window.
Version/Branch of Dear ImGui:
Version 1.90.9
Back-ends:
no backends
Compiler, OS:
ubuntu 20.04 + gcc 9.4.0
Full config/build information:
No response
Details:
I want the width of a button to fill the window. If I use the normal VkViewport, for example, create a glfw window with width=1280, height=720, set
VkViewport{x=0,y=0,width=1280,height=720}
, and setio.Displaysize={1280,720}
, it display correctly. But if I want the glfw window has 100 padding on x (setVkViewport{x=100,y=0,width=1080,height=720}
andio.Displaysize={1080,720}
), then the right part of the button is not displayedScreenshots/Video:
This is the image in which I do not set viewport and button has full width
This is the image I set viewport as I described above and right part of the button is cutted
Minimal, Complete and Verifiable Example code:
https://gist.github.com/swhoro/be2b72efad472558363b6f1debef46a2 This is almost the same as https://github.com/SaschaWillems/Vulkan/blob/master/examples/imgui/main.cpp except line 101, 380, 458, 758 and 761.