PistonDevelopers / PistonDevelopers/piston

thread panic: " `Err` value: "Couldn\'t find any pixel format that matches the criterias." "

Open
#1,234 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4.7k
Forks
235
Avg merge
1m
Merged PRs (30d)
4

Description

Hi Everyone,

I have been troubleshooting this issue for a while. I am aware of issue #1202 and have reviewed it thoroughly. It doesn't appear that I am experiencing the same problem.

TLDR: Window creation is failing on a simple hello_piston example. I've implemented a number of potential fixes but none have worked. Here are the details...

When I run RUST_BACKTRACE=1 cargo +nightly run on my program hello_piston, I get the following output:

Compiling hello_piston v0.1.0 (file:///home/nyghtly/Documents/proj/rust/hello_piston)
    Finished dev [unoptimized + debuginfo] target(s) in 28.10s
     Running `target/debug/hello_piston`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "GL context creation failed"', libcore/result.rs:945:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:475
   5: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   6: rust_begin_unwind
             at libstd/panicking.rs:325
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   8: core::result::unwrap_failed
             at /checkout/src/libcore/macros.rs:26
   9: <core::result::Result<T, E>>::unwrap
             at /checkout/src/libcore/result.rs:782
  10: hello_piston::main
             at src/main.rs:9
  11: std::rt::lang_start::{{closure}}
             at /checkout/src/libstd/rt.rs:74
  12: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  13: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:106
  14: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  15: std::rt::lang_start
             at /checkout/src/libstd/rt.rs:74
  16: main
  17: __libc_start_main
  18: _start

Here is the code for hello_piston:

extern crate piston_window;

use piston_window::*;

fn main() {
    let mut window: PistonWindow = PistonWindow::new(
    OpenGL::V2_1,
    0,
    WindowSettings::new("Hello World!", [640, 480])
        .opengl(OpenGL::V2_1)
        .srgb(false)
        .build()
        .unwrap(),
    );
    while let Some(event) = window.next() {
        window.draw_2d(&event, |context, graphics| {
            clear([1.0; 4], graphics);
            rectangle([1.0, 0.0, 0.0, 1.0], // red
                      [0.0, 0.0, 100.0, 100.0],
                      context.transform,
                      graphics);
        });
    }
}

Here is my system info (from command inxi -CGS):

System:
  Host: ______ Kernel: 4.14.57-1-MANJARO x86_64 bits: 64 Desktop: N/A 
  Distro: Manjaro Linux 
CPU:
  Topology: Dual Core model: Intel Atom N550 bits: 64 type: MT MCP 
  L2 cache: 512 KiB 
  Speed: 998 MHz min/max: 1000/1500 MHz Core speeds (MHz): 1: 997 2: 998 
  3: 997 4: 998 
Graphics:
  Card-1: Intel Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics 
  driver: i915 v: kernel 
  Display: x11 server: N/A driver: intel unloaded: modesetting 
  resolution: <xdpyinfo missing> 
  OpenGL: renderer: Mesa DRI Intel Pineview M v: 2.1 Mesa 18.1.4

Note: OpenGL on my system was initially set to 1.4. This is the default behavior of the contemporary mesa drivers, because it improves performance of some modern applications such as Chromium. I have edited my drirc configuration in order to enable the 2.1 extension that is possible with my gpu. I have tested this fix by running openra (Open Red Alert). Before the fix it didn't run--after the fix it did.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the hello_piston example with RUST_BACKTRACE=1 cargo +nightly run and inspect the PistonWindow creation at src/main.rs:9. Compare the failure with issue #1202 and the reported Manjaro, Mesa, and OpenGL 2.1 environment; done means the example creates its window without the pixel-format or GL-context panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.