Struct gl_utils::render::viewport::Viewport[][src]

pub struct Viewport {
    pub rect: Rect,
    pub camera2d: Camera2d,
    pub camera3d: Camera3d,
}

A viewport defined by a glium::Rect structure, with associated 2D and 3D cameras

Fields

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.

Methods

impl Viewport
[src]

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
});

Also initializes self.camera3d with position and orientation

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
});

Auto Trait Implementations

impl Send for Viewport

impl Sync for Viewport