Garry's Mod Wiki

render.EnableClipping

boolean render.EnableClipping( boolean state )

Description

Sets the status of the clip renderer, returning previous state.

To prevent unintended rendering behavior of other mods/the game, you must reset the clipping state to its previous value.
Reloading the map does not reset the previous value of this function.

Issue Tracker: 3105

Arguments

1 boolean state
New clipping state.

Returns

1 boolean
Previous clipping state.

Example

Properly using the function.

-- Inside some rendering hook local oldclip = render.EnableClipping( true ) -- Your code here render.EnableClipping( oldclip )

Example

Clips the lower half of your custom entity

function ENT:Draw() local normal = self:GetUp() -- Everything "behind" this normal will be clipped local position = normal:Dot( self:GetPos() ) -- self:GetPos() is the origin of the clipping plane local oldEC = render.EnableClipping( true ) render.PushCustomClipPlane( normal, position ) self:DrawModel() render.PopCustomClipPlane() render.EnableClipping( oldEC ) end

Page Links


Special Pages


Wikis

?

Render Time: 41ms

DB GetPage 4
Generate Html 4
SaveChanges (1) 11
Render Body 0
Render Sidebar 20