Garry's Mod Wiki

render.DrawWireframeSphere

  render.DrawWireframeSphere( Vector position, number radius, number longitudeSteps, number latitudeSteps, table color = Color( 255, 255, 255 ), boolean writeZ = false )

Description

Draws a wireframe sphere in 3d space.

This is a rendering function that requires a 3d rendering context.

This means that it will only work in 3d Rendering Hooks.

Arguments

1 Vector position
Position of the sphere.
2 number radius
The size of the sphere.
3 number longitudeSteps
The amount of longitude steps. The larger this number is, the smoother the sphere is.
4 number latitudeSteps
The amount of latitude steps. The larger this number is, the smoother the sphere is.
5 table color = Color( 255, 255, 255 )
The color of the wireframe. Uses the Color.
6 boolean writeZ = false
Whether or not to consider the Z buffer. If false, the wireframe will be drawn over everything currently drawn. If true, it will be drawn with depth considered, as if it were a regular object in 3D space.

Example

Draws a wireframe sphere over a normal sphere for an artistic effect.

hook.Add( "PostDrawTranslucentRenderables", "test", function() -- 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 local radius = 50 local wideSteps = 10 local tallSteps = 10 -- Draw the sphere! render.DrawSphere( pos, radius, wideSteps, tallSteps, Color( 0, 175, 175, 100 ) ) -- Draw the wireframe sphere! render.DrawWireframeSphere( pos, radius, wideSteps, tallSteps, Color( 255, 255, 255, 255 ) ) end )