mirror of
https://github.com/ocornut/imgui.git
synced 2026-10-18 19:13:38 +00:00
ImGui upside down with glClipControl(GL_UPPER_LEFT, ...) #3143
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#3143
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Version/Branch of Dear ImGui:
Version: 1.76
Branch: v1.76 tag
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: gcc
Operating System: Linux
My Issue/Question:
Paste the following line into the
example_glfw_opengl3/main.cpp(or probably any other example using opengl3) just after the extension loader is initialized:glClipControl(GL_UPPER_LEFT, GL_NEGATIVE_ONE_TO_ONE);(I had to change the Makefile to use glew instead of gl3w as the bundled gl3w lacks this function).
If I launch the example, the whole gui appears upside down, see the attached screenshot below.
In #2186 you fixed the glScissor in this case, but it only fixes the graphical glitches due to using wrong scissor coordinates, it doesn't do anything about the inverted y coordinate while drawing.
I see two ways to fix this:
glClipControl(GL_LOWER_LEFT, whatever);before rendering andglClipControl(GL_UPPER_LEFT, original_depth_mode);after. It's probably not the nicest solution, but more like a workaround that can be employed from the user code, like:clip_origin_lower_left == truein the current code). The reason behind this is that glClipControl changes how normalized device coordinates work, but not window space coordinates used by glViewport, glScissor and the likes. See issue 12 here: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_clip_control.txt (and also issue 18 about frequent clip space changes, required by the first method).Screenshots/Video

Standalone, minimal, complete and verifiable example:
You will need OpenGL 4.5 or the GL_ARB_clip_control extension
Hello,
Thanks for the report. I am a little bit confused about why #2186 seemingly passed if you suggest it is incomplete (please note I've only skimmed on this).
If not all loaders have the function it might be easier to adopt solution 2, would inverting T/B in
ImGui_ImplOpenGL3_SetupRenderState()work? Could you submit a PR for it?Thank you!
Hello,
I'm not sure what is going on #2186, when I first tried imgui in my app I simply thought it has no support for glClipControl because everything was inverted vertically. I checked out
f52f0a5mentioned in #2186 and it's upside down there too.I think I can make a PR (in a few days).
Fixed by merged PR #3146, thank you!