CapsAdmin

Untitled

Oct 5th, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. local rt = util.RemoveOldObject(Texture(512, 512, FT_USAGE_RENDERTARGET))
  2.  
  3. -- this won't really do anything unless it's a normal texture
  4. --[[
  5. local img = rt:GetPixelTable(true)
  6.  
  7. for i = 0, rt:GetLength() do
  8.     img[i].r = i%255
  9.     img[i].g = (math.sin((i)/10000)*1000)%255
  10.     img[i].b = math.cos(i*255)%255
  11.     img[i].a = 90
  12. end
  13.  
  14. rt:SetPixelTable(img)]]
  15.  
  16. hook.Add("PostHUDUpdate", "rt_test", function()
  17.     -- start rt
  18.     --render.RenderBegin()         
  19.     render.SetRenderTarget(rt, SRF_USE_ORIG_DEPTHBUF)
  20.        
  21.         -- draw a rect onto the RT texture
  22.         graphics.DrawRect(Rect(0,0,10,10), Color(math.random(), math.random(), math.random(), 1))
  23.        
  24.     -- end rt
  25.     --render.EndFrame()
  26.     render.SetRenderTarget(nil, SRF_USE_ORIG_DEPTHBUF)
  27.    
  28.     -- draw the results following our mouse pos
  29.     local x,y = mouse.GetPos()
  30.     graphics.DrawTexture(rt, Rect(x,y,256,256), Color(1,1,1,1))
  31. end)
  32.  
  33. util.MonitorFileInclude()
Advertisement
Add Comment
Please, Sign In to add comment