Render.ReadPixels
From GMod Wiki
| This 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: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Render.ReadPixels]Render.ReadPixels [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
| Description | A simple pixelate shader by garry. |
|---|---|
| Used on | |
| 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 |
| Output | A pixelated image like this one. |