Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

Black window in part-2 with OpenGL backend and x11 #14

@ghost

Description

Hello,

I have encountered the following issue in part-2 of the tutorial:
A black window appears when I'm trying to run the program. There are no errors on the console, neither during compilation, nor during runtime.

Environment:
Linux OS with X11

Hardware:

OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) HD Graphics 5500 (BDW GT2)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.2.3
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6 (Compatibility Profile) Mesa 20.2.3
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 20.2.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 920M/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 418.113
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 418.113
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:

As I have no access to a Vulkan-capable hardware, I switched to the gl backend. Also, I have added the x11 feature to the Cargo.toml file as follows:

[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies.backend]
package = "gfx-backend-gl"
version = "=0.6.1"
features = ["x11"]

With both rendering devices mentioned above, I get a black window, no triangles are shown. The part-1 of the tutorial worked correctly.

I have also tried to upgrade all dependencies in Cargo.toml to the currently available most up-to-date versions. This didn't fix the issue, while part-1 of the tutorial still worked.

Note: after upgrading winit, let dpi = event_loop.primary_monitor().scale_factor(); has to be changed to something like let dpi = event_loop.primary_monitor().unwrap().scale_factor();, as the event_loop.primary_monitor() method now returns an Option.

Now, as I get no errors at all, I have absolutely no clue where to even start with debugging the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions