render.CapturePixels

From GMod Wiki

Jump to: navigation, search
Function
Syntax render.CapturePixels( )
Where is this used?
Description:
Captures the pixels so that they can be fetched with render.ReadPixel.
Returns: nil
Part of Library: render
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Render.CapturePixels]Render.CapturePixels [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionA simple pixelate shader by garry.
Used onNewerClient.png
Code
 
render.CapturePixels()
 
local y = 100
local spacing = 6
 
for x=0, ScrW(), spacing do
for y=0, ScrH(), spacing do
 
    local r, g, b = render.ReadPixel( x, y )
 
    surface.SetDrawColor( r, g, b, 255 )
    surface.DrawRect( x-spacing*0.5, y-spacing*0.5, spacing, spacing )
 
end
end 
OutputA pixelated image like this one.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox