Struct glium::backend::glutin_backend::GlutinFacade [] [src]

pub struct GlutinFacade {
    // some fields omitted
}

Facade implementation for glutin. Wraps both glium and glutin.

Methods

impl GlutinFacade

fn poll_events(&self) -> PollEventsIter

Reads all events received by the window.

This iterator polls for events and can be exhausted.

fn wait_events(&self) -> WaitEventsIter

Reads all events received by the window.

fn get_window(&self) -> Option<WinRef>

Returns the underlying window, or None if glium uses a headless context.

fn draw(&self) -> Frame

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.

Methods from Deref<Target=Context>

unsafe fn new<B, E>(backend: B, check_current_context: bool) -> Result<Rc<Context>, GliumCreationError<E>> where B: Backend + 'static

Builds a new context.

The check_current_context parameter tells the context whether it should check if the backend's OpenGL context is the current one before each OpenGL operation.

If you pass false, you must ensure that no other OpenGL context is going to be made current in the same thread as this context. Passing true makes things safe but is slightly slower.

The OpenGL context must be newly-created. If you make modifications to the context before passing it to this function, glium's state cache may mismatch the actual one.

fn get_framebuffer_dimensions(&self) -> (u32, u32)

Calls get_framebuffer_dimensions on the backend object stored by this context.

unsafe fn rebuild<B, E>(&self, new_backend: B) -> Result<(), GliumCreationError<E>> where B: Backend + 'static

Changes the OpenGL context associated with this context.

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

fn swap_buffers(&self) -> Result<(), SwapBuffersError>

Swaps the buffers in the backend.

fn get_version(&self) -> &Version

DEPRECATED. Use get_opengl_version instead.

fn get_opengl_version(&self) -> &Version

Returns the OpenGL version detected by this context.

fn get_supported_glsl_version(&self) -> Version

Returns the GLSL version guaranteed to be supported.

fn is_glsl_version_supported(&self, version: &Version) -> bool

Returns true if the given GLSL version is supported.

fn is_robust(&self) -> bool

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.

fn is_context_loss_possible(&self) -> bool

Returns true if a context loss is possible.

fn is_context_lost(&self) -> bool

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 immediatly returns true. Otherwise, calls glGetGraphicsResetStatus. If this function is not available, returns false.

fn get_max_anisotropy_support(&self) -> Option<u16>

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

fn get_max_viewport_dimensions(&self) -> (u32, u32)

Returns the maximum dimensions of the viewport.

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

fn release_shader_compiler(&self)

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.

fn get_free_video_memory(&self) -> Option<usize>

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

Returns None if no estimate is available.

fn read_front_buffer<T>(&self) -> T where T: Texture2dDataSink<(u8, u8, u8, u8)>

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 Texture2dData.

Example

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

unsafe fn exec_in_context<'a, T, F>(&self, action: F) -> T where T: Send + 'static, F: FnOnce() -> T + 'a

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.

fn assert_no_error(&self, user_msg: Option<&str>)

Asserts that there are no OpenGL errors pending.

This function should be used in tests.

fn synchronize(&self)

Waits until all the previous commands have finished being executed.

When you execute OpenGL functions, they are not executed immediately. Instead they are put in a queue. This function waits until all commands have finished being executed, and the queue is empty.

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

fn insert_debug_marker(&self, marker: &str) -> Result<(), ()>

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 functionnality. You can choose whether to call .unwrap() if you want to make sure that it works, or .ok() if you don't care.

fn debug_insert_debug_marker(&self, marker: &str) -> Result<(), ()>

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

impl Facade for GlutinFacade

fn get_context(&self) -> &Rc<Context>

impl Deref for GlutinFacade

type Target = Context

fn deref(&self) -> &Context

Derived Implementations

impl Clone for GlutinFacade

fn clone(&self) -> GlutinFacade

fn clone_from(&mut self, source: &Self)