Expand description
The purpose of this library is to provide an OpenGL Context on as many
platforms as possible.
§Building a WindowedContext<T>
A WindowedContext<T> is composed of a Window and an OpenGL
Context.
Due to some operating-system-specific quirks, glutin prefers control over
the order of creation of the Context and Window. Here is an example
of building a WindowedContext<T>:
let el = glutin::event_loop::EventLoop::new();
let wb = glutin::window::WindowBuilder::new()
.with_title("Hello world!")
.with_inner_size(glutin::dpi::LogicalSize::new(1024.0, 768.0));
let windowed_context = glutin::ContextBuilder::new()
.build_windowed(wb, &el)
.unwrap();You can, of course, create a RawContext<T> separately from an existing
window, however that may result in an suboptimal configuration of the window
on some platforms. In that case use the unsafe platform-specific
RawContextExt available on unix operating systems and Windows.
You can also produce headless Contexts via the
ContextBuilder::build_headless function.
Modules§
- dpi
- UI scaling is important, so read the docs for this module if you don’t want to be confused.
- error
- event
- The
Eventenum and assorted supporting types. - event_
loop - The
EventLoopstruct and assorted supporting types, includingControlFlow. - monitor
- Types useful for interacting with a user’s monitors.
- platform
- Contains traits with platform-specific methods in them.
- window
- The
Windowstruct and associated types.
Structs§
- Context
- Represents an OpenGL
Context. - Context
Builder - An object that allows you to build
Contexts,RawContext<T>s andWindowedContext<T>s. - Context
Wrapper - A context which has an underlying window, which may or may not be stored separately.
- GlAttributes
- Attributes to use when creating an OpenGL
Context. - Pixel
Format - Describes a possible format.
- Pixel
Format Requirements - Describes how the backend should choose a pixel format.
- Possibly
Current - A type that
Contexts which might possibly be currently current on some thread take as a generic. - Rect
Enums§
- Api
- All APIs related to OpenGL that you can possibly get while using glutin.
- Context
Error - Error that can happen when manipulating an OpenGL
Context. - Creation
Error - Error that can happen while creating a window or a headless renderer.
- GlProfile
- Describes the requested OpenGL
Contextprofiles. - GlRequest
- Describes the OpenGL API and version that are being requested when a context is created.
- NotCurrent
- A type that
Contexts which are not currently current on any thread take as a generic. - Release
Behavior - The behavior of the driver when you change the current context.
- Robustness
- Specifies the tolerance of the OpenGL
Contextto faults. If you accept raw OpenGL commands and/or raw shader code from an untrusted source, you should definitely care about this.
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§
- Context
Current State - A trait implemented on both
NotCurrentandPossiblyCurrent.
Type Aliases§
- RawContext
- Represents an OpenGL
Contextwhich has an underlying window that is stored separately. - Windowed
Context - Represents an OpenGL
Contextand theWindowwith which it is associated.