PistonDevelopers / conrod

An easy-to-use, 2D GUI library written entirely in Rust.
Other
3.35k stars 297 forks source link

GlutinCreationError(NoAvailablePixelFormat) on virtual win7 #1031

Open bitbegin opened 7 years ago

bitbegin commented 7 years ago

error log:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: GlutinCreationError(NoAvailablePixelFo
mat)', src\libcore\result.rs:860                                                                              
stack backtrace:                                                                                              
   0: std::panicking::default_hook::{{closure}}                                                               
             at C:\projects\rust\src\libstd\panicking.rs:354                                                  
   1: std::panicking::default_hook                                                                            
             at C:\projects\rust\src\libstd\panicking.rs:371                                                  
   2: std::panicking::rust_panic_with_hook                                                                    
             at C:\projects\rust\src\libstd\panicking.rs:549                                                  
   3: std::panicking::begin_panic<alloc::string::String>                                                      
             at C:\projects\rust\src\libstd\panicking.rs:511                                                  
   4: std::panicking::begin_panic_fmt                                                                         
             at C:\projects\rust\src\libstd\panicking.rs:495                                                  
   5: std::panicking::rust_begin_panic                                                                        
             at C:\projects\rust\src\libstd\panicking.rs:471                                                  
   6: core::panicking::panic_fmt                                                                              
             at C:\projects\rust\src\libcore\panicking.rs:69                                                  
   7: core::result::unwrap_failed<glium::backend::glutin::DisplayCreationError>                               
             at C:\projects\rust\src\libcore\macros.rs:29                                                     
   8: core::result::Result<glium::backend::glutin::Display, glium::backend::glutin::DisplayCreationError>::unw
ap<glium::backend::glutin::Display,glium::backend::glutin::DisplayCreationError>                              
             at C:\projects\rust\src\libcore\result.rs:738                                                    
   9: counter::feature::main                                                                                  
             at .\examples\counter.rs:29                                                                      
  10: counter::main                                                                                           
             at .\examples\counter.rs:6                                                                       
  11: panic_unwind::__rust_maybe_catch_panic                                                                  
             at C:\projects\rust\src\libpanic_unwind\lib.rs:98                                                
  12: std::rt::lang_start                                                                                     
             at C:\projects\rust\src\libstd\rt.rs:52                                                          
  13: main                                                                                                    
  14: __scrt_common_main_seh                                                                                  
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253                                    
  15: BaseThreadInitThunk                                                                                     
  16: RtlInitializeExceptionChain                                                                             
error: process didn't exit successfully: `target\debug\examples\counter.exe` (exit code: 101)                 

another error log:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Couldn\'t find any pixel format that matches the criterias."', src\libcore\result.rs:860
stack backtrace:
   0: std::panicking::default_hook::{{closure}}
             at C:\projects\rust\src\libstd\panicking.rs:354
   1: std::panicking::default_hook
             at C:\projects\rust\src\libstd\panicking.rs:371
   2: std::panicking::rust_panic_with_hook
             at C:\projects\rust\src\libstd\panicking.rs:549
   3: std::panicking::begin_panic<alloc::string::String>
             at C:\projects\rust\src\libstd\panicking.rs:511
   4: std::panicking::begin_panic_fmt
             at C:\projects\rust\src\libstd\panicking.rs:495
   5: std::panicking::rust_begin_panic
             at C:\projects\rust\src\libstd\panicking.rs:471
   6: core::panicking::panic_fmt
             at C:\projects\rust\src\libcore\panicking.rs:69
   7: core::result::unwrap_failed<alloc::string::String>
             at C:\projects\rust\src\libcore\macros.rs:29
   8: core::result::Result<piston_window::PistonWindow<glutin_window::GlutinWindow>, alloc::string::String>::unwrap<piston_window::PistonWindow<glutin_window::GlutinWindow>,alloc::string::String>
             at C:\projects\rust\src\libcore\result.rs:738
   9: all_piston_window::feature::main
             at .\examples\all_piston_window.rs:29
  10: all_piston_window::main
             at .\examples\all_piston_window.rs:7
  11: panic_unwind::__rust_maybe_catch_panic
             at C:\projects\rust\src\libpanic_unwind\lib.rs:98
  12: std::rt::lang_start
             at C:\projects\rust\src\libstd\rt.rs:52
  13: main
  14: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
  15: BaseThreadInitThunk
  16: RtlInitializeExceptionChain
error: process didn't exit successfully: `target\debug\examples\all_piston_window.exe` (exit code: 101)
mitchmindtree commented 7 years ago

@bitbegin does #1032 fix this for you?

By "virtual win7" do you mean an instance of windows 7 run in a virtual machine like VirtualBox? Are you sure that your VM supports OpenGL?

bitbegin commented 7 years ago

how do i know it has installed OpenGL?

this crate only support OpenGL backend?

daboross commented 7 years ago

@bitbegin could you try removing the with_multisampling line in the window creation in example you're running - or try the newly updated example after #1032 was merged?

I think this is/was the same issue as https://github.com/PistonDevelopers/conrod/issues/1018.

bitbegin commented 7 years ago

@daboross i will test it tomorrow

mitchmindtree commented 7 years ago

@bitbegin conrod can be used with any kind of graphical backend, however it provides some helper functionality that reduces some of the boilerplate involved with a couple particular backends via cargo features. Most of the examples use the glium backend feature which is a pure-rust OpenGL library, which means they require OpenGL to be installed. One of the examples uses a piston backend (which happens to ouse OpenGL) and another uses gfx (though it's buggy and incomplete and also uses gfx's OpenGL backend).

bitbegin commented 7 years ago

removing the with_multisampling code or changing sample rate to 4 both not work.

My display driver is citrix.

The OpenGL version is 1.1.0 (1.20 for ext).

amk91 commented 6 years ago

I have the same error message running the command cargo run --release --feature "winit glium" --example text I'm using VMware Workstation 14 Player, Ubuntu Gnome 64 16.04 LTS, OpenGL version 3.0 Mesa 17.2.8. Here the backtrace

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: GlutinCreationError(NoAvailablePixelFormat)', 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:463
   5: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:350
   6: rust_begin_unwind
             at libstd/panicking.rs:328
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:71
   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: text::feature::main
             at examples/text.rs:34
  11: text::main
             at examples/text.rs:5
  12: std::rt::lang_start::{{closure}}
             at /checkout/src/libstd/rt.rs:74
  13: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  14: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  15: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:374
             at libstd/rt.rs:58
  16: std::rt::lang_start
             at /checkout/src/libstd/rt.rs:74
  17: main
  18: __libc_start_main
  19: _start

Commenting the line 33 of text.rs fixed the issue. Specifically .with_multisampling(4)

ZelphirKaltstahl commented 4 years ago

I am still having this problem in 2020:

$ RUST_BACKTRACE=full cargo run --release --example all_winit_glium
warning: use of deprecated item 'std::mem::uninitialized': use `mem::MaybeUninit` instead
   --> backends/conrod_glium/./src/lib.rs:112:5
    |
112 |     implement_vertex!(Vertex, position, tex_coords, color, mode);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default
    = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

warning: use of deprecated item 'std::mem::uninitialized': use `mem::MaybeUninit` instead
   --> backends/conrod_glium/./src/lib.rs:112:5
    |
112 |     implement_vertex!(Vertex, position, tex_coords, color, mode);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

    Finished release [optimized] target(s) in 0.21s
     Running `target/release/examples/all_winit_glium`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: GlutinCreationError(NoAvailablePixelFormat)', src/libcore/result.rs:1188:5
stack backtrace:
   0:     0x5605cd7bb674 - backtrace::backtrace::libunwind::trace::heb43798aede8bd30
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x5605cd7bb674 - backtrace::backtrace::trace_unsynchronized::had2ba7dec4bd2732
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x5605cd7bb674 - std::sys_common::backtrace::_print_fmt::hda61f46e822731b2
                               at src/libstd/sys_common/backtrace.rs:84
   3:     0x5605cd7bb674 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfe37fa5de6572965
                               at src/libstd/sys_common/backtrace.rs:61
   4:     0x5605cd7dd17c - core::fmt::write::h74887d18db27282c
                               at src/libcore/fmt/mod.rs:1025
   5:     0x5605cd7b8447 - std::io::Write::write_fmt::h6808f3d5eceed5e5
                               at src/libstd/io/mod.rs:1426
   6:     0x5605cd7bd7ae - std::sys_common::backtrace::_print::hcc0fd4b3552039ef
                               at src/libstd/sys_common/backtrace.rs:65
   7:     0x5605cd7bd7ae - std::sys_common::backtrace::print::h1c9c5c1c0505592d
                               at src/libstd/sys_common/backtrace.rs:50
   8:     0x5605cd7bd7ae - std::panicking::default_hook::{{closure}}::hefb6085c1ab83a59
                               at src/libstd/panicking.rs:193
   9:     0x5605cd7bd4a1 - std::panicking::default_hook::h1b037d2bf0657ab3
                               at src/libstd/panicking.rs:210
  10:     0x5605cd7bde8b - std::panicking::rust_panic_with_hook::h787d7f532b084b9a
                               at src/libstd/panicking.rs:471
  11:     0x5605cd7bda3e - rust_begin_unwind
                               at src/libstd/panicking.rs:375
  12:     0x5605cd7d936e - core::panicking::panic_fmt::h76b979c035808e69
                               at src/libcore/panicking.rs:84
  13:     0x5605cd7d9467 - core::result::unwrap_failed::hca6a012bfa3eb903
                               at src/libcore/result.rs:1188
  14:     0x5605cd4e21d2 - all_winit_glium::main::h70286f6d0dda8ae5
  15:     0x5605cd518b83 - std::rt::lang_start::{{closure}}::h90c52e718d7b71cf
  16:     0x5605cd7bd8d3 - std::rt::lang_start_internal::{{closure}}::h0760fb8bd9f1a4c7
                               at src/libstd/rt.rs:52
  17:     0x5605cd7bd8d3 - std::panicking::try::do_call::hccaa7cebf2335ab2
                               at src/libstd/panicking.rs:292
  18:     0x5605cd7c1c8a - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:78
  19:     0x5605cd7be3e0 - std::panicking::try::h3ce8e2e4440720f0
                               at src/libstd/panicking.rs:270
  20:     0x5605cd7be3e0 - std::panic::catch_unwind::h2a767bac361346af
                               at src/libstd/panic.rs:394
  21:     0x5605cd7be3e0 - std::rt::lang_start_internal::h14e7168ba039f170
                               at src/libstd/rt.rs:51
  22:     0x5605cd4e2742 - main
  23:     0x7f28f10d6830 - __libc_start_main
  24:     0x5605cd4d60a9 - _start
  25:                0x0 - <unknown>

Is the solution still to comment out some code? I do not even know which code it is running and where to look for with_multisampling in the example source code. Which example source code is run, when I do RUST_BACKTRACE=full cargo run --release --example all_winit_glium? text.rs does not appear in my backstrace.

EDIT 1: I was able to get the example to run, by grep-ing the whole examples source code and commenting out with_multisampling everywhere, where it was found in any .rs file. Not sure, why it is in the examples, if it is not working. OpenGL is installed, if that is part of the issue.

hypixus commented 4 years ago

I agree with @ZelphirKaltstahl here, multisampling seems to be not working properly on virtual machines. I'm on vmware hypervisor right now, running Linux Mint with full OpenGL Core 3.3 support yet this crate throws "GlutinCreationError(NoAvailablePixelFomat)". Problem is definetly elsewhere.