Struct three_d::window::WindowedContext
source · 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>
pub fn from_winit_window( window: &Window, settings: SurfaceSettings ) -> Result<Self, WindowError>
Creates a new windowed context from a winit window.
sourcepub fn resize(&self, physical_size: PhysicalSize<u32>)
pub fn resize(&self, physical_size: PhysicalSize<u32>)
Resizes the context
sourcepub fn make_current(&self) -> Result<(), WindowError>
pub fn make_current(&self) -> Result<(), WindowError>
Make this context current. Needed when using multiple windows (contexts) on native.
sourcepub fn swap_buffers(&self) -> Result<(), WindowError>
pub fn swap_buffers(&self) -> Result<(), WindowError>
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.