GM:PostDraw2DSkyBox

From Garry's Mod
Jump to: navigation, search
 GM:PostDraw2DSkyBox( )

Description

Called right after the 2D skybox has been drawn - allowing you to draw over it.

NOTE This is a rendering hook with a 3D rendering context.
This means that the only rendering functions will work in it are functions with a 3D rendering context.

Examples

Example

Draw a textured quad on the horizon, behind the 3D skybox.

local Mat = Material( "dev/graygrid" )

hook.Add("PostDraw2DSkyBox", "ExampleHook", function()
    
    render.OverrideDepthEnable( true, false ) -- ignore Z to prevent drawing over 3D skybox

    -- Start 3D cam centered at the origin
    cam.Start3D( Vector( 0, 0, 0 ), EyeAngles() )
        render.SetMaterial( Mat )
        render.DrawQuadEasy( Vector(1,0,0) * 200, Vector(-1,0,0), 64, 64, Color(255,255,255), 0 )
    cam.End3D()

    render.OverrideDepthEnable( false, false )

end)


Personal tools
Navigation