pub struct EGLContext { /* private fields */ }
backend_egl
only.Expand description
EGL context for rendering
Implementations§
source§impl EGLContext
impl EGLContext
sourcepub unsafe fn from_raw(
display: *const c_void,
config_id: *const c_void,
context: *const c_void,
) -> Result<EGLContext, Error>
pub unsafe fn from_raw( display: *const c_void, config_id: *const c_void, context: *const c_void, ) -> Result<EGLContext, Error>
Creates a new EGLContext
from raw handles.
§Safety
- The context must be created from the system default EGL library (
dlopen("libEGL.so")
) - The
display
,config
, andcontext
must be valid for the lifetime of the returned context.
sourcepub fn new(display: &EGLDisplay) -> Result<EGLContext, Error>
pub fn new(display: &EGLDisplay) -> Result<EGLContext, Error>
Creates a new configless EGLContext
from a given EGLDisplay
sourcepub fn new_with_priority(
display: &EGLDisplay,
priority: ContextPriority,
) -> Result<EGLContext, Error>
pub fn new_with_priority( display: &EGLDisplay, priority: ContextPriority, ) -> Result<EGLContext, Error>
Creates a new configless EGLContext
with the specified priority from a given EGLDisplay
Note: The priority is a hint that might be ignored by the underlying platform.
It also requires EGL_IMG_context_priority
to be available, otherwise the priority will be
ignored.
sourcepub fn new_with_config(
display: &EGLDisplay,
attributes: GlAttributes,
reqs: PixelFormatRequirements,
) -> Result<EGLContext, Error>
pub fn new_with_config( display: &EGLDisplay, attributes: GlAttributes, reqs: PixelFormatRequirements, ) -> Result<EGLContext, Error>
Create a new EGLContext
from a given EGLDisplay
and configuration requirements
sourcepub fn new_with_config_and_priority(
display: &EGLDisplay,
attributes: GlAttributes,
reqs: PixelFormatRequirements,
priority: ContextPriority,
) -> Result<EGLContext, Error>
pub fn new_with_config_and_priority( display: &EGLDisplay, attributes: GlAttributes, reqs: PixelFormatRequirements, priority: ContextPriority, ) -> Result<EGLContext, Error>
Create a new EGLContext
from a given EGLDisplay
, configuration requirements and priority
Note: The priority is a hint that might be ignored by the underlying platform.
It also requires EGL_IMG_context_priority
to be available, otherwise the priority will be
ignored.
Create a new configless EGLContext
from a given EGLDisplay
sharing resources with another context
Create a new configless EGLContext
with the specified priority from a given EGLDisplay
sharing resources with another context
Note: The priority is a hint that might be ignored by the underlying platform.
It also requires EGL_IMG_context_priority
to be available, otherwise the priority will be
ignored.
Create a new EGLContext
from a given EGLDisplay
and configuration requirements sharing resources with another context
Create a new EGLContext
with the specified priority from a given EGLDisplay
and configuration requirements sharing resources with another context
Note: The priority is a hint that might be ignored by the underlying platform.
It also requires EGL_IMG_context_priority
to be available, otherwise the priority will be
ignored.
sourcepub unsafe fn make_current(&self) -> Result<(), MakeCurrentError>
pub unsafe fn make_current(&self) -> Result<(), MakeCurrentError>
Makes the OpenGL context the current context in the current thread with no surface bound.
§Safety
This function is marked unsafe, because the context cannot be made current on another thread without
being unbound again (see EGLContext::unbind
).
sourcepub unsafe fn make_current_with_surface(
&self,
surface: &EGLSurface,
) -> Result<(), MakeCurrentError>
pub unsafe fn make_current_with_surface( &self, surface: &EGLSurface, ) -> Result<(), MakeCurrentError>
Makes the OpenGL context the current context in the current thread with a surface to read/draw to.
§Safety
This function is marked unsafe, because the context cannot be made current on another thread without
being unbound again (see EGLContext::unbind
).
sourcepub unsafe fn make_current_with_draw_and_read_surface(
&self,
draw_surface: &EGLSurface,
read_surface: &EGLSurface,
) -> Result<(), MakeCurrentError>
pub unsafe fn make_current_with_draw_and_read_surface( &self, draw_surface: &EGLSurface, read_surface: &EGLSurface, ) -> Result<(), MakeCurrentError>
Makes the OpenGL context the current context in the current thread with surfaces to read/draw to.
§Safety
This function is marked unsafe, because the context cannot be made current on another thread without
being unbound again (see EGLContext::unbind
).
sourcepub fn is_current(&self) -> bool
pub fn is_current(&self) -> bool
Returns true if the OpenGL context is the current one in the thread.
sourcepub fn pixel_format(&self) -> Option<PixelFormat>
pub fn pixel_format(&self) -> Option<PixelFormat>
Returns the pixel format of the main framebuffer of the context.
sourcepub fn unbind(&self) -> Result<(), MakeCurrentError>
pub fn unbind(&self) -> Result<(), MakeCurrentError>
Unbinds this context from the current thread, if set.
This does nothing if this context is not the current context.
sourcepub fn display(&self) -> &EGLDisplay
pub fn display(&self) -> &EGLDisplay
Returns the display which created this context.
sourcepub fn dmabuf_render_formats(&self) -> &FormatSet
pub fn dmabuf_render_formats(&self) -> &FormatSet
Returns a list of formats for dmabufs that can be rendered to.
sourcepub fn dmabuf_texture_formats(&self) -> &FormatSet
pub fn dmabuf_texture_formats(&self) -> &FormatSet
Returns a list of formats for dmabufs that can be used as textures.
sourcepub fn user_data(&self) -> &UserDataMap
pub fn user_data(&self) -> &UserDataMap
Retrieve user_data associated with this context
Note: UserData is shared between shared context, if constructed with
new_shared
or new_shared_with_config
.
sourcepub fn get_context_handle(&self) -> EGLContext
pub fn get_context_handle(&self) -> EGLContext
Get a raw handle to the underlying context.
The pointer will become invalid, when this struct is destroyed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EGLContext
impl !RefUnwindSafe for EGLContext
impl !Sync for EGLContext
impl Unpin for EGLContext
impl !UnwindSafe for EGLContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.