Garry's Mod Wiki

Garry's Mod Wiki

  render.SetViewPort( number x, number y, number w, number h )

Description

Changes the view port position and size. The values will be clamped to the game's screen resolution.

If you are looking to render something to a texture (render target), you should use render.PushRenderTarget.

This function will override values of ScrW and ScrH with the ones you set.

Arguments

1 number x
X origin of the view port.
2 number y
Y origin of the view port.
3 number w
Width of the view port.
4 number h
Height of the view port.

Example

Renders a screen with a dimension of 32 X 32 and resets the render system to normal.

local oldW, oldH = ScrW(), ScrH() render.PushRenderTarget( RTName ) render.Clear( 0, 0, 0, 255 ) render.SetViewPort( 0, 0, 32, 32 ) render.RenderView( CamData ) render.SetViewPort( 0, 0, oldW, oldH ) render.PopRenderTarget()

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...