Struct gl_utils::render::viewport::Viewport [−][src]
A viewport defined by a glium::Rect
structure, with associated 2D and 3D
cameras
Fields
rect: Rect
Describes the viewport position and size.
left
and bottom
are the number of pixels between the left and bottom
of the screen with the left and bottom borders of the viewport rectangle.
camera2d: Camera2d
camera3d: Camera3d
Methods
impl Viewport
[src]
impl Viewport
pub fn new(rect: Rect) -> Self
[src]
pub fn new(rect: Rect) -> Self
Create a new viewport with the given Rect
Panics
Width or height are zero:
let mut viewport = Viewport::new (glium::Rect { left: 0, bottom: 0, width: 0, height: 0 });
Width or height are greater than u16::MAX
(65535):
let mut viewport = Viewport::new (glium::Rect { left: 0, bottom: 0, width: 65536, height: 65536 });
pub fn with_pose_3d(rect: Rect, pose: Pose3d<f32>) -> Self
[src]
pub fn with_pose_3d(rect: Rect, pose: Pose3d<f32>) -> Self
Also initializes self.camera3d
with position and orientation
pub fn set_rect(&mut self, rect: Rect)
[src]
pub fn set_rect(&mut self, rect: Rect)
Should be called when screen resolution changes.
Panics
Width and height must be less than or equal to u16::MAX
(65535):
viewport.set_rect (glium::Rect { left: 0, bottom: 0, width: 100_000, height: 100_000 // panics });
Width or height are zero:
viewport.set_rect (glium::Rect { left: 0, bottom: 0, width: 0, height: 0 // panics });