set_viewport


Description:

public void set_viewport (float x, float y, float width, float height)

Defines a scale and offset for everything rendered relative to the top-left of the destination framebuffer.

By default the viewport has an origin of (0,0) and width and height that match the framebuffer's size. Assuming a default projection and modelview matrix then you could translate the contents of a window down and right by leaving the viewport size unchanged by moving the offset to (10,10). The viewport coordinates are measured in pixels. If you left the x and y origin as (0,0) you could scale the windows contents down by specify and width and height that's half the real size of the framebuffer.

<note>Although the function takes floating point arguments, existing drivers only allow the use of integer values. In the future floating point values will be exposed via a checkable feature.</note>

Parameters:

this

A Framebuffer

x

The top-left x coordinate of the viewport origin (only integers supported currently)

y

The top-left y coordinate of the viewport origin (only integers supported currently)

width

The width of the viewport (only integers supported currently)

height

The height of the viewport (only integers supported currently)