2018-10-28 21:14:05 -05:00

411 lines
26 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `glutin` crate."><meta name="keywords" content="rust, rustlang, rust-lang, glutin"><title>glutin - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><p class='location'>Crate glutin</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#statics">Statics</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'glutin', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press S to search, ? for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='in-band'>Crate <a class="mod" href=''>glutin</a></span><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/glutin/lib.rs.html#1-811' title='goto source code'>[src]</a></span></h1><div class='docblock'><p>The purpose of this library is to provide an OpenGL context on as many platforms as possible.</p>
<h1 id="building-a-glwindow" class="section-header"><a href="#building-a-glwindow">Building a GlWindow</a></h1>
<p>A <code>GlWindow</code> is composed of a <code>Window</code> and an OpenGL <code>Context</code>. Due to some
operating-system-specific quirks, glutin requires control over the order of creation of the
<code>Context</code> and <code>Window</code>. Here is an example of building a GlWindow:</p>
<pre class="rust rust-example-rendered">
<span class="kw">let</span> <span class="ident">events_loop</span> <span class="op">=</span> <span class="ident">glutin</span>::<span class="ident">EventsLoop</span>::<span class="ident">new</span>();
<span class="kw">let</span> <span class="ident">window</span> <span class="op">=</span> <span class="ident">glutin</span>::<span class="ident">WindowBuilder</span>::<span class="ident">new</span>()
.<span class="ident">with_title</span>(<span class="string">&quot;Hello world!&quot;</span>)
.<span class="ident">with_dimensions</span>(<span class="ident">glutin</span>::<span class="ident">dpi</span>::<span class="ident">LogicalSize</span>::<span class="ident">new</span>(<span class="number">1024.0</span>, <span class="number">768.0</span>));
<span class="kw">let</span> <span class="ident">context</span> <span class="op">=</span> <span class="ident">glutin</span>::<span class="ident">ContextBuilder</span>::<span class="ident">new</span>();
<span class="kw">let</span> <span class="ident">gl_window</span> <span class="op">=</span> <span class="ident">glutin</span>::<span class="ident">GlWindow</span>::<span class="ident">new</span>(<span class="ident">window</span>, <span class="ident">context</span>, <span class="kw-2">&amp;</span><span class="ident">events_loop</span>).<span class="ident">unwrap</span>();</pre>
<p>For contexts that are <em>not</em> associated with any particular window, see the HeadlessContext
type.</p>
<h1 id="features" class="section-header"><a href="#features">Features</a></h1>
<p>This crate has two Cargo features: <code>window</code> and <code>headless</code>.</p>
<ul>
<li><code>window</code> allows you to create regular windows and enables the <code>WindowBuilder</code> object.</li>
<li><code>headless</code> allows you to do headless rendering, and enables
the <code>HeadlessRendererBuilder</code> object.</li>
</ul>
<p>By default only <code>window</code> is enabled.</p>
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
<table>
<tr class=' module-item'>
<td><a class="mod" href="dpi/index.html"
title='mod glutin::dpi'>dpi</a></td>
<td class='docblock-short'>
<p>DPI is important, so read the docs for this module if you don't want to be confused.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="mod" href="os/index.html"
title='mod glutin::os'>os</a></td>
<td class='docblock-short'>
<p>Contains traits with platform-specific methods in them.</p>
</td>
</tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table>
<tr class=' module-item'>
<td><a class="struct" href="struct.AvailableMonitorsIter.html"
title='struct glutin::AvailableMonitorsIter'>AvailableMonitorsIter</a></td>
<td class='docblock-short'>
<p>An iterator for the list of available monitors.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.Context.html"
title='struct glutin::Context'>Context</a></td>
<td class='docblock-short'>
<p>Represents an OpenGL context.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.ContextBuilder.html"
title='struct glutin::ContextBuilder'>ContextBuilder</a></td>
<td class='docblock-short'>
<p>Object that allows you to build <code>Context</code>s.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.DeviceId.html"
title='struct glutin::DeviceId'>DeviceId</a></td>
<td class='docblock-short'>
<p>Identifier of an input device.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.EventsLoop.html"
title='struct glutin::EventsLoop'>EventsLoop</a></td>
<td class='docblock-short'>
<p>Provides a way to retrieve events from the system and from the windows that were registered to
the events loop.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.EventsLoopClosed.html"
title='struct glutin::EventsLoopClosed'>EventsLoopClosed</a></td>
<td class='docblock-short'>
<p>The error that is returned when an <code>EventsLoopProxy</code> attempts to wake up an <code>EventsLoop</code> that
no longer exists.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.EventsLoopProxy.html"
title='struct glutin::EventsLoopProxy'>EventsLoopProxy</a></td>
<td class='docblock-short'>
<p>Used to wake up the <code>EventsLoop</code> from another thread.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.GlAttributes.html"
title='struct glutin::GlAttributes'>GlAttributes</a></td>
<td class='docblock-short'>
<p>Attributes to use when creating an OpenGL context.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.GlWindow.html"
title='struct glutin::GlWindow'>GlWindow</a></td>
<td class='docblock-short'>
<p>Represents an OpenGL context and a Window with which it is associated.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.HeadlessContext.html"
title='struct glutin::HeadlessContext'>HeadlessContext</a></td>
<td class='docblock-short'>
<p>Represents a headless OpenGL context.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.HeadlessRendererBuilder.html"
title='struct glutin::HeadlessRendererBuilder'>HeadlessRendererBuilder</a></td>
<td class='docblock-short'>
<p>Object that allows you to build headless contexts.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.Icon.html"
title='struct glutin::Icon'>Icon</a></td>
<td class='docblock-short'>
<p>An icon used for the window titlebar, taskbar, etc.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.KeyboardInput.html"
title='struct glutin::KeyboardInput'>KeyboardInput</a></td>
<td class='docblock-short'>
<p>Describes a keyboard input event.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.ModifiersState.html"
title='struct glutin::ModifiersState'>ModifiersState</a></td>
<td class='docblock-short'>
<p>Represents the current state of the keyboard modifiers</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.MonitorId.html"
title='struct glutin::MonitorId'>MonitorId</a></td>
<td class='docblock-short'>
<p>Identifier for a monitor.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.PixelFormat.html"
title='struct glutin::PixelFormat'>PixelFormat</a></td>
<td class='docblock-short'>
<p>Describes a possible format. Unused.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.PixelFormatRequirements.html"
title='struct glutin::PixelFormatRequirements'>PixelFormatRequirements</a></td>
<td class='docblock-short'>
<p>Describes how the backend should choose a pixel format.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.Touch.html"
title='struct glutin::Touch'>Touch</a></td>
<td class='docblock-short'>
<p>Represents touch event</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.Window.html"
title='struct glutin::Window'>Window</a></td>
<td class='docblock-short'>
<p>Represents a window.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.WindowAttributes.html"
title='struct glutin::WindowAttributes'>WindowAttributes</a></td>
<td class='docblock-short'>
<p>Attributes to use when creating a window.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.WindowBuilder.html"
title='struct glutin::WindowBuilder'>WindowBuilder</a></td>
<td class='docblock-short'>
<p>Object that allows you to build windows.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.WindowId.html"
title='struct glutin::WindowId'>WindowId</a></td>
<td class='docblock-short'>
<p>Identifier of a window. Unique for each window.</p>
</td>
</tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
<table>
<tr class=' module-item'>
<td><a class="enum" href="enum.Api.html"
title='enum glutin::Api'>Api</a></td>
<td class='docblock-short'>
<p>All APIs related to OpenGL that you can possibly get while using glutin.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.ContextError.html"
title='enum glutin::ContextError'>ContextError</a></td>
<td class='docblock-short'>
<p>Error that can happen when manipulating an OpenGL context.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.ControlFlow.html"
title='enum glutin::ControlFlow'>ControlFlow</a></td>
<td class='docblock-short'>
<p>Returned by the user callback given to the <code>EventsLoop::run_forever</code> method.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.CreationError.html"
title='enum glutin::CreationError'>CreationError</a></td>
<td class='docblock-short'>
<p>Error that can happen while creating a window or a headless renderer.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.DeviceEvent.html"
title='enum glutin::DeviceEvent'>DeviceEvent</a></td>
<td class='docblock-short'>
<p>Represents raw hardware events that are not associated with any particular window.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.ElementState.html"
title='enum glutin::ElementState'>ElementState</a></td>
<td class='docblock-short'>
<p>Describes the input state of a key.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.Event.html"
title='enum glutin::Event'>Event</a></td>
<td class='docblock-short'>
<p>Describes a generic event.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.GlProfile.html"
title='enum glutin::GlProfile'>GlProfile</a></td>
<td class='docblock-short'>
<p>Describes the requested OpenGL context profiles.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.GlRequest.html"
title='enum glutin::GlRequest'>GlRequest</a></td>
<td class='docblock-short'>
<p>Describes the OpenGL API and version that are being requested when a context is created.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.MouseButton.html"
title='enum glutin::MouseButton'>MouseButton</a></td>
<td class='docblock-short'>
<p>Describes a button of a mouse controller.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.MouseCursor.html"
title='enum glutin::MouseCursor'>MouseCursor</a></td>
<td class='docblock-short'>
<p>Describes the appearance of the mouse cursor.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.MouseScrollDelta.html"
title='enum glutin::MouseScrollDelta'>MouseScrollDelta</a></td>
<td class='docblock-short'>
<p>Describes a difference in the mouse scroll wheel state.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.ReleaseBehavior.html"
title='enum glutin::ReleaseBehavior'>ReleaseBehavior</a></td>
<td class='docblock-short'>
<p>The behavior of the driver when you change the current context.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.Robustness.html"
title='enum glutin::Robustness'>Robustness</a></td>
<td class='docblock-short'>
<p>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.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.TouchPhase.html"
title='enum glutin::TouchPhase'>TouchPhase</a></td>
<td class='docblock-short'>
<p>Describes touch-screen input state.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.VirtualKeyCode.html"
title='enum glutin::VirtualKeyCode'>VirtualKeyCode</a></td>
<td class='docblock-short'>
<p>Symbolic name for a keyboard key.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.WindowCreationError.html"
title='enum glutin::WindowCreationError'>WindowCreationError</a></td>
<td class='docblock-short'>
<p>Error that can happen while creating a window or a headless renderer.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="enum" href="enum.WindowEvent.html"
title='enum glutin::WindowEvent'>WindowEvent</a></td>
<td class='docblock-short'>
<p>Describes an event from a <code>Window</code>.</p>
</td>
</tr></table><h2 id='statics' class='section-header'><a href="#statics">Statics</a></h2>
<table>
<tr class=' module-item'>
<td><a class="static" href="static.GL_CORE.html"
title='static glutin::GL_CORE'>GL_CORE</a></td>
<td class='docblock-short'>
<p>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.</p>
</td>
</tr></table><h2 id='traits' class='section-header'><a href="#traits">Traits</a></h2>
<table>
<tr class=' module-item'>
<td><a class="trait" href="trait.GlContext.html"
title='trait glutin::GlContext'>GlContext</a></td>
<td class='docblock-short'>
<p>A trait for types associated with a GL context.</p>
</td>
</tr></table><h2 id='types' class='section-header'><a href="#types">Type Definitions</a></h2>
<table>
<tr class=' module-item'>
<td><a class="type" href="type.AxisId.html"
title='type glutin::AxisId'>AxisId</a></td>
<td class='docblock-short'>
<p>Identifier for a specific analog axis on some device.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="type" href="type.ButtonId.html"
title='type glutin::ButtonId'>ButtonId</a></td>
<td class='docblock-short'>
<p>Identifier for a specific button on some device.</p>
</td>
</tr>
<tr class=' module-item'>
<td><a class="type" href="type.ScanCode.html"
title='type glutin::ScanCode'>ScanCode</a></td>
<td class='docblock-short'>
<p>Hardware-dependent keyboard scan code.</p>
</td>
</tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd></kbd></dt><dd>Move up in search results</dd><dt><kbd></kbd></dt><dd>Move down in search results</dd><dt><kbd></kbd></dt><dd>Switch tab</dd><dt><kbd>&#9166;</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "glutin";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>