OpenGL upside down?

Discussions about using Windows guests in VirtualBox.
Martin
Volunteer
Posts: 2560
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: OpenGL upside down?

Post by Martin »

I've also seen the "upside down problem" many months ago in a Windows 10 VM running on a Linux host with Intel graphics.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: OpenGL upside down?

Post by mpack »

For all of the people who posted logs, and adding the OP who merely stated the same facts, everyone but one suffering the problem has a Linux host, Intel graphics and enabled 3D acceleration (i.e. they are using the OpenGL translation layer). The one exception (FourSeasons) reports the same problem on MacOS hosts but still with Intel graphics and 3D acceleration. Perhaps MacOS and Linux drivers are related somehow.

The only person who suggested NVidia was "creqxynfbjizrtcxfe", and he did so without supporting evidence or info. He appears to have made similar unsupported comments about NVidia in two separate topics covering entirely different graphics related problems: so I'm going to disregard his comments until accompanied by convincing evidence.

Oh - and since nobody who reports this problem is using a Windows Host, that definitely excludes hardening as an explanation.
mrmartin
Posts: 6
Joined: 3. Feb 2021, 15:58
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: various MS and Linux

Re: OpenGL upside down?

Post by mrmartin »

mpack wrote:For all of the people who posted logs, and adding the OP who merely stated the same facts, everyone but one suffering the problem has a Linux host, Intel graphics and enabled 3D acceleration (i.e. they are using the OpenGL translation layer). The one exception (FourSeasons) reports the same problem on MacOS hosts but still with Intel graphics and 3D acceleration. Perhaps MacOS and Linux drivers are related somehow.


I have been running a Win8.1 guest with VBoxVGA graphics controller and no 3D acceleration to run BricsCad, a 2D- and 3D-CAD-Software, inside a Linux host (Xubuntu 18.04 LTS) for years now.
The hardware I run this on is a Thinkpad W530 with Optimus dual graphics, i.e. both an Intel Graphics adapter and an NVIDIA GK107GLM Quadro K2000M installed.
For performance reasons the Intel Graphics Adapter is disabled in BIOS.
A few months ago I switched the guest to the VBoxSVGA graphics controller with 3D acceleration enabled, hoping to be finally able to use hardware rendering for displaying 3D-models, as software rendering is way too slow and of poor quality to be usable.
When I try to display a 3D-model in a viewport inside the CAD-Software, I am experiencing the same upside-down / back-forth problem as the OP. If I disable 3D-acceleration in VirtualBox, so that software rendering is used again, the 3D-model ist displayed correctly, but the rendering takes too long, as mentioned above. 2D works flawless in any case.
So the problem isn't exclusively an Intel issue, but must rather be related to the VirtualBox driver or to Open-GL, I think.
Unfortunately I don't have a clue about the underlying driver and OpenGL stuff, but perhaps my case helps to find the source of the problem.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: OpenGL upside down?

Post by mpack »

Thanks for that. A zipped VM log would be nice as confirmation of what you say.

Hmm. You made me notice that my list of defining characteristics is not complete, e.g. it doesn't mention Windows Guest, which I think is a requirement. Ditto VBoxSVGA.

Ok, here is what I hope is now a complete list of characteristic features:
  1. Linux (or MacOS?) host. It would be nice to pin this down further, e.g. identify an exact distro that the devs might be able to install, and an exact host driver version. Don't ask me how to get this info - I'm not a Linux user.
  2. Windows Guest.
  3. 3D acceleration enabled (thus requiring OpenGL support on host).
  4. VBoxSVGA graphics (required?).
  5. Intel Graphics on host (now disputed)
mrmartin
Posts: 6
Joined: 3. Feb 2021, 15:58
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: various MS and Linux

Re: OpenGL upside down?

Post by mrmartin »

Thanks for that. A zipped VM log would be nice as confirmation of what you say.
Here you are: the logfile and a screenshot of the upside-down-effect (The silhouette is supposed to stand on the floor.) The coordinate system (pink marking) shows that + and - values of both Y-axis and Z-axis are inverted.
I reproduced the error twice at the end of the logged session.
I have to correct myself in one point: it's a Windows 7 guest that we are talking about, but I don't think that this is important here, is it?

EDIT: Information on Graphics driver installed on the Xubuntu 18.04 host system:
Card: NVIDIA GK107GLM [Quadro K2000M] bus-ID: 01:00.0
Display Server: x11 (X,Org 1.19.6 )
drivers: nvidia (unloaded: modesetting,fbdev,vesa,nouveau)
Resolution: 1920x1200@59.95hz
OpenGL: renderer: Quadro K2000M/PCIe/SSE2
version: 4.6.0 NVIDIA 418.181.07 Direct Render: Yes
Attachments
210203_screenshot_upside-down_markiert.PNG
210203_screenshot_upside-down_markiert.PNG (76.62 KiB) Viewed 9647 times
upside-down-problem_vm_Win_7-2021-02-04-00-00-40-log.zip
logfile VirtualBox VM for upside-down-problem
(36.87 KiB) Downloaded 61 times
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: OpenGL upside down?

Post by mpack »

And again I notice that the icon buttons on the left and the text along the bottom is oriented correctly. Only the "CAD" window has the problem, so the problem seems to be restricted to app windows that are rendered using OpenGL or Direct3D directly.

Btw, do you happen to know which one this app is? (OpenGL or Direct3D)? There may be an info panel of some kind that tells you.
mrmartin
Posts: 6
Joined: 3. Feb 2021, 15:58
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: various MS and Linux

Re: OpenGL upside down?

Post by mrmartin »

so the problem seems to be restricted to app windows that are rendered using OpenGL
Yes, its just the 3D rendering. Constructing, editing and manipulating the 3D-wireframe model itself is no problem at all.
Btw, do you happen to know which one this app is? (OpenGL or Direct3D)?
The CAD-application uses OpenGL, here are the informations about the rendering engine from inside the running CAD program:

Code: Select all

REDSDKINFO
RedSDK version: 4.3 (build 4)
RenderUsingHardware: Hybrid hardware/software mode with preferred hardware rendering.
OpenGL window creation succeeded.
Operating system: Win_seven64
Local GPU:
    GPU information:
        name:     'Virtual Box Graphics Adapter'
        chipset:  'NONE'
        class:    'HW_VIRTUAL_GENERIC'
        asicID:   '0xbeef'
        vendorID: '0x80ee'
        recommended driver: 'Virtual software driver'
    Installed driver:
        driver:      'Virtual software driver'
        dll version: ''
        validation: 'You are using a virtual machine. Please switch to software rendering.'
        Installed driver is up-to-date.
Selected GPU (created for GPU check):
    Chipset: HW_ATI_R800
    Vendor: VMware, Inc. ( IsATI )
    OpenGL version: 2.1 Mesa mesa-17.3.9
    Renderer: SVGA3D; build: RELEASE;  
    OpenGL extensions: GL_ARB_multisample GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_copy_texture GL_EXT_polygon_offset GL_EXT_subtexture GL_EXT_texture_object GL_EXT_vertex_array GL_EXT_compiled_vertex_array GL_EXT_texture GL_EXT_texture3D GL_IBM_rasterpos_clip GL_ARB_point_parameters GL_EXT_draw_range_elements GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_separate_specular_color GL_EXT_texture_edge_clamp GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_ARB_framebuffer_sRGB GL_ARB_multitexture GL_EXT_framebuffer_sRGB GL_IBM_multimode_draw_arrays GL_IBM_texture_mirrored_repeat GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_transpose_matrix GL_EXT_blend_func_separate GL_EXT_fog_coord GL_EXT_multi_draw_arrays GL_EXT_secondary_color GL_EXT_texture_env_add GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias GL_INGR_blend_func_separate GL_NV_blend_square GL_NV_light_max_exponent GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_S3_s3tc GL_SUN_multi_draw_arrays GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_EXT_framebuffer_object GL_EXT_texture_compression_s3tc GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_MESA_window_pos GL_NV_packed_depth_stencil GL_NV_texture_rectangle GL_ARB_depth_texture GL_ARB_occlusion_query GL_ARB_shadow GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_window_pos GL_ATI_fragment_shader GL_EXT_stencil_two_side GL_EXT_texture_cube_map GL_NV_fog_distance GL_APPLE_packed_pixels GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_shader_objects GL_ARB_vertex_program GL_ARB_vertex_shader GL_ATI_draw_buffers GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_MESA_pack_invert GL_MESA_ycbcr_texture GL_NV_primitive_restart GL_ARB_fragment_program_shadow GL_ARB_half_float_pixel GL_ARB_occlusion_query2 GL_ARB_point_sprite GL_ARB_shading_language_100 GL_ARB_sync GL_ARB_texture_non_power_of_two GL_ARB_vertex_buffer_object GL_ATI_blend_equation_separate GL_EXT_blend_equation_separate GL_OES_read_format GL_ARB_color_buffer_float GL_ARB_pixel_buffer_object GL_ARB_texture_float GL_ARB_texture_rectangle GL_EXT_pixel_buffer_object GL_EXT_texture_compression_dxt1 GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_ARB_framebuffer_object GL_EXT_framebuffer_blit GL_EXT_packed_depth_stencil GL_ARB_vertex_array_object GL_ATI_separate_stencil GL_EXT_gpu_program_parameters GL_EXT_texture_sRGB_decode GL_OES_EGL_image GL_ARB_copy_buffer GL_ARB_half_float_vertex GL_ARB_map_buffer_range GL_ARB_texture_swizzle GL_ARB_vertex_array_bgra GL_EXT_texture_swizzle GL_EXT_vertex_array_bgra GL_ARB_ES2_compatibility GL_ARB_debug_output GL_ARB_draw_elements_base_vertex GL_ARB_explicit_attrib_location GL_ARB_fragment_coord_conventions GL_ARB_provoking_vertex GL_ARB_sampler_objects GL_ARB_shader_texture_lod GL_EXT_provoking_vertex GL_EXT_texture_snorm GL_MESA_texture_signed_rgba GL_ARB_get_program_binary GL_ARB_robustness GL_ARB_separate_shader_objects GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_ARB_compressed_texture_pixel_storage GL_ARB_internalformat_query GL_ARB_map_buffer_alignment GL_ARB_texture_storage GL_AMD_shader_trinary_minmax GL_ARB_clear_buffer_object GL_ARB_explicit_uniform_location GL_ARB_invalidate_subdata GL_ARB_program_interface_query GL_ARB_vertex_attrib_binding GL_KHR_debug GL_ARB_internalformat_query2 GL_ARB_multi_bind GL_ARB_clip_control GL_ARB_get_texture_sub_image GL_KHR_context_flush_control GL_KHR_no_error GL_ARB_texture_filter_anisotropic 
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: OpenGL upside down?

Post by mpack »

Perhaps you would be willing to do one final confirmation test, the relevance will be explained in the next paragraph. This here is a download link to a piece of software of my own. It consists of an application "glTest.exe" that you should install in a folder somewhere inside the Windows guest, and a version of the famous "Stanford Bunny" 3D model, in OBJ form. To get glTest to open the OBJ file you need to right click the OBJ file, choose "Open with", then "Choose another app", then scroll to the bottom of the suggestions list and select "Choose another app on this PC", then navigate to wherever you put "glTest.exe". Wording may be slightly different on different Windows versions and languages.

glTest is a 3D model viewer that I wrote myself, so I know exactly what it does. It can display 3D model files such as those in OBJ, STL or FBX format: it does not support textures, my main app doesn't need them. You can zoom in/out with the mouse scroll wheel, rotate by dragging mouse, double right click to reset view. This is a basic OpenGL v2 3D viewer, nothing fancy, so is known to work just fine inside a VirtualBox VM with all relevant drivers enabled and installed. Be careful about which 3D models you try: American gamers coordinate system has y-z axes flipped with respect to the standard CAD convention that my main app uses. The provided bunny uses CAD convention.

So my question: does this display the bunny upside down? Ok, the diagnosis is pretty straightforward if it does. But, I'm thinking that maybe it will not. Perhaps indicating that the problem only arises if the app creates the view as an image, and then renders the image to a rectangle as a texture - this technique may be rare enough to account for why so few people have reporting this problem. I'm thinking that the standard Windows upside down BMP format has something to do with this, or perhaps the guest app is assuming that the driver will recognize extensions to the BMP convention that allow top down BMPS.
preslmayer
Posts: 5
Joined: 1. May 2019, 12:21
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows 10; Windows 7; Linux Ubuntu; Linux Mint; Linux CentOs

Re: OpenGL upside down?

Post by preslmayer »

mpack wrote: This here is a download link to a piece of software of my own. It consists of an application "glTest.exe" that you should install in a folder somewhere inside the Windows guest, and a version of the famous "Stanford Bunny" 3D model, in OBJ form. To get glTest to open the OBJ file you need to right click the OBJ file, choose "Open with", then "Choose another app", then scroll to the bottom of the suggestions list and select "Choose another app on this PC", then navigate to wherever you put "glTest.exe".
Your "glTest.exe" is working for me correctly.

But you can find in comment 7 on Ticket: https://www.virtualbox.org/ticket/19237 a simple Qt qml program which displays an image with text. This text will be shown upside down.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: OpenGL upside down?

Post by mpack »

If "correctly" means right way up then it looks like my guess is good.
preslmayer wrote: But you can find in comment 7 on Ticket: https://www.virtualbox.org/ticket/19237 a simple Qt qml program which displays an image with text. This text will be shown upside down.
The important component, I believe, is not what kind of content is being rendered, but is whether that content is being rendered as a texture using a Windows DIB. My GLTest app is not using textures. Text was mentioned before only because it was obvious that this problem did not affect the entire guest desktop, only specific windows.

My GLTest is doing double buffering, so that alone is not enough to trigger the problem. My current theory is that, for some reason, these apps are rendering to a texture bitmap and then blitting the texture to the display. They may be using an OpenGL extension (unofficial?) that accepts Windows BMPs in the texture creation API (i.e. using GL_BGR_EXT and GL_GBRA_EXT in the call to glTextImage2D). On Windows hosts this is working, on Linux hosts it is not, or not completely. I suspect that the B,G,R color order is being handled, but the upside down nature is not.

p.s. I just tried the "simple Qt app" with a Win10 guest on a Win10 host. The text displays right way up on the host, upside down in the guest. I'm not sure that really tells me anything since I don't know what assumptions this app is making, or what APIs it calls. We have established that output from the Windows guest is not always upside down.
mrmartin
Posts: 6
Joined: 3. Feb 2021, 15:58
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: various MS and Linux

Re: OpenGL upside down?

Post by mrmartin »

Sorry for not answering that long.
For me too, the bunny is displayed correctly and can be moved and turned as usual.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: OpenGL upside down?

Post by mpack »

mpack wrote: p.s. I just tried the "simple Qt app" with a Win10 guest on a Win10 host. The text displays right way up on the host, upside down in the guest.
My own test with the Qt app demonstrated that the problem occurs on Windows hosts too, at which point I lost enthusiasm for the investigation as I believe we must be missing data.

We now know for certain that the problem is not confined to Linux hosts, which eliminates potentially buggy Linux host graphics drivers from consideration.

We know that some OpenGL apps can render correctly, and texture display doesn't seem to be an issue either, so it now seems unlikely to be an OpenGL problem.

I can't think of any way for this to be a VirtualBox problem. VirtualBox gets a bunch of pixels from the guest, it displays them. It gets OpenGL commands, it passes those to the host OpenGL API. VirtualBox behaviour would not differentiate between different guest windows, it simply isn't concerned with things at that level.

The test case that fails on my Windows host is in fact a Qt app, it does not use OpenGL directly. Are all the bad apps using Qt inside the guest? Or failing that, are they all using some further underlying renderer that Qt is also using? Is it a particular version of Qt?
htrex
Posts: 10
Joined: 4. Dec 2009, 14:32
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Vista, Win2000, W7

Re: OpenGL upside down?

Post by htrex »

mpack wrote:Are all the bad apps using Qt inside the guest? Or failing that, are they all using some further underlying renderer that Qt is also using? Is it a particular version of Qt?
Hi mpack and thanks for your investigation.
I'm seeing the issue on a Linux Host/Windows guest when using Adobe Photoshop and 3D acceleration is enabled both on Virtualbox and Photoshop settings.
There's no upside down issue when I turn off 3D acceleration inside Photoshop preferences with Virtualbox still configured with VBOXSVGA driver and 3D acceleration enabled.
In this case Photoshop is usable but runs slow for some features, notably when zooming or panning the image editing viewport.
AFAIK Photoshop doesn't use the Qt library, probably they rolled their own GUI framework, which uses too some kind of 3D acceleration feature that triggers the bug?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: OpenGL upside down?

Post by mpack »

At this point, speculation seems to be pointless. Bugs are always possible, but I can't see what VirtualBox bug could possibly yield this behaviour. We have an assertion that these apps that show the problem are written correctly, and that is my main doubt at this moment: because we have established now that the problem is restricted to particular applications, and pretty much nothing else.
mrmartin
Posts: 6
Joined: 3. Feb 2021, 15:58
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: various MS and Linux

Re: OpenGL upside down?

Post by mrmartin »

It seems that I have found part of the solution for our problem, at least for my specific case!
It's the observation of htrex
htrex wrote:There's no upside down issue when I turn off 3D acceleration inside Photoshop preferences with Virtualbox still configured with VBOXSVGA driver and 3D acceleration enabled.

that made me have a closer look to the settings menu of BricsCAD, and indeed, its possible there to choose between "OpenGL" and "RedOpenGL" for "3D Graphic System Device", see screenshot.
"RedOpenGL" seems to be a customised variant of OpenGL which ist used by RedSDK, the rendering engine used by BricsCAD.
With"RedOpenGL" enabled, which is the standard setting, I have the upside-down-problem as described, when I choose "OpenGL" instead, everything is displayed correctly!
Unfortunately, some of the visual rendering styles are available only with the "RedOpenGL" option, but that is sort of a luxury problem that BricsCAD will hopefully solve, as they chose to rely on RedSDK for rendering.
I will file a bug with them and keep you updated.
Still I find it bizarre that the problem only occurs in virtualized OS.
I hope you guys can use this information to find a cure for the other applications that suffer the problem.
Attachments
BricsCad_einstellung_openGL_copy.jpg
BricsCad_einstellung_openGL_copy.jpg (81.21 KiB) Viewed 9532 times
Post Reply