render.DrawWireframeSphere

From Garry's Mod
Jump to: navigation, search
 render.DrawWireframeSphere( )

Contents

Description

Draws a wireframe sphere in 3d space.

NOTE

This is a rendering function that requires a 3D rendering context.
This means that it will only work in hooks with a 3D rendering context.

Arguments

Vector position

Position of the sphere.

Arguments

number radius

The size of the sphere.

Arguments

number longitudeSteps

The amount of longitude steps.

The larger this number is, the smoother the sphere is.

Arguments

number latitudeSteps

The amount of latitude steps.

The larger this number is, the smoother the sphere is.

Arguments

table color=Color( 255, 255, 255 )

The color of the wireframe. Uses the Color structure.

Arguments

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.

Examples

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 )


Personal tools
Navigation