guizmo is out of the box if I'm far away
HODAKdev opened this issue · comments
Hi, the closer I am to the object, the more guizmo is centered and the further I go backwards, the more it bends, it is normal?
https://user-images.githubusercontent.com/82084934/129267758-0bd2f7b1-8049-43bb-9cab-d2ba7d119795.mp4
That's an interesting issue! thank you for reporting.. I'm taking a look
I could not repro the issue. Are you sure the rectangle/view sizes are properly set? It's the only way I see such issue can happen
Thank you for your response, I think everything is right.
I render the scene to a framebuffer and apply it to the ImGui::Image(...);
This is how I set the ImGuizmo..
ImGuizmo::Enable(true);
ImGuizmo::SetOrthographic(false);
ImGuizmo::SetDrawlist();
// window pos, window size
ImGuizmo::SetRect(pos.x, pos.y, framebuffer::mSize.x, framebuffer::mSize.y);
ImGuizmo::Manipulate(glm::value_ptr(sceneCamera::view),
glm::value_ptr(sceneCamera::projection),
mCurrentGizmoOperation, mCurrentGizmoMode,
glm::value_ptr(model),
NULL, useSnap ? &snap[0] : NULL);
I have all matrices as glm::mat4
.
I also tried &...[0][0]
without glm::value_ptr
and the same.
I also tried to draw a grid and it worked exactly like guizmo.
Can you provide an example on github that I can clone and test?
Can you provide an example on github that I can clone and test?
Of course, I'm working on that.
I think the size (and aspect ratio) provided to glViewPort here:
https://github.com/HODAKdev/imguizmo_bug/blob/563221d25b58bc710832f079ced25f81bbedee5d/vega/engine/vega/vega.h#L170
do not correspond to the size here :
The effect is more visible when the window get resized.
You should get the content size available for the docked window before calling glViewPort.
I think the size (and aspect ratio) provided to glViewPort here:
https://github.com/HODAKdev/imguizmo_bug/blob/563221d25b58bc710832f079ced25f81bbedee5d/vega/engine/vega/vega.h#L170do not correspond to the size here :
The effect is more visible when the window get resized.
You should get the content size available for the docked window before calling glViewPort.
Why isn't it correspond when mSize.x & mSize.y has the same size?
You should get the content size available for the docked window before calling glViewPort.
I've tried it and it's always the same, i think the problem is in this: https://github.com/HODAKdev/imguizmo_bug/blob/563221d25b58bc710832f079ced25f81bbedee5d/vega/engine/vega/vega.h#L176
the glviewport call for displaying 3D should correspond to the imgui window content size
the glviewport call for displaying 3D should correspond to the imgui window content size
I tried it but it didn't help :(
I looked at some game engines that use imgui and imguizmo and it works exactly like mine.
I did a quick and dirty fix : https://github.com/HODAKdev/imguizmo_bug/pull/1
the position/size for the 3d content glviewport did not correspond to the window size. it must be the same as setrect for the gizmo or 3d and gizmo viewport are out of sync.
Did you try to call BeginFrame();
for each view?
Also, take a look at window mode :
Line 278 in 81e29da
Never mind I'll leave it like this and thank you very much for your help.