Struct Display

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

[EGL 1.0] RAII wrapper for EGLDisplay.

When dropped, frees up any associated surface and context using

eglMakeCurrent(.., NO_SURFACE, NO_SURFACE, NO_CONTEXT);

call. Followed by eglTerminate.

Implementations§

Source§

impl Display

Source

pub fn from_display_id(display_id: EGLNativeDisplayType) -> Result<Display>

[EGL 1.0] Create a Display from an EGL display connection.

On success, returns a Display value that will clean up resources when terminated.

If no display connection matching display_id is available, EGL_NO_DISPLAY is returned. No error is generated.

§display_id

Specifies the display to connect to. egl::EGL_DEFAULT_DISPLAY indicates the default display.

Source

pub fn from_default_display() -> Result<Display>

[EGL 1.0] Creates a Display from the default display.

This is a convenience wrapper that calls Display::from_display_id with egl::EGL_DEFAULT_DISPLAY option.

Source

pub fn initialize_and_get_version(&self) -> Result<Version>

[EGL 1.0] Initialize this EGL display connection and return EGL version.

eglInitialize initializes the EGL display connection obtained with eglGetDisplay. Initializing an already initialized EGL display connection has no effect besides returning the version numbers.

Source

pub fn initialize(&self) -> Result<()>

[EGL 1.0] Initialize this EGL display connection.

eglInitialize initializes the EGL display connection obtained with eglGetDisplay. Initializing an already initialized EGL display connection has no effect.

Source

pub fn query_client_apis(&self) -> Result<&'static str>

[EGL 1.2] Query EGL_CLIENT_APIS.

Returns a string describing which client rendering APIs are supported. The string contains a space-separate list of API names. The list must include at least one of OpenGL, OpenGL_ES, or OpenVG. These strings correspond respectively to values EGL_OPENGL_API, EGL_OPENGL_ES_API, and EGL_OPENVG_API of the eglBindAPI, api argument.

Source

pub fn query_vendor(&self) -> Result<&'static str>

[EGL 1.0] Query EGL_VENDOR.

The vendor-specific information is optional; if present, its format and contents are implementation specific.

Source

pub fn query_version(&self) -> Result<&'static str>

[EGL 1.0] Get supported EGL version for this display.

Returns a version or release number. The EGL_VERSION string is laid out as follows:

major_version.minor_version space vendor_specific_info

Both the major and minor portions of the version number are numeric. Their values must match the major and minor values returned by initialize.

Source

pub fn query_extensions(&self) -> Result<&'static str>

[EGL 1.0] Get the set of display extensions supported by this display.

Returns a space separated list of supported extensions.

Source

pub fn get_configs(&self) -> Result<Vec<FrameBufferConfigRef>>

[EGL 1.0] Get all possible display configurations.

Internally, this calls eglGetConfigs twice: to get total config count, and to fill allocated memory with config handles.

These handles are then wrapped into a new Vec<FrameBufferConfigRef>.

Source

pub fn config_filter(&self) -> ConfigFilterRef

[EGL 1.0] Creates a new config filter for this display for safe invocation of eglChooseConfig.

See documentation of ConfigFilterRef for the list of all available filter methods.

§Example
use egli::Display;

let display = Display::from_default_display()
                     .expect("failed to get default display");
let configs = display.config_filter()
                     .with_red_size(8)
                     .choose_configs();
Source

pub fn create_window_surface( &self, config: FrameBufferConfigRef, window: EGLNativeWindowType, ) -> Result<Surface>

[EGL 1.0] Create a new EGL window surface.

Source

pub fn create_context(&self, config: FrameBufferConfigRef) -> Result<Context>

[EGL 1.0] Create a new EGL rendering context.

Source

pub fn create_context_with_client_version( &self, config: FrameBufferConfigRef, client_version: ContextClientVersion, ) -> Result<Context>

[EGL 1.3] Create a new EGL rendering context.

Source

pub fn make_current( &self, draw: &Surface, read: &Surface, context: &Context, ) -> Result<()>

[EGL 1.0] Attach an EGL rendering context to EGL surfaces.

Source

pub fn make_not_current(&self) -> Result<()>

[EGL 1.0] Detatch an EGL rendering context from EGL surfaces and contexts.

Source

pub fn swap_buffers(&self, surface: &Surface) -> Result<()>

[EGL 1.0] Post EGL surface color buffer to a native window.

Source

pub fn with_handle<F, R>(&self, action: F) -> R
where F: FnOnce(EGLDisplay) -> R,

Run an action with inner handle as parameter.

Source

pub fn forget(self) -> EGLDisplay

Drops Display without cleaning up any resources.

Returns EGLDisplay handle.

Alias for Into<egl::EGLDisplay>.

Trait Implementations§

Source§

impl Drop for Display

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Into<*mut c_void> for Display

Source§

fn into(self) -> EGLDisplay

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.