OpenGLRenderer on Linux renders CEGUI samples upside-down

Issue #1063 resolved
Marvin Gülker
created an issue

Operating System: ArchLinux (64bit) OS version/build: Linux hades 3.18.6-1-ARCH #1 SMP PREEMPT Sat Feb 7 08:44:05 CET 2015 x86_64 GNU/Linux

The OpenGLRenderer on Linux renders everything upside-down and tiny. This even happens with the official CEGUI samples, so I’m filing this as a bug now. Here’s the original discussion on the forums: http://cegui.org.uk/forum/viewtopic.php?f=10&t=6995#p33375

Reproducibility: always

Reproduction steps:

  1. Compile GLFW2 if your distro doesn’t have it in the repositories (like ArchLinux; it’s in the AUR there. Arch itself only has GLFW3).

  2. CEGUI’s build system doesn’t properly detect glfw2 and pthreads, failing with linking errors. Hence, execute export LDFLAGS=" -lglfw2 -pthread -lpthread " to overcome this.

  3. Now compile CEGUI; it should also build the samples.

  4. Run CEGUISampleFramework-0.8.

  5. Everything is upside down and tiny, as shown in the below screenshot. Even the mouse cursor behaves exactly inverted (moving left moves it right, down moves it up, etc.)

Screenshot: Screenshot

Greetings Marvin

Comments (23)

  1. Carsten Teibes

    I am also on (Arch) Linux and have the same issue. I use the free radeon (mesa) driver and openbox. A minimal example with just sfml, cegui and opengl initialization gives a similar mirrored and shrunk image:

    screenshot

  2. Marvin Gülker reporter

    Additional information on my system (sorry I didn’t provide it earlier):

    Graphics card:

    % lspci | grep VGA
    01:00.0 VGA compatible controller: NVIDIA Corporation G92 [GeForce GTS 250] (rev a2)
    

    I’m using the free nouveau driver, version 1.0.11 with X.org 1.17.1 on an i3 window manager. But changing to XFCE doesn’t change anything.

    I will now try Ident’s further suggestions from the forum thread.

    Greetings Marvin

  3. Marvin Gülker reporter

    The result is exactly the same as shown in my initial screenshot if I tell it to use the OpenGL 3.2 Core Renderer.

    I also tried the binary NVIDIA driver crap. That doesn’t work neither, the result stays the same as shown already; no difference between OpenGL and OpenGL 3.2 Core Renderers. I used the nvidia-304xx legacy driver version 304.125-9.

    Greetings Marvin

  4. Lukas Meindl

    This is a very very strange issue.

    Just to add this relevant piece of info from the forum: The functionality seems to be still intact, the windows' assumed positions are correctly reflected in the interaction functionality. The issue therefore seems to lie only in the way things are rendered. Additionally I asked some people on the IRC channel using Linux and they couldn't reproduce it (the user also replied in Thomas' thread).

    Despite having worked quite a lot with OpenGL I can not think of any possible explanation for this. My issue here is also that I don't have any Linux or Unix setup here to try this out, and without reconstruction it is always difficult to solve such issues. But I will still try my best to solve this.

    Marvin wrote:

    Even the mouse cursor behaves exactly inverted (moving left moves it right, down moves it up, etc.)
    

    If everything is inverted and rendered inverted then this comes as no surprise. The surprise would be if the functionality would be different, e.g.: a button that is (according to the code) positioned on top left, is not clickable if the mouse is moved (in reality, not visually) to the top-left.This would mean the CEGUI core code would be somehow at fault.

    Can you guys tell me what exact version you all use? The selected version in this issue-tricket is 0.8.4, did you all use this one or did one of you not? And: was this a packaged version in your distro - if yes was it the same package you all used? Did anyone try to build the Samplebrowser in v0-8 from sources to see if anything is different (sorry if this has already been said somewhere!) ? Has anyone tried an older version such as 0.8.0? I know that is a lot of questions but currently I see this as the best way to narrow down the cause of the issue.

  5. Marvin Gülker reporter

    Can you guys tell me what exact version you all use? The selected version in this issue-tricket is 0.8.4

    I used CEGUI 0.8.4.

    And: was this a packaged version in your distro

    I tried with both the distro’s version and a version I build all from the official source at http://prdownloads.sourceforge.net/crayzedsgui/cegui-0.8.4.tar.bz2?download to be extra sure (with removing the distro’s CEGUI first). Does not make any difference, which would have wondered me anyway — ArchLinux does not patch its software usually. Here’s the build script they use to build CEGUI: https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/cegui

    Did anyone try to build the Samplebrowser in v0-8 from sources to see if anything is different

    The screenshots I posted are all from the vanilla Samplebrowser I built from the official CEGUI sources. I said that in the OP also where I posted built instructions actually.

    Has anyone tried an older version such as 0.8.0?

    No, I haven’t tried that. I can do later and report.

    Greetings Marvin

  6. Lukas Meindl

    The screenshots I posted are all from the vanilla Samplebrowser I built from the official CEGUI sources. I said that in the OP also where I posted built instructions actually.

    When I say v0-8 I mean a recent v0-8 branch clone/download from the repo, just in case this was not clear.

    Hmm it would be great if you could try out 0.8.0, maybe even a 0.7.X version and see what the Samplebrowser (or Samples in 0.7) do there.

    The fact that some users of Linux distributions (2 so far + 1 developer) reported it works for them, sort of hints toward that it might be driver-related.

  7. Marvin Gülker reporter

    When I say v0-8 I mean a recent v0-8 branch clone/download from the repo, just in case this was not clear.

    Ah ok. I will try that.

    Hmm it would be great if you could try out 0.8.0

    I just tried it, and 0.8.0 has the same issue, both with the OpenGL and the OpenGL3 renderer.

    The fact that some users of Linux distributions (2 so far + 1 developer) reported it works for them, sort of hints toward that it might be driver-related.

    Above it was reported the issue also happens with the Radeon driver. It would mean the driver issue would be present in a) the NVIDIA binary driver b) the free nouveau driver and c) the free Radeon driver. Radeon is for the ATI graphics cards, so it would also mean the issue would happen both on NVIDIA and on ATI cards. This makes a driver-related issue quite unlikely in my opinion.

    I will try a 0.7 and a repository checkout also and report back.

    Greetings Marvin

  8. Lukas Meindl

    It is very unlikely that the latest v0-8 version will work based on the observation that neither 0.8.0 nor 0.8.4 work and neither of the GL renderers in each of those versions work, as there have not been any crucial fixes regarding rendering since 0.8.4 release. So, from my side, there is no need to try that out anymore.

  9. Marvin Gülker reporter

    Lukas, I have bad news for you :-).

    1. I have now tried CEGUI 0-8 from the repository. It doesn’t work, same results as before.
    2. I have also tried CEGUI 0.7.9. And now guess what. It works.

    See the below screenshot, which is CEGUI 0.7.9’s Demo6. This suggests strongly there must have been some changes in CEGUI’s OpenGLRenderer. If I can be of any further help with this, just tell me.

    cegui.png

    Greetings Marvin

  10. Lukas Meindl

    I diffed the Renderers and found nothing of value (more info in the forum)

    User dermont wrote:

    Out of interest what NVidia drivers are using proprietary or nouveau?
    I've had problems in the past with screwed up graphics with the nvidia proprietary drivers installed and the nouveau being loaded.
    Since people with different cards/make/drivers are having the same problem then it's probably not related.
    I've run the SampleFramework with NVidia proprietary drivers on Ubuntu 346.35/346.37 (and quite a few
    versions before) and Feodora 331.104/331.113 and both the GL/GL3 samples run fine.
    lsmod | grep 'nvidia'
    lsmod | grep 'nouveau'
    lspci -k
    

    Can anyone try this out?

  11. Marvin Gülker reporter

    The issue happens with both the free nouveau and the proprietary NVIDIA driver for me (version numbers see above).

    Here’s the output for me running free nouveau:

    (10001) [0:06:28 quintus@hades] ~
    % lsmod | grep nvidia
    (10002) [0:06:34 quintus@hades] ~
    % lsmod | grep nouveau
    nouveau              1344416  2 
    mxm_wmi                12515  1 nouveau
    video                  22205  1 nouveau
    ttm                    81779  1 nouveau
    drm_kms_helper         98881  1 nouveau
    drm                   273125  5 ttm,drm_kms_helper,nouveau
    i2c_algo_bit           12744  1 nouveau
    wmi                    17339  2 mxm_wmi,nouveau
    hwmon                  12930  3 asus_atk0110,k10temp,nouveau
    i2c_core               50240  5 drm,i2c_piix4,drm_kms_helper,i2c_algo_bit,nouveau
    button                 12953  1 nouveau
    (10003) [0:06:37 quintus@hades] ~
    % lspci -k
    00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD/ATI] RX780/RX790 Host Bridge
        Subsystem: ASUSTeK Computer Inc. Device 8353
    00:02.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RX780/RD790 PCI to PCI bridge (external gfx0 port A)
        Kernel driver in use: pcieport
        Kernel modules: shpchp
    00:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD790 PCI to PCI bridge (PCI express gpp port A)
        Kernel driver in use: pcieport
        Kernel modules: shpchp
    00:0a.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD790 PCI to PCI bridge (PCI express gpp port F)
        Kernel driver in use: pcieport
        Kernel modules: shpchp
    00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [IDE mode] (rev 40)
        Subsystem: ASUSTeK Computer Inc. Device 8443
        Kernel driver in use: ahci
        Kernel modules: ahci
    00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
        Subsystem: ASUSTeK Computer Inc. M5A88-V EVO
        Kernel driver in use: ohci-pci
        Kernel modules: ohci_pci
    00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
        Subsystem: ASUSTeK Computer Inc. M5A88-V EVO
        Kernel driver in use: ehci-pci
        Kernel modules: ehci_pci
    00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
        Subsystem: ASUSTeK Computer Inc. M5A88-V EVO
        Kernel driver in use: ohci-pci
        Kernel modules: ohci_pci
    00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
        Subsystem: ASUSTeK Computer Inc. M5A88-V EVO
        Kernel driver in use: ehci-pci
        Kernel modules: ehci_pci
    00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 SMBus Controller (rev 42)
        Kernel modules: i2c_piix4, sp5100_tco
    00:14.1 IDE interface: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 IDE Controller (rev 40)
        Subsystem: ASUSTeK Computer Inc. Device 8443
        Kernel driver in use: pata_atiixp
        Kernel modules: pata_atiixp, pata_acpi, ata_generic
    00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
        Subsystem: ASUSTeK Computer Inc. Device 8445
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel
    00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 LPC host controller (rev 40)
        Subsystem: ASUSTeK Computer Inc. M5A88-V EVO
    00:14.4 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 PCI to PCI Bridge (rev 40)
    00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
        Subsystem: ASUSTeK Computer Inc. M5A88-V EVO
        Kernel driver in use: ohci-pci
        Kernel modules: ohci_pci
    00:16.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
        Subsystem: ASUSTeK Computer Inc. M5A88-V EVO
        Kernel driver in use: ohci-pci
        Kernel modules: ohci_pci
    00:16.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
        Subsystem: ASUSTeK Computer Inc. M5A88-V EVO
        Kernel driver in use: ehci-pci
        Kernel modules: ehci_pci
    00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor HyperTransport Configuration
    00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Address Map
    00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor DRAM Controller
        Kernel modules: amd64_edac_mod
    00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Miscellaneous Control
        Kernel driver in use: k10temp
        Kernel modules: k10temp
    00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Link Control
    01:00.0 VGA compatible controller: NVIDIA Corporation G92 [GeForce GTS 250] (rev a2)
        Kernel driver in use: nouveau
        Kernel modules: nouveau
    02:00.0 USB controller: ASMedia Technology Inc. ASM1042 SuperSpeed USB Host Controller
        Subsystem: ASUSTeK Computer Inc. P8B WS Motherboard
        Kernel driver in use: xhci_hcd
        Kernel modules: xhci_pci
    03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
        Subsystem: ASUSTeK Computer Inc. P8P67 and other motherboards
        Kernel driver in use: r8169
        Kernel modules: r8169
    (10004) [0:06:41 quintus@hades] ~
    % 
    

    I can provide you with the output for the proprietary driver tomorrow (too late today).

    And btw, yes, I’m saying the truth :-). The screenshots are not faked.

    Greetings Marvin

  12. Lukas Meindl

    Just to clear that up: I was not saying that you are not saying the truth :). What I tried to say was that I consider it a possibility that the might have usedthe nouveau drivers although you had installed and chosen the proprietery ones. Or can you rule this out with absolute certainty (I dont know how these things work on your OS but I had issues with that for example on Windoze)?

    I talked to some guy in #nouveau and he asked for an apitrace: https://github.com/apitrace/apitrace I guess I could make one too, but just to be certain that the trace will actually be meaningful, i would like to ask anyone for whom this does not render correctly to create one. After all there could be a difference in the compiled binaries that could affect the final GL commands and their parameters in one way or the other. So having this created by someone with issues is the only safe way. I will then approach the guy on #nouveau again with it and see if we can figure something out, even if this issue is not isolated to nouveau.

  13. Marvin Gülker reporter

    What I tried to say was that I consider it a possibility that the might have usedthe nouveau drivers although you had installed and chosen the proprietery ones. Or can you rule this out with absolute certainty (I dont know how these things work on your OS but I had issues with that for example on Windoze)?

    I can rule this out completely, because the packages for the nouveau and the proprietary driver conflict in ArchLinux. The package manager doesn’t even let you install both at once. Also, the NVIDIA packages blacklist the nouveau kernel module so you have to manually undo the blacklisting to get a driver conflict. (I can’t help smiling each time I see such reports by Windows users :-)).

    I talked to some guy in #nouveau and he asked for an apitrace: https://github.com/apitrace/apitrace I guess I could make one too, but just to be certain that the trace will actually be meaningful, i would like to ask anyone for whom this does not render correctly to create one.

    Wow, these API traces are large. I have created one for a run with legacy OpenGL and one for a run with OpenGL3. This is the output on the terminal for legacy OpenGL:

    % LD_LIBRARY_PATH=/opt/cegui-0.8-tip/lib apitrace trace /opt/cegui-0.8-tip/bin/CEGUISampleFramework-0.8 
    apitrace: loaded into /usr/bin/apitrace
    apitrace: loaded into /opt/cegui-0.8-tip/bin/CEGUISampleFramework-0.8
    -- CEGUI Sample Application Framework --
    Please select a renderer:
    1. OpenGL GUI Renderer.
    2. OpenGL 3.2 Core Renderer.
    1
    apitrace: tracing to /home/quintus/tmp/CEGUISampleFramework-0.8.trace
    apitrace: redirecting dlopen("libGL.so.1", 0x102)
    apitrace: warning: glXChooseFBConfigSGIX: unknown key 0x8013, interpreting value as int
    apitrace: warning: glXChooseFBConfigSGIX: unknown key 0x8013, interpreting value as int
    apitrace: warning: unknown function "glPolygonOffsetClampEXT"
    apitrace: warning: unknown function "glXQueryCurrentRendererIntegerMESA"
    apitrace: warning: unknown function "glXQueryCurrentRendererStringMESA"
    apitrace: warning: unknown function "glXQueryRendererIntegerMESA"
    apitrace: warning: unknown function "glXQueryRendererStringMESA"
    

    The terminal output for OpenGL3:

    % LD_LIBRARY_PATH=/opt/cegui-0.8-tip/lib apitrace trace /opt/cegui-0.8-tip/bin/CEGUISampleFramework-0.8
    apitrace: loaded into /usr/bin/apitrace
    apitrace: loaded into /opt/cegui-0.8-tip/bin/CEGUISampleFramework-0.8
    -- CEGUI Sample Application Framework --
    Please select a renderer:
    1. OpenGL GUI Renderer.
    2. OpenGL 3.2 Core Renderer.
    2
    apitrace: tracing to /home/quintus/tmp/CEGUISampleFramework-0.8.trace
    apitrace: redirecting dlopen("libGL.so.1", 0x102)
    apitrace: warning: glXChooseFBConfigSGIX: unknown key 0x8013, interpreting value as int
    apitrace: warning: glXChooseFBConfigSGIX: unknown key 0x8013, interpreting value as int
    apitrace: warning: unknown function "glVertexAttribParameteriAMD"
    apitrace: warning: unknown function "glQueryObjectParameteruiAMD"
    apitrace: warning: unknown function "glBeginQueryANGLE"
    apitrace: warning: unknown function "glDeleteQueriesANGLE"
    apitrace: warning: unknown function "glEndQueryANGLE"
    apitrace: warning: unknown function "glGenQueriesANGLE"
    apitrace: warning: unknown function "glGetQueryObjecti64vANGLE"
    apitrace: warning: unknown function "glGetQueryObjectivANGLE"
    apitrace: warning: unknown function "glGetQueryObjectui64vANGLE"
    apitrace: warning: unknown function "glGetQueryObjectuivANGLE"
    apitrace: warning: unknown function "glGetQueryivANGLE"
    apitrace: warning: unknown function "glIsQueryANGLE"
    apitrace: warning: unknown function "glQueryCounterANGLE"
    apitrace: warning: unknown function "glCreateSyncFromCLeventARB"
    apitrace: warning: unknown function "glPolygonOffsetClampEXT"
    apitrace: warning: unknown function "glBeginPerfQueryINTEL"
    apitrace: warning: unknown function "glCreatePerfQueryINTEL"
    apitrace: warning: unknown function "glDeletePerfQueryINTEL"
    apitrace: warning: unknown function "glEndPerfQueryINTEL"
    apitrace: warning: unknown function "glGetFirstPerfQueryIdINTEL"
    apitrace: warning: unknown function "glGetNextPerfQueryIdINTEL"
    apitrace: warning: unknown function "glGetPerfCounterInfoINTEL"
    apitrace: warning: unknown function "glGetPerfQueryDataINTEL"
    apitrace: warning: unknown function "glGetPerfQueryIdByNameINTEL"
    apitrace: warning: unknown function "glGetPerfQueryInfoINTEL"
    apitrace: warning: unknown function "glClearDepthfOES"
    apitrace: warning: unknown function "glClipPlanefOES"
    apitrace: warning: unknown function "glDepthRangefOES"
    apitrace: warning: unknown function "glFrustumfOES"
    apitrace: warning: unknown function "glGetClipPlanefOES"
    apitrace: warning: unknown function "glOrthofOES"
    apitrace: warning: unknown function "glXQueryCurrentRendererIntegerMESA"
    apitrace: warning: unknown function "glXQueryCurrentRendererStringMESA"
    apitrace: warning: unknown function "glXQueryRendererIntegerMESA"
    apitrace: warning: unknown function "glXQueryRendererStringMESA"
    

    And here are the API traces. I was forced to compress them, because uploading 100+ MiB over my connection doesn’t work out well:

    Here are the MD5 checksums for those files:

    3e69a5fa2396891ca8fee4d7c373565e  apitrace-opengl3.trace.xz
    08f8533d4a2a4129236a4c34de19ff9e  apitrace-opengl.trace.xz
    

    Nouveau version in use is 1.0.11, with X.org 1.17.1 on Linux kernel 3.19.2-1-ARCH. Graphics card is the same as I already posted above.

    Greetings Marvin

  14. Marvin Gülker reporter

    What I forget to say: I used the CEGUISampleFramework from the current 0-8 tip:

    % hg identify
    e037b564090f (v0-8) tip
    

    I’ve not used Mercurial before (Git user here), so forgive me if it takes me a while to figure things out.

    Greetings Marvin

  15. Lukas Meindl

    With the help of imirkin we reached a point where we could exclude the drivers as a source for the issue. After comparing the matrices on my and imirkin's system I checked the source code again and got suspicious about glm. Well, indeed it was glm. I didn't see the forest for the trees: This is a very clear explanation as to why I couldnt reproduce it and why it didn't work for people doing updates, without regard of the drivers used. Strangley enough, also nobody else thought of glm (or the dependencies in general) as a potential source for the issue. I got the latest glm and can now reproduce the issue, fixing it should be easy now. I will report back.

  16. Lukas Meindl

    A solution is provided by editing the glm::perspective call in RenderTarget.inl to:

    glm::mat4 projectionMatrix = glm::perspective(glm::radians(30.f), aspect, float(d_viewDistance * 0.5), float(d_viewDistance * 2.0));
    

    for glm versions 0.9.6 or higher

    I will write a macro for this tomorrow for all Renderers affected.

  17. Lukas Meindl

    Fixed in default: https://bitbucket.org/cegui/cegui/commits/1886b978a955a57cc00a0b7b9b2d042c009ca174 and in v0-8: https://bitbucket.org/cegui/cegui/commits/dd3b82d47cf7b142938f89ed3be59b13c04a6d8c

    This should work even if GLM_FORCE_RADIANS is activated in 0.9.5 or older. It should also work for 0.9.6 and higher. I tested this and other glm functionalities intensively for hours today.

    @Marvin Gülker , please try out the latest v0-8 and see if it works for you! I will wait for your feedback before I mark this issue as resolved.

  18. Log in to comment