Crate glutin[][src]

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(glutin::dpi::LogicalSize::new(1024.0, 768.0));
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.

By default only window is enabled.

Re-exports

extern crate std;
extern crate shared_library;
extern crate libc;
extern crate winit;
extern crate x11_dl;
extern crate wayland_client;
use std::prelude::v1::*;
use std::io;

Modules

api
dpi

DPI is important, so read the docs for this module if you don't want to be confused.

headless
os

Contains traits with platform-specific methods in them.

platform

Structs

AvailableMonitorsIter

An iterator for the list of available monitors.

Context

Represents an OpenGL context.

ContextBuilder

Object that allows you to build Contexts.

DeviceId

Identifier of an input device.

EventsLoop

Provides a way to retrieve events from the system and from the windows that were registered to the events loop.

EventsLoopClosed

The error that is returned when an EventsLoopProxy attempts to wake up an EventsLoop that no longer exists.

EventsLoopProxy

Used to wake up the EventsLoop from another thread.

GlAttributes

Attributes to use when creating an OpenGL context.

GlWindow

Represents an OpenGL context and a Window with which it is associated.

HeadlessContext

Represents a headless OpenGL context.

HeadlessRendererBuilder

Object that allows you to build headless contexts.

Icon

An icon used for the window titlebar, taskbar, etc.

KeyboardInput

Describes a keyboard input event.

ModifiersState

Represents the current state of the keyboard modifiers

MonitorId

Identifier for a monitor.

PixelFormat

Describes a possible format. Unused.

PixelFormatRequirements

Describes how the backend should choose a pixel format.

Touch

Represents touch event

Window

Represents a window.

WindowAttributes

Attributes to use when creating a window.

WindowBuilder

Object that allows you to build windows.

WindowId

Identifier of a window. Unique for each window.

Enums

Api

All APIs related to OpenGL that you can possibly get while using glutin.

ContextError

Error that can happen when manipulating an OpenGL context.

ControlFlow

Returned by the user callback given to the EventsLoop::run_forever method.

CreationError

Error that can happen while creating a window or a headless renderer.

DeviceEvent

Represents raw hardware events that are not associated with any particular window.

ElementState

Describes the input state of a key.

Event

Describes a generic event.

GlProfile

Describes the requested OpenGL context profiles.

GlRequest

Describes the OpenGL API and version that are being requested when a context is created.

MouseButton

Describes a button of a mouse controller.

MouseCursor

Describes the appearance of the mouse cursor.

MouseScrollDelta

Describes a difference in the mouse scroll wheel state.

ReleaseBehavior

The behavior of the driver when you change the current context.

Robustness

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.

TouchPhase

Describes touch-screen input state.

VirtualKeyCode

Symbolic name for a keyboard key.

WindowCreationError

Error that can happen while creating a window or a headless renderer.

WindowEvent

Describes an event from a Window.

Statics

GL_CORE

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

GlContext

A trait for types associated with a GL context.

Type Definitions

AxisId

Identifier for a specific analog axis on some device.

ButtonId

Identifier for a specific button on some device.

ScanCode

Hardware-dependent keyboard scan code.