render.CapturePixels
From GMod Wiki
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: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Render.CapturePixels]Render.CapturePixels [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. |
Additional Notes
- This doesn't return anything. To get a pixel at a given coordinate use render.ReadPixel.