Skip to content

Instantly share code, notes, and snippets.

@icefoxen
Created February 21, 2017 21:03
Show Gist options
  • Save icefoxen/b6070eb560f774a17ac9e54c408c55ac to your computer and use it in GitHub Desktop.
Save icefoxen/b6070eb560f774a17ac9e54c408c55ac to your computer and use it in GitHub Desktop.
fn test_opengl_versions(video: &sdl2::VideoSubsystem) {
let major_versions = [3u8, 2u8, 1u8];
let minor_versions = [3u8, 2u8, 1u8, 0u8];
for major in &major_versions {
for minor in &minor_versions {
let gl = video.gl_attr();
gl.set_context_version(*major, *minor);
// gl.set_context_profile(sdl2::video::GLProfile::Core);
print!("Requesting GL {}.{}... ", major, minor);
let window_builder = video.window("so full of hate", 640, 480);
let result = gfx_window_sdl::init::<ColorFormat, DepthFormat>(window_builder);
match result {
Ok(_) => {
println!("Ok, got GL {}.{}.",
gl.context_major_version(),
gl.context_minor_version())
}
Err(res) => println!("Request failed: {:?}", res),
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment