Created
December 5, 2015 21:23
-
-
Save thelastpenguin/c0375f62bf73bace49f5 to your computer and use it in GitHub Desktop.
Example of a working gmod render target
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local texture = GetRenderTarget('uniquert'..os.time(), 512, 100, false) | |
local mat = CreateMaterial("uniquemat"..os.time(),"UnlitGeneric",{ | |
['$basetexture'] = texture, | |
}); | |
hook.Add('HUDPaint', 'sao', function() | |
local scrw, scrh = ScrW(), ScrH() | |
-- this is a perfect render target dealio. | |
render.PushRenderTarget(texture) | |
cam.Start2D() | |
render.OverrideAlphaWriteEnable(true, true) | |
cam.End2D() | |
render.PopRenderTarget() | |
mat:SetTexture('$basetexture', texture) | |
surface.SetDrawColor(255,255,255) | |
surface.SetMaterial(mat) | |
surface.DrawTexturedRect(0, 0, 512 , 100) | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't understand how to use this. Where are you giving it any origin or angle with which to use the RT?