Crate glutin

source ·
Expand description

The purpose of this library is to provide an OpenGL context on as many platforms as possible.

Building a GlWindow

A GlWindow is composed of a Window and an OpenGL Context. Due to some operating-system-specific quirks, glutin requires control over the order of creation of the Context and Window. Here is an example of building a GlWindow:

let events_loop = glutin::EventsLoop::new();
let window = glutin::WindowBuilder::new()
    .with_title("Hello world!")
    .with_dimensions(1024, 768);
let context = glutin::ContextBuilder::new();
let gl_window = glutin::GlWindow::new(window, context, &events_loop).unwrap();

For contexts that are not associated with any particular window, see the HeadlessContext type.

Features

This crate has two Cargo features: window and headless.

  • window allows you to create regular windows and enables the WindowBuilder object.
  • headless allows you to do headless rendering, and enables the HeadlessRendererBuilder object.

By default only window is enabled.

Modules

  • Contains traits with platform-specific methods in them.

Structs

Enums

  • All APIs related to OpenGL that you can possibly get while using glutin.
  • Error that can happen when manipulating an OpenGL context.
  • Returned by the user callback given to the EventsLoop::run_forever method.
  • Error that can happen while creating a window or a headless renderer.
  • Describes how winit handles the cursor.
  • Represents raw hardware events that are not associated with any particular window.
  • Describes the input state of a key.
  • Describes a generic event.
  • Describes the requested OpenGL context profiles.
  • Describes the OpenGL API and version that are being requested when a context is created.
  • Describes a button of a mouse controller.
  • Describes the appearance of the mouse cursor.
  • Describes a difference in the mouse scroll wheel state.
  • The behavior of the driver when you change the current context.
  • Specifies the tolerance of the OpenGL context to faults. If you accept raw OpenGL commands and/or raw shader code from an untrusted source, you should definitely care about this.
  • Describes touch-screen input state.
  • Symbolic name for a keyboard key.
  • Error that can happen while creating a window or a headless renderer.
  • Describes an event from a Window.

Statics

  • The minimum core profile GL context. Useful for getting the minimum required GL version while still running on OSX, which often forbids the compatibility profile features.

Traits

  • A trait for types associated with a GL context.

Type Definitions

  • Identifier for a specific analog axis on some device.
  • Identifier for a specific button on some device.
  • Hardware-dependent keyboard scan code.