bwasty/learn-opengl-rs

Failed to watch for joystick connections

Closed this issue · 2 comments

I love the JoeyDeVries tutorials, they've helped me understand opengl - I've worked through them in C++ and ported some of them to Vala. So I was happy to see this port.

But when I try this code using cargo run 1_1_1 I get an error from glfw::init:

thread 'main' panicked at 'GLFW Error: Linux: Failed to watch for joystick connections in /dev/input: No such file or directory', /home/darkoverlordofdata/.cargo/registry/src/github.com-1ecc6299db9ec823/glfw-0.23.0/src/lib.rs:392:5

and then my desktop is messed up - I'm unable to close or open any application windows.
They still work - I opened my text editor first and was able to cust and paste the error. But I can't close the text editor, and when I type exit in the console, the window just becomes unresponsive. The only way I can find to clear it up is to reboot,

When I try the original, here: https://github.com/JoeyDeVries/LearnOpenGL/blob/master/src/1.getting_started/1.1.hello_window/hello_window.cpp, it works as expected.

I'm running rustc 1.38.0 (625451e37 2019-09-23) on Debian Buster.

I found there are 2 issues in 1.

  1. The original code calls glfwinit with no params. So I changed the rust code to this:

    let mut glfw = glfw::init(glfw::LOG_ERRORS).unwrap();

and the demo program no longer dies.

  1. Other application windows close events are trapped by rust; for example when I click on the close button for my text editor, this demo closes, but the text editor stays open. It seems to me that the event pump in the glfw wrapper is not filtering events to the current application, and captures events for all open applications.

I've been trying to decide between rust and dotnet core 3.0. I would say the decision is made - I'm looking for something that works, not something that frustrates me :) I think the rust ecosystem may not be mature enough for general use.

I found that if I build the project as

cargo run -j 1 1_3_2

Then the problems listed in issue #2 go away.
Apparently cargo or rustc enters a race condition on my machine, causeing some odd side effects.