#windowing #opengl


Cross-platform OpenGL context provider

101 releases

✓ Uses Rust 2018 edition

0.22.0-alpha5 Nov 15, 2019
0.22.0-alpha3 Aug 16, 2019
0.22.0-alpha1 Jun 21, 2019
0.20.0 Mar 10, 2019
0.0.1 Nov 12, 2014

#7 in Graphics APIs

Download history 7643/week @ 2019-08-16 8142/week @ 2019-08-23 8575/week @ 2019-08-30 8911/week @ 2019-09-06 7613/week @ 2019-09-13 9211/week @ 2019-09-20 8687/week @ 2019-09-27 8948/week @ 2019-10-04 7029/week @ 2019-10-11 7616/week @ 2019-10-18 8577/week @ 2019-10-25 7820/week @ 2019-11-01 7253/week @ 2019-11-08 7993/week @ 2019-11-15 7028/week @ 2019-11-22

34,512 downloads per month
Used in 237 crates (92 directly)



glutin - OpenGL, UTilities and INput

A low-level library for OpenGL context creation, written in pure Rust.

Docs.rs Build Status Build status

glutin = "0.22.0-alpha4"


0.21.0 Migration guide

Contact Us

Join us in any of these:

Freenode Matrix Gitter

Usage Examples

Warning: these are examples for master. For the latest released version, 0.21, view here.

Try it!

git clone https://github.com/rust-windowing/glutin
cd glutin
cargo run --example window


Glutin is an OpenGL context creation library and doesn't directly provide OpenGL bindings for you.

For examples, please look here.

Note that glutin aims at being a low-level brick in your rendering infrastructure. You are encouraged to write another layer of abstraction between glutin and your application.

Glutin is only officially supported on the latest stable version of the Rust compiler.

Platform-specific notes


To compile the examples for android, you have to use the cargo apk utility.

See the android-rs-glue repository for instructions.

Emscripten with asmjs

In order to use glutin with emscripten, start by compiling your code with --target=asmjs-unknown-emscripten.

Then create an HTML document that contains this:

<canvas id="canvas"></canvas>
<script type="text/javascript">
var Module = {
    canvas: document.getElementById('canvas')
<script type="text/javascript" src="target/asmjs-unknown-emscripten/debug/..." async></script>

Note: adjust the src element of the script to point to the .js file that was produced by the compilation.

The Module object is the link between emscripten and the HTML page. See also this documentation.


The plan is that glutin tries to dynamically link-to and use wayland if possible. If it doesn't work, it will try xlib instead. This is work-in-progress.


Due to an issue with how mesa and Wayland play together, all shared contexts must use the same events pool as each other.

Common issues

Help! I'm receiving NoAvailablePixelFormat!


~50K SLoC