pub struct WindowedContext { /* private fields */ }Expand description
A windowed graphics context, ie. a graphics context that is associated with a window. For a graphics context that is not associated with a window, see HeadlessContext.
Implementations§
Source§impl WindowedContext
impl WindowedContext
Sourcepub fn from_winit_window(
window: &Window,
settings: SurfaceSettings,
) -> Result<Self, WindowError>
Available on crate feature window and non-WebAssembly only.
pub fn from_winit_window( window: &Window, settings: SurfaceSettings, ) -> Result<Self, WindowError>
window and non-WebAssembly only.Creates a new windowed context from a winit window.
Sourcepub fn resize(&self, physical_size: PhysicalSize<u32>)
Available on crate feature window and non-WebAssembly only.
pub fn resize(&self, physical_size: PhysicalSize<u32>)
window and non-WebAssembly only.Resizes the context
Sourcepub fn make_current(&self) -> Result<(), WindowError>
Available on crate feature window and non-WebAssembly only.
pub fn make_current(&self) -> Result<(), WindowError>
window and non-WebAssembly only.Make this context current. Needed when using multiple windows (contexts) on native.
Sourcepub fn swap_buffers(&self) -> Result<(), WindowError>
Available on crate feature window and non-WebAssembly only.
pub fn swap_buffers(&self) -> Result<(), WindowError>
window and non-WebAssembly only.Swap buffers - should always be called after rendering.
Methods from Deref<Target = Context>§
Sourcepub fn set_scissor(&self, scissor_box: ScissorBox)
pub fn set_scissor(&self, scissor_box: ScissorBox)
Set the scissor test for this context (see ScissorBox).
Sourcepub fn set_viewport(&self, viewport: Viewport)
pub fn set_viewport(&self, viewport: Viewport)
Set the viewport for this context (See Viewport).
Sourcepub fn set_write_mask(&self, write_mask: WriteMask)
pub fn set_write_mask(&self, write_mask: WriteMask)
Set the write mask for this context (see WriteMask).
Sourcepub fn set_depth_test(&self, depth_test: DepthTest)
pub fn set_depth_test(&self, depth_test: DepthTest)
Set the depth test for this context (see DepthTest).
Sourcepub fn set_render_states(&self, render_states: RenderStates)
pub fn set_render_states(&self, render_states: RenderStates)
Set the render states for this context (see RenderStates).
Sourcepub fn error_check(&self) -> Result<(), CoreError>
pub fn error_check(&self) -> Result<(), CoreError>
Returns an error if an GPU-side error has happened while rendering which can be used to check for errors while developing. Can also be used in production to handle unexpected rendering errors, but do not call it too often to avoid performance problems.