brendanzab / gl-rs

An OpenGL function pointer loader for Rust
Apache License 2.0
682 stars 114 forks source link

gl/examples/triangle crashes on startup #413

Open ldanko opened 7 years ago

ldanko commented 7 years ago

triangle example crashes on startup when running on Fedora 25 / VirtualBox:

$ RUST_BACKTRACE=1 target/debug/examples/triangle
OpenGL Warning: glXChooseVisual: ignoring attribute 0x22
thread 'main' panicked at 'gl function was not loaded', /home/ldanko/test/gl-rs/gl/target/debug/build/gl-46b3c139498e968e/out/bindings.rs:20591
stack backtrace:
   1:     0x5605c3ed6abc - std::sys::imp::backtrace::tracing::imp::write::h9c41d2f69e5caabf
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2:     0x5605c3ed90fe - std::panicking::default_hook::{{closure}}::h1f61f3c769fffe7a
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:351
   3:     0x5605c3ed8d04 - std::panicking::default_hook::hd5bda4e453dfb4be
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:367
   4:     0x5605c3ed9547 - std::panicking::rust_panic_with_hook::hffbc74969c7b5d87
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:555
   5:     0x5605c3d49243 - std::panicking::begin_panic::h0a82ee08bc6f08bc
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:517
   6:     0x5605c3d49a62 - gl::missing_fn_panic::h3a143f7dc64a4aa9
                        at /home/ldanko/test/gl-rs/gl/src/lib.rs:79
   7:     0x5605c3d0e8af - gl::GenVertexArrays::hf5f15a9b71967a94
                        at /home/ldanko/test/gl-rs/gl/target/debug/build/gl-46b3c139498e968e/out/bindings.rs:2135
   8:     0x5605c3d40821 - triangle::main::h6a80dc956134f691
                        at /home/ldanko/test/gl-rs/gl/examples/triangle.rs:113
   9:     0x5605c3ee040a - __rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
  10:     0x5605c3ed9ca6 - std::rt::lang_start::ha0568cc91d8c5b09
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:436
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panic.rs:361
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/rt.rs:57
  11:     0x5605c3d49162 - main
  12:     0x7fccc1284400 - __libc_start_main
  13:     0x5605c3d05129 - _start
  14:                0x0 - <unknown>
tomaka commented 7 years ago

VirtualBox has crappy OpenGL support and doesn't support OpenGL 2.1 which is required for the example to run.

Any real code should check the OpenGL version that was actually obtained before proceeding.

ldanko commented 7 years ago

I can't run any OpenGL rust application. It seems that OpenGL 2.1 is supported in VirtualBox, glxinfo says: OpenGL version string: 2.1 Chromium 1.9 But as you said maybe something is broken in VirtualBox

neokril commented 7 years ago

I have the same error on Windows 8.1 x64 host, Lubuntu 16.10x64 guest. Virtualbox 5.1.12 glxgears work OK with 236 FPS. Not sure that VBox have the issue with OpenGL.

The only workaround I found so far is to disable "3D Acceleration" in VM Settings->Display