Struct khronos_egl::Instance [−][src]
EGL API instance.
An instance wraps an interface to the EGL API and provide rust-friendly access to it.
Implementations
impl<T: EGL1_0> Instance<T>
[src]
pub fn matching_config_count(
&self,
display: Display,
attrib_list: &[Int]
) -> Result<usize, Error>
[src]
&self,
display: Display,
attrib_list: &[Int]
) -> Result<usize, Error>
Return the number of EGL frame buffer configurations that atch specified attributes.
This will call eglChooseConfig
without null
as configs
to get the
number of matching configurations.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with NONE
).
pub fn choose_config(
&self,
display: Display,
attrib_list: &[Int],
configs: &mut Vec<Config>
) -> Result<(), Error>
[src]
&self,
display: Display,
attrib_list: &[Int],
configs: &mut Vec<Config>
) -> Result<(), Error>
Return a list of EGL frame buffer configurations that match specified attributes.
This will write as many matching configurations in configs
up to its
capacity. You can use the function matching_config_count
to get the
exact number of configurations matching the specified attributes.
Example
// Get the number of matching configurations. let count = egl.matching_config_count(display, &attrib_list)?; // Get the matching configurations. let mut configs = Vec::with_capacity(count); egl.choose_config(display, &attrib_list, &mut configs)?;
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with NONE
).
pub fn choose_first_config(
&self,
display: Display,
attrib_list: &[Int]
) -> Result<Option<Config>, Error>
[src]
&self,
display: Display,
attrib_list: &[Int]
) -> Result<Option<Config>, Error>
Return the first EGL frame buffer configuration that match specified attributes.
This is an helper function that will call choose_config
with a buffer of
size 1, which is equivalent to:
let mut configs = Vec::with_capacity(1); egl.choose_config(display, &attrib_list, &mut configs)?; configs.first();
pub fn copy_buffers(
&self,
display: Display,
surface: Surface,
target: NativePixmapType
) -> Result<(), Error>
[src]
&self,
display: Display,
surface: Surface,
target: NativePixmapType
) -> Result<(), Error>
Copy EGL surface color buffer to a native pixmap.
pub fn create_context(
&self,
display: Display,
config: Config,
share_context: Option<Context>,
attrib_list: &[Int]
) -> Result<Context, Error>
[src]
&self,
display: Display,
config: Config,
share_context: Option<Context>,
attrib_list: &[Int]
) -> Result<Context, Error>
Create a new EGL rendering context.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with NONE
).
pub fn create_pbuffer_surface(
&self,
display: Display,
config: Config,
attrib_list: &[Int]
) -> Result<Surface, Error>
[src]
&self,
display: Display,
config: Config,
attrib_list: &[Int]
) -> Result<Surface, Error>
Create a new EGL pixel buffer surface.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with NONE
).
pub unsafe fn create_pixmap_surface(
&self,
display: Display,
config: Config,
pixmap: NativePixmapType,
attrib_list: &[Int]
) -> Result<Surface, Error>
[src]
&self,
display: Display,
config: Config,
pixmap: NativePixmapType,
attrib_list: &[Int]
) -> Result<Surface, Error>
Create a new EGL offscreen surface.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with NONE
).
Since this function may raise undefined behavior if the display and native pixmap do not belong to the same platform, it is inherently unsafe.
pub unsafe fn create_window_surface(
&self,
display: Display,
config: Config,
window: NativeWindowType,
attrib_list: Option<&[Int]>
) -> Result<Surface, Error>
[src]
&self,
display: Display,
config: Config,
window: NativeWindowType,
attrib_list: Option<&[Int]>
) -> Result<Surface, Error>
Create a new EGL window surface.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with NONE
).
Since this function may raise undefined behavior if the display and native window do not belong to the same platform, it is inherently unsafe.
pub fn destroy_context(
&self,
display: Display,
ctx: Context
) -> Result<(), Error>
[src]
&self,
display: Display,
ctx: Context
) -> Result<(), Error>
Destroy an EGL rendering context.
pub fn destroy_surface(
&self,
display: Display,
surface: Surface
) -> Result<(), Error>
[src]
&self,
display: Display,
surface: Surface
) -> Result<(), Error>
Destroy an EGL surface.
pub fn get_config_attrib(
&self,
display: Display,
config: Config,
attribute: Int
) -> Result<Int, Error>
[src]
&self,
display: Display,
config: Config,
attribute: Int
) -> Result<Int, Error>
Return information about an EGL frame buffer configuration.
pub fn get_config_count(&self, display: Display) -> Result<usize, Error>
[src]
Return the number of all frame buffer configurations.
You can use it to setup the correct capacity for the configurations buffer in get_configs
.
Example
let mut configs = Vec::with_capacity(egl.get_config_count(display)?); egl.get_configs(display, &mut configs); assert!(configs.len() > 0);
pub fn get_configs(
&self,
display: Display,
configs: &mut Vec<Config>
) -> Result<(), Error>
[src]
&self,
display: Display,
configs: &mut Vec<Config>
) -> Result<(), Error>
Get the list of all EGL frame buffer configurations for a display.
The configurations are added to the configs
buffer, up to the buffer’s capacity.
You can use get_config_count
to get the total number of available frame buffer configurations,
and setup the buffer’s capacity accordingly.
Example
let mut configs = Vec::with_capacity(egl.get_config_count(display)?); egl.get_configs(display, &mut configs);
pub fn get_current_display(&self) -> Option<Display>
[src]
Return the display for the current EGL rendering context.
pub fn get_current_surface(&self, readdraw: Int) -> Option<Surface>
[src]
Return the read or draw surface for the current EGL rendering context.
pub fn get_display(&self, display_id: NativeDisplayType) -> Option<Display>
[src]
Return an EGL display connection.
pub fn get_error(&self) -> Option<Error>
[src]
Return error information.
Return the error of the last called EGL function in the current thread, or
None
if the error is set to SUCCESS
.
Note that since a call to eglGetError
sets the error to SUCCESS
, and
since this function is automatically called by any wrapper function
returning a Result
when necessary, this function may only return None
from the point of view of a user.
pub fn get_proc_address(&self, procname: &str) -> Option<extern "C" fn()>
[src]
Return a GL or an EGL extension function.
pub fn initialize(&self, display: Display) -> Result<(Int, Int), Error>
[src]
Initialize an EGL display connection.
pub fn make_current(
&self,
display: Display,
draw: Option<Surface>,
read: Option<Surface>,
ctx: Option<Context>
) -> Result<(), Error>
[src]
&self,
display: Display,
draw: Option<Surface>,
read: Option<Surface>,
ctx: Option<Context>
) -> Result<(), Error>
Attach an EGL rendering context to EGL surfaces.
pub fn query_context(
&self,
display: Display,
ctx: Context,
attribute: Int
) -> Result<Int, Error>
[src]
&self,
display: Display,
ctx: Context,
attribute: Int
) -> Result<Int, Error>
Return EGL rendering context information.
pub fn query_string(
&self,
display: Option<Display>,
name: Int
) -> Result<&'static CStr, Error>
[src]
&self,
display: Option<Display>,
name: Int
) -> Result<&'static CStr, Error>
Return a string describing properties of the EGL client or of an EGL display connection.
pub fn query_surface(
&self,
display: Display,
surface: Surface,
attribute: Int
) -> Result<Int, Error>
[src]
&self,
display: Display,
surface: Surface,
attribute: Int
) -> Result<Int, Error>
Return EGL surface information.
pub fn swap_buffers(
&self,
display: Display,
surface: Surface
) -> Result<(), Error>
[src]
&self,
display: Display,
surface: Surface
) -> Result<(), Error>
Post EGL surface color buffer to a native window.
pub fn terminate(&self, display: Display) -> Result<(), Error>
[src]
Terminate an EGL display connection.
pub fn wait_gl(&self) -> Result<(), Error>
[src]
Complete GL execution prior to subsequent native rendering calls.
pub fn wait_native(&self, engine: Int) -> Result<(), Error>
[src]
Complete native execution prior to subsequent GL rendering calls.
impl<T: EGL1_1> Instance<T>
[src]
pub fn bind_tex_image(
&self,
display: Display,
surface: Surface,
buffer: Int
) -> Result<(), Error>
[src]
&self,
display: Display,
surface: Surface,
buffer: Int
) -> Result<(), Error>
Defines a two-dimensional texture image.
pub fn release_tex_image(
&self,
display: Display,
surface: Surface,
buffer: Int
) -> Result<(), Error>
[src]
&self,
display: Display,
surface: Surface,
buffer: Int
) -> Result<(), Error>
Releases a color buffer that is being used as a texture.
pub fn surface_attrib(
&self,
display: Display,
surface: Surface,
attribute: Int,
value: Int
) -> Result<(), Error>
[src]
&self,
display: Display,
surface: Surface,
attribute: Int,
value: Int
) -> Result<(), Error>
Set an EGL surface attribute.
pub fn swap_interval(
&self,
display: Display,
interval: Int
) -> Result<(), Error>
[src]
&self,
display: Display,
interval: Int
) -> Result<(), Error>
Specifies the minimum number of video frame periods per buffer swap for the window associated with the current context.
impl<T: EGL1_2> Instance<T>
[src]
pub fn bind_api(&self, api: Enum) -> Result<(), Error>
[src]
Set the current rendering API.
pub fn query_api(&self) -> Enum
[src]
Query the current rendering API.
pub fn create_pbuffer_from_client_buffer(
&self,
display: Display,
buffer_type: Enum,
buffer: ClientBuffer,
config: Config,
attrib_list: &[Int]
) -> Result<Surface, Error>
[src]
&self,
display: Display,
buffer_type: Enum,
buffer: ClientBuffer,
config: Config,
attrib_list: &[Int]
) -> Result<Surface, Error>
Create a new EGL pixel buffer surface bound to an OpenVG image.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with NONE
).
pub fn release_thread(&self) -> Result<(), Error>
[src]
Release EGL per-thread state.
pub fn wait_client(&self) -> Result<(), Error>
[src]
Complete client API execution prior to subsequent native rendering calls.
impl<T: EGL1_4> Instance<T>
[src]
pub fn get_current_context(&self) -> Option<Context>
[src]
Return the current EGL rendering context.
impl<T: EGL1_5> Instance<T>
[src]
pub unsafe fn create_sync(
&self,
display: Display,
ty: Enum,
attrib_list: &[Attrib]
) -> Result<Sync, Error>
[src]
&self,
display: Display,
ty: Enum,
attrib_list: &[Attrib]
) -> Result<Sync, Error>
Create a new EGL sync object.
Note that the constant ATTRIB_NONE
which has the type Attrib
can be used
instead of NONE
to terminate the attribute list.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with ATTRIB_NONE
).
This function is unsafe: when creating an OpenCL Event Sync Object, passing an invalid event
handle in attrib_list
may result in undefined behavior up to and including program
termination.
pub unsafe fn destroy_sync(
&self,
display: Display,
sync: Sync
) -> Result<(), Error>
[src]
&self,
display: Display,
sync: Sync
) -> Result<(), Error>
Destroy a sync object.
This function is unsafe: if display does not match the display passed to eglCreateSync when sync was created, the behaviour is undefined.
pub unsafe fn client_wait_sync(
&self,
display: Display,
sync: Sync,
flags: Int,
timeout: Time
) -> Result<Int, Error>
[src]
&self,
display: Display,
sync: Sync,
flags: Int,
timeout: Time
) -> Result<Int, Error>
Wait in the client for a sync object to be signalled.
This function is unsafe: if display
does not match the Display
passed to create_sync
when sync
was created, the behaviour is undefined.
pub unsafe fn get_sync_attrib(
&self,
display: Display,
sync: Sync,
attribute: Int
) -> Result<Attrib, Error>
[src]
&self,
display: Display,
sync: Sync,
attribute: Int
) -> Result<Attrib, Error>
Return an attribute of a sync object.
This function is unsafe: If display
does not match the Display
passed to create_sync
when sync
was created, behaviour is undefined.
pub fn create_image(
&self,
display: Display,
ctx: Context,
target: Enum,
buffer: ClientBuffer,
attrib_list: &[Attrib]
) -> Result<Image, Error>
[src]
&self,
display: Display,
ctx: Context,
target: Enum,
buffer: ClientBuffer,
attrib_list: &[Attrib]
) -> Result<Image, Error>
Create a new Image object.
Note that the constant ATTRIB_NONE
which has the type Attrib
can be used
instead of NONE
to terminate the attribute list.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with ATTRIB_NONE
).
pub fn destroy_image(&self, display: Display, image: Image) -> Result<(), Error>
[src]
Destroy an Image object.
pub fn get_platform_display(
&self,
platform: Enum,
native_display: *mut c_void,
attrib_list: &[Attrib]
) -> Result<Display, Error>
[src]
&self,
platform: Enum,
native_display: *mut c_void,
attrib_list: &[Attrib]
) -> Result<Display, Error>
Return an EGL display connection.
Note that the constant ATTRIB_NONE
which has the type Attrib
can be used
instead of NONE
to terminate the attribute list.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with ATTRIB_NONE
).
pub fn create_platform_window_surface(
&self,
display: Display,
config: Config,
native_window: *mut c_void,
attrib_list: &[Attrib]
) -> Result<Surface, Error>
[src]
&self,
display: Display,
config: Config,
native_window: *mut c_void,
attrib_list: &[Attrib]
) -> Result<Surface, Error>
Create a new EGL on-screen rendering surface.
Note that the constant ATTRIB_NONE
which has the type Attrib
can be used
instead of NONE
to terminate the attribute list.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with ATTRIB_NONE
).
pub fn create_platform_pixmap_surface(
&self,
display: Display,
config: Config,
native_pixmap: *mut c_void,
attrib_list: &[Attrib]
) -> Result<Surface, Error>
[src]
&self,
display: Display,
config: Config,
native_pixmap: *mut c_void,
attrib_list: &[Attrib]
) -> Result<Surface, Error>
Create a new EGL offscreen surface.
Note that the constant ATTRIB_NONE
which has the type Attrib
can be used
instead of NONE
to terminate the attribute list.
This will return a BadParameter
error if attrib_list
is not a valid
attributes list (if it does not terminate with ATTRIB_NONE
).
pub fn wait_sync(
&self,
display: Display,
sync: Sync,
flags: Int
) -> Result<(), Error>
[src]
&self,
display: Display,
sync: Sync,
flags: Int
) -> Result<(), Error>
Wait in the server for a sync object to be signalled.
This function is unsafe: if display
does not match the Display
passed to create_sync
when sync
was created, the behavior is undefined.
impl<T> Instance<T>
[src]
pub fn cast_into<U: From<T>>(self) -> Instance<U>
[src]
Cast the API.
pub fn try_cast_into<U: TryFrom<T>>(
self
) -> Result<Instance<U>, Instance<U::Error>>
[src]
self
) -> Result<Instance<U>, Instance<U::Error>>
Try to cast the API.
pub fn version(&self) -> Version where
T: Api,
[src]
T: Api,
Returns the version of the provided EGL API.
impl<T> Instance<T>
[src]
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for Instance<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Instance<T> where
T: Send,
T: Send,
impl<T> Sync for Instance<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Instance<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Instance<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast<T> for T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.