turnage / valora

painting by functions
https://paytonturnage.gitbook.io/valora/
MIT License
721 stars 30 forks source link

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: GlutinCreationError(CreationErrors([NoAvailablePixelFormat, NoAvailablePixelFormat]))', #47

Open epilys opened 4 years ago

epilys commented 4 years ago

Debian 10. Running the code from the first page of the gitbook:

use valora::prelude::*;

fn main() -> Result<()> {
    run_fn(Options::from_args(), |_gpu, world, _rng| {
        Ok(move |ctx: Context, canvas: &mut Canvas| {
            canvas.set_color(LinSrgb::new(1., 1., 1.));
            canvas.paint(Filled(ctx.world));

            let max_radius = world.width / 3.;
            let radius = ctx.time.as_secs_f32().cos().abs() * max_radius;

            canvas.set_color(LinSrgb::new(1., 0., 0.));
            canvas.paint(Filled(Ellipse::circle(world.center(), radius)));
        })
    })
}
   Compiling khronos_api v3.1.0
   Compiling gl_generator v0.13.1
   Compiling gl_generator v0.11.0
   Compiling glutin_egl_sys v0.1.4
   Compiling glutin_glx_sys v0.1.6
   Compiling glium v0.25.1
   Compiling glutin v0.21.2
   Compiling valora v0.2.9
   Compiling valora v0.1.0 (~/Documents/valora)
    Finished dev [unoptimized + debuginfo] target(s) in 27.95s
     Running `target/debug/valora`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: GlutinCreationError(CreationErrors([NoAvailablePixelFormat, NoAvailablePixelFormat]))', src/libcore/result.rs:1188:5
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:84
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1025
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:193
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:471
  11: rust_begin_unwind
             at src/libstd/panicking.rs:375
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:84
  13: core::result::unwrap_failed
             at src/libcore/result.rs:1188
  14: core::result::Result<T,E>::unwrap
             at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libcore/result.rs:956
  15: valora::gpu::Gpu::with_window
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/valora-0.2.9/src/gpu.rs:190
  16: valora::run_fn
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/valora-0.2.9/src/lib.rs:233
  17: valora::main
             at src/main.rs:4
  18: std::rt::lang_start::{{closure}}
             at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
  19: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  20: std::panicking::try::do_call
             at src/libstd/panicking.rs:292
  21: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
  22: std::panicking::try
             at src/libstd/panicking.rs:270
  23: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  24: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  25: std::rt::lang_start
             at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
  26: main
  27: __libc_start_main
  28: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
turnage commented 4 years ago

That may have to do with multisampling.

I believe I saw that before installing drivers for my card. Multisampling should probably be a CLI option.

epilys commented 4 years ago

I changed with_multisampling to 0, and I got

Error: CompilationError("0:1(10): error: GLSL 4.00 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, and 3.00 ES\n")

   0: failure::backtrace::internal::InternalBacktrace::new
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.7/src/backtrace/internal.rs:46
   1: failure::backtrace::Backtrace::new
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.7/src/backtrace/mod.rs:121
   2: <failure::error::error_impl::ErrorImpl as core::convert::From<F>>::from
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.7/src/error/error_impl.rs:19
   3: <failure::error::Error as core::convert::From<F>>::from
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.7/src/error/mod.rs:36
   4: valora::gpu::Gpu::with_window
             at /tmp/valora/src/gpu.rs:195

So my laptop being old is the trigger:

% glxinfo|grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile
OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.3.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 18.3.6
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.3.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions: