I'm trying to do a Render Target scope for my weapon and every time I pull it out, it crashes the game.
Here is the code:
[lua] local matScreen = Material( "hunter/myplastic" )
local RTTexture = GetRenderTarget( "ScopeTest2", 256, 256 )
function SWEP:DrawHUD()
local NewRT = RTTexture
local oldW = ScrW()
local oldH = ScrH()
matScreen:SetMaterialTexture( "$basetexture", NewRT )
local OldRT = render.GetRenderTarget();
render.SetRenderTarget( NewRT )
render.SetViewPort( 0, 0, 256, 256 )
local pos = {}
pos.angles = LocalPlayer():EyeAngles()
pos.origin =LocalPlayer():GetShootPos()
pos.x = 0
pos.y = 0
pos.w = 256
pos.h = 256
pos.drawviewmodel = false
pos.fov = 5
render.RenderView( pos )
render.SetRenderTarget( OldRT )
render.SetViewPort( 0, 0, oldW, oldH )
end[/lua]
Anyone?
Sorry, you need to Log In to post a reply to this thread.