Render.ReadPixels

From GMod Wiki

Jump to: navigation, search
Stub.pngThis article is a stub.
You can help the GMod Wiki by expanding it.


Function
Syntax render.ReadPixel( Number x, Number y )
Where is this used?
Description:
Returns the colour of a pixel.
Returns: Integer r, Integer g, Integer b
Part of Library: render
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Render.ReadPixels]Render.ReadPixels [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.


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox