Garry's Mod Wiki


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


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.


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.


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

local oldW, oldH = ScrW(), ScrH() local oldRT = render.GetRenderTarget() render.SetRenderTarget(RTName) render.Clear(0,0,0,255) render.SetViewPort(0,0,32,32) render.RenderView(CamData) render.SetRenderTarget(oldRT) render.SetViewPort(0,0,oldW,oldH)

Page Links

Special Pages



Render Time: 41ms

DB GetPage 4
Generate Html 13
SaveChanges (1) 9
Render Body 0
Render Sidebar 12