pub struct Context { /* private fields */ }Expand description
Contains the low-level OpenGL/WebGL graphics context as well as other “global” variables. Implements Deref with the low-level graphics context as target, so you can call low-level functionality directly on this struct. Use the context module to get access to low-level constants and structs.
Implementations
sourceimpl Context
impl Context
sourcepub fn from_gl_context(context: Rc<Context>) -> ThreeDResult<Self>
pub fn from_gl_context(context: Rc<Context>) -> ThreeDResult<Self>
Creates a new mid-level context, used in this core module, from a low-level OpenGL/WebGL context from the context module. This should only be called directly if you are creating a low-level context yourself (ie. not using the features in the window module). Since the content in the context module is just a re-export of glow, you can also call this method with a reference counter to a glow context created using glow and not the re-export in context.
sourcepub fn program(
&self,
vertex_shader_source: &str,
fragment_shader_source: &str,
callback: impl FnOnce(&Program) -> ThreeDResult<()>
) -> ThreeDResult<()>
pub fn program(
&self,
vertex_shader_source: &str,
fragment_shader_source: &str,
callback: impl FnOnce(&Program) -> ThreeDResult<()>
) -> ThreeDResult<()>
Compiles a Program with the given vertex and fragment shader source and stores it for later use. If it has already been created, then it is just returned.
sourcepub fn effect(
&self,
fragment_shader_source: &str,
callback: impl FnOnce(&ImageEffect) -> ThreeDResult<()>
) -> ThreeDResult<()>
pub fn effect(
&self,
fragment_shader_source: &str,
callback: impl FnOnce(&ImageEffect) -> ThreeDResult<()>
) -> ThreeDResult<()>
Compiles an ImageEffect with the given fragment shader source and stores it for later use. If it has already been created, then it is just returned.
sourcepub fn camera2d(
&self,
viewport: Viewport,
callback: impl FnOnce(&Camera) -> ThreeDResult<()>
) -> ThreeDResult<()>
pub fn camera2d(
&self,
viewport: Viewport,
callback: impl FnOnce(&Camera) -> ThreeDResult<()>
) -> ThreeDResult<()>
Returns a camera for viewing 2D content.
sourceimpl Context
impl Context
sourcepub fn new() -> ThreeDResult<Self>
pub fn new() -> ThreeDResult<Self>
Creates a new headless graphics context (a graphics context that is not associated with any window).
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more