GM/PreRender

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Added gl_clear)
(Note about example)
 
Line 10: Line 10:
 
}}
 
}}
 
{{Example
 
{{Example
|Description=Fills the draw buffer with black pixels, removing tearing when looking at a world leak. Achieves the same effect as using gl_clear.
+
|Description=Fills the draw buffer with black pixels, removing tearing when looking at a world leak. Achieves the same effect as using gl_clear. This is no longer needed as GMod does this by default.
 
|Code=hook.Add("PreRender", "ResetBuffer", function()
 
|Code=hook.Add("PreRender", "ResetBuffer", function()
 
cam.Start2D()
 
cam.Start2D()

Latest revision as of 13:26, 9 December 2019

 GM:PreRender( )

Contents

Description

Called before the renderer is about to start rendering the next frame.

Returns

boolean

Return true to prevent all rendering. This can make the whole game stop rendering anything.

Examples

Example

Fills the draw buffer with black pixels, removing tearing when looking at a world leak. Achieves the same effect as using gl_clear. This is no longer needed as GMod does this by default.

hook.Add("PreRender", "ResetBuffer", function()
	cam.Start2D()
		surface.SetDrawColor(0, 0, 0, 255)
		surface.DrawRect(0, 0, ScrW(), ScrH())
	cam.End2D()
end)


Personal tools
Navigation