Skip to content

examples refuse to compile (outdated?) #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bluecereal opened this issue Apr 4, 2016 · 12 comments
Closed

examples refuse to compile (outdated?) #336

bluecereal opened this issue Apr 4, 2016 · 12 comments

Comments

@bluecereal
Copy link

attempting to cargo run the examples gives the error: thread '< main >' panicked at 'called Result::unwrap() on an Err value: "Couldn't find any pixel format that matches the criterias.

i used cargo run --bin 'example_name'. code was cloned via git, so typos aren't the issue. what did i do wrong? are the examples out of date?

@mitchmindtree
Copy link
Contributor

Just thought I'd mention we're getting the same issue in conrod's examples.

@bvssvni
Copy link
Member

bvssvni commented Apr 6, 2016

This could be an issue with sRGB.

@bluecereal Do you have any info about the platform and graphics hardware you're using?

@bluecereal
Copy link
Author

CPU: AMD FX8350
GPU: R9 290x
RAM: 8GB DDR3
OS: Ubuntu 14.04
I recall setting sRGB to false and still getting the same error.

@bvssvni
Copy link
Member

bvssvni commented Apr 8, 2016

Does the "user_input" or "freetype" example works for you?

The piston_window overrides sRGB to true, because it uses gfx_graphics. The "user_input" and "freetype" example uses opengl_graphics. The opengl_graphics also enabled sRGB at the moment, but you might get an different error.

@ghost
Copy link

ghost commented Apr 8, 2016

Could this be a result of rust-windowing/glutin#748 ? Basically glutin requires a GLX_ARB_framebuffer_sRGB or else it will fail to create a context if sRGB was requested.

@bluecereal
Copy link
Author

I got a different error when trying to compile user_input and freetype.

note: /usr/bin/ld: cannot find -lSDL2
/usr/bin/ld: cannot find -lSDL2
collect2: error: ld returned 1 exit status

@bluecereal
Copy link
Author

after installing SDL i get a different error when running freetype or user_input

thread '

' panicked at 'called Result::unwrap() on an Err value: "SDL error: Could not create GL context"', ../src/libcore/result.rs:688

the examples in the src directory give the same errors theyve given previously

pierrechevalier83 added a commit to pierrechevalier83/piston-examples that referenced this issue Apr 13, 2016
@pierrechevalier83
Copy link

The original reported issue: "Couldn't find any pixel format that matches the criterias." is fixed with commit 9df6017.

I can't reproduce the issue with user_input and free_type locally.

@panicbit panicbit assigned panicbit and unassigned panicbit Apr 29, 2016
@cooperra
Copy link
Contributor

I built this project today and everything worked.

@nicholasguyett
Copy link

I'm experiencing the same issues. Running from ubuntu (bash on windows) via X server.

After seeing the second comment in this issue, I tried running the examples for conrod and got the same exact error.

@bluecereal
Copy link
Author

bluecereal commented Jan 21, 2017

This pertains only to the "Couldn't find any pixel format that matches the criterias." error. I believe the other errors were caused by dependencies I was missing on my Windows machine.
If I remember correctly, disabling srgb did nothing unless it was done through a WindowSettings for some reason (as opposed to the normal PistonWindow::new() builder pattern), which is basically what the code below does.
Although, I have been out of the Piston loop for a while now, so this code may be outdated. This issue was caused by something to do with gfx (i think?). kvark takes good care of that crate, all the more reason to assume this is a non-issue.

@nicholasguyett maybe this will help :)

    let mut window: PistonWindow = {
        let title = "Hello, World!";
        let resolution = [640, 640];
        let opengl = OpenGL::V3_2;
        let mut window_result = WindowSettings::new(title, resolution)
            .exit_on_esc(true)
            .srgb(true)                      //try to init windowbuilder with srgb enabled
            .opengl(opengl)
            .build();
        if window_result.is_err() {   //if srgb=true fails, retry as srgb=false
            window_result = WindowSettings::new(title, resolution)
                .exit_on_esc(true)
                .srgb(false)                 //!!!
                .opengl(opengl)
                .build();
        }
        PistonWindow::new(opengl, 0, window_result
            .unwrap_or_else(|e| {
                panic!("Failed to build PistonWindow: {}", e)
            }))
    };```

Closed unless suggested otherwise.  

@spiveeworks
Copy link

weird that the default behaviour of the "convenience wrapper" is to crash when forced settings can't be applied, but thanks for the solution/workaround!

spiveeworks added a commit to spiveeworks/circle-collision-demo that referenced this issue Nov 30, 2017
took the fix from PistonDevelopers/piston-examples#336
not sure why this isn't default behaviour
now for the runtime errors :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants