render.Fog* - how to?

Hi. I need to use a fog in my gamemode, but this code:



function fog()
	render.FogStart(50)
	render.FogEnd(500)
	render.FogMode(MATERIAL_FOG_LINEAR)
	render.FogMaxDensity(1000)
	render.FogColor(255,255,255)
end
hook.Add("Think", "FogTest", fog)


Does not works. I need a example of proper code.