Garry's Mod Wiki

GM:PostDrawTranslucentRenderables

GM:PostDrawTranslucentRenderables( boolean bDrawingDepth, boolean bDrawingSkybox )

Description

Called after all translucent entities are drawn.

See also GM:PostDrawOpaqueRenderables and GM:PreDrawTranslucentRenderables.

This is a rendering hook which provides a 3d rendering context.
This is still called when r_drawentities or r_drawopaquerenderables is disabled.

Issue Tracker: 3295
This is not called when r_drawtranslucentworld is disabled.

Issue Tracker: 3296

Arguments

1 boolean bDrawingDepth
Whether the current call is writing depth.
2 boolean bDrawingSkybox
Whether the current call is drawing skybox.

Example

Draws a solid black sphere at where the player is looking at, but not when the skybox is being drawn.

You can see why this is needed if you disable the skybox check and look into the sky on gm_flatgrass (or any other map where the 3d skybox is below the map) and you will notice 2 spheres and not 1.

hook.Add( "PostDrawTranslucentRenderables", "test", function( bDepth, bSkybox ) -- If we are drawing in the skybox, bail if ( bSkybox ) then return end -- Set the draw material to solid white render.SetColorMaterial() -- The position to render the sphere at, in this case, the looking position of the local player local pos = LocalPlayer():GetEyeTrace().HitPos -- Draw the sphere! render.DrawSphere( pos, 500, 30, 30, Color( 0, 0, 0 ) ) end )

Page Links


Special Pages


Wikis

?

Render Time: 33ms

DB GetPage 3
Generate Html 5
SaveChanges (1) 10
Render Body 0
Render Sidebar 11