pub struct Display { /* private fields */ }
Expand description

A GL context combined with a facade for drawing upon.

The Display uses glutin for the Window and its associated GL Context.

These are stored alongside a glium-specific context.

Implementations§

Create a new glium Display from the given context and window builders.

Performs a compatibility check to make sure that all core elements of glium are supported by the implementation.

Create a new glium Display.

Performs a compatibility check to make sure that all core elements of glium are supported by the implementation.

Create a new glium Display.

This function does the same as build_glium, except that the resulting context will assume that the current OpenGL context will never change.

The same as the new constructor, but allows for specifying debug callback behaviour.

The same as the unchecked constructor, but allows for specifying debug callback behaviour.

Rebuilds the Display’s GlWindow with the given window and context builders.

This method ensures that the new GlWindow’s Context will share the display lists of the original GlWindow’s Context.

Borrow the inner glutin GlWindow.

Start drawing on the backbuffer.

This function returns a Frame, which can be used to draw on it. When the Frame is destroyed, the buffers are swapped.

Note that destroying a Frame is immediate, even if vsync is enabled.

If the framebuffer dimensions have changed since the last call to draw, the inner glutin context will be resized accordingly before returning the Frame.

Methods from Deref<Target = Context>§

Calls get_framebuffer_dimensions on the backend object stored by this context.

Changes the OpenGL context associated with this context.

The new context must have lists shared with the old one.

Swaps the buffers in the backend.

DEPRECATED. Use get_opengl_version instead.

Returns the OpenGL version detected by this context.

Returns the GLSL version guaranteed to be supported.

Returns true if the given GLSL version is supported.

Returns a string containing this GL version or release number used by this context.

Vendor-specific information may follow the version number.

Returns a string containing the company responsible for this GL implementation.

Returns a string containing the name of the GL renderer used by this context.

This name is typically specific to a particular configuration of a hardware platform.

Returns true if the context is in debug mode.

Debug mode may provide additional error and performance issue reporting functionality.

Returns true if the context is in “forward-compatible” mode.

Forward-compatible mode means that no deprecated functionality will be supported.

Returns this context’s OpenGL profile if available.

The context profile is available from OpenGL 3.2 onwards. Returns None if not supported.

Returns true if out-of-bound buffer access from the GPU side (inside a program) cannot result in a crash.

You should take extra care if is_robust returns false.

Returns true if a context loss is possible.

Returns true if the context has been lost and needs to be recreated.

Implementation

If it has been determined that the context has been lost before, then the function immediately returns true. Otherwise, calls glGetGraphicsResetStatus. If this function is not available, returns false.

Returns the behavior when the current OpenGL context is changed.

The most common value is Flush. In order to get None you must explicitly request it during creation.

Returns the maximum value that can be used for anisotropic filtering, or None if the hardware doesn’t support it.

Returns the maximum dimensions of the viewport.

Glium will panic if you request a larger viewport than this when drawing.

Releases the shader compiler, indicating that no new programs will be created for a while.

This method is a no-op if it’s not available in the implementation.

Returns an estimate of the amount of video memory available in bytes.

Returns None if no estimate is available.

Reads the content of the front buffer.

You will only see the data that has finished being drawn.

This function can return any type that implements Texture2dDataSink<(u8, u8, u8, u8)>.

Example
let pixels: Vec<Vec<(u8, u8, u8, u8)>> = display.read_front_buffer();

Execute an arbitrary closure with the OpenGL context active. Useful if another component needs to directly manipulate OpenGL state.

If action manipulates any OpenGL state, it must be restored before action completes.

Asserts that there are no OpenGL errors pending.

This function should be used in tests.

DEPRECATED. Renamed finish.

Calls glFinish(). This waits until all the previously issued commands have finished being executed.

When you execute OpenGL functions, they are not executed immediately. Instead they are put in a queue. This function flushes this queue, then waits until all commands have finished being executed.

You normally don’t need to call this function manually, except for debugging purposes.

Calls glFlush(). This starts executing the commands that you have issued if it is not yet the case.

When you execute OpenGL functions, they are not executed immediately. Instead they are put in a queue. This function flushes this queue so that commands start being executed.

You normally don’t need to call this function manually. Swapping buffers automatically flushes the queue. This function can be useful if you want to benchmark the time it takes from your OpenGL driver to process commands.

Inserts a debugging string in the commands queue. If you use an OpenGL debugger, you will be able to see that string.

This is helpful to understand where you are when you have big applications.

Returns Err if the backend doesn’t support this functionality. You can choose whether to call .unwrap() if you want to make sure that it works, or .ok() if you don’t care.

Same as insert_debug_marker, except that if you don’t compile with debug_assertions it is a no-op and returns Ok.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
The resulting type after dereferencing.
Dereferences the value.
Returns an opaque type that contains the OpenGL state, extensions, version, etc.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Returns the version of the backend.
Returns the list of extensions that are supported.
Returns the capabilities of the backend.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.