Garry's Mod Wiki

cam.Start2D

cam.Start2D()

Description

Sets up a new 2D rendering context. Must be finished by cam.End2D.

This is almost always used with a render target from the render. To set its position use render.SetViewPort with a target already stored.

This will put an identity matrix at the top of the model matrix stack. If you are trying to use cam.PushModelMatrix, call it after this function and not before.

<rendercontext hook="false" type="2D"/>

Example

Sets the viewport then draws on the view with 2d methods

local oldW, oldH = ScrW(), ScrH() render.SetViewPort( 0, 100, 50, 50 ) cam.Start2D() surface.SetDrawColor( 255, 255, 255 ) surface.DrawLine( 10, 10, 100, 100 ) cam.End2D() render.SetViewPort( 0, 0, oldW, oldH )

Page Links


Special Pages


Wikis

?

Render Time: 28ms

Session 0
DB GetPage 2
Generate Html 4
SaveChanges 8
Render Body 0
Render Sidebar 11