Garry's Mod Wiki

Revision Difference

IMesh:Draw#527718

<function name="Draw" parent="IMesh" type="classfunc"> <description>Renders the mesh with the active matrix.</description> <realm>Client</realm> </function> ⤶ <bug>If called inside <page>ENTITY:Draw</page>. You need to draw the entity's model before drawing the mesh, for lighting to work properly.</bug>⤶ <example> <description> Properly renders the mesh using the SENT's model matrix. `self.Mesh` in this case is the <page>IMesh</page>. </description> <code> local myMaterial = Material( "models/wireframe" ) -- models/debug/debugwhite function ENT:Draw() if ( self.Mesh ) then render.SetMaterial( myMaterial ) cam.PushModelMatrix( self:GetWorldTransformMatrix() ) self.Mesh:Draw() cam.PopModelMatrix() end -- Other code end </code> </example>