pub struct GlContext<'window> { /* private fields */ }
Expand description

An OpenGL context controller.

Implementations§

source§

impl<'window> GlContext<'window>

source

pub fn new(window: &'window Window<'_>) -> Option<Self>

Constructs from a reference to Window, or Err on failure.

source

pub fn as_ptr(&self) -> *mut c_void

Returns the internal pointer of the OpenGL context.

source

pub fn drawable_size(&self) -> Size

Returns the size that can be used to draw.

source

pub fn supported_extension(&self, name: &'static str) -> bool

Returns whether the extension name is supported.

§Panics

Panics if name contains a null character.

source

pub fn load_lib(&self, path: &str) -> Result<()>

Loads the library from path.

§Errors

Returns Err if failed to load the library.

§Panics

Panics if path contains a null character.

source

pub fn unload_lib_all(&self)

Unloads all of loaded libraries.

source

pub unsafe fn proc_address(&self, proc: &str) -> *mut c_void

Returns the raw address of the procedure.

§Safety

This return value is valid only on supported the extension. You must check by supported_extension before casting to any function pointer.

§Panics

Panics if proc contains a null character.

Trait Implementations§

source§

impl BufferExt for GlContext<'_>

source§

fn set_swap_interval(&self, interval_kind: IntervalKind) -> Result<()>

Sets the interval mode of swapping buffers. Read more
source§

fn swap_buffer(&self)

Swaps buffers immediately.
source§

impl Debug for GlContext<'_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'window> Drop for GlContext<'window>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'window> !RefUnwindSafe for GlContext<'window>

§

impl<'window> !Send for GlContext<'window>

§

impl<'window> !Sync for GlContext<'window>

§

impl<'window> Unpin for GlContext<'window>

§

impl<'window> !UnwindSafe for GlContext<'window>

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>,

§

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>,

§

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.