Any particular reason why this isn't working as expected? It's suppose to be a white line from the top left corner; down to the bottom right.
[code]local rt = GetRenderTarget( "test", 64, 64, false );
local mat = CreateMaterial( "test", "UnlitGeneric", {
["$ignorez"] = 1,
["$vertexcolor"] = 1,
["$vertexalpha"] = 1,
["$nolod"] = 1,
["$basetexture"] = rt:GetName()
});
local last = render.GetRenderTarget();
render.SetRenderTarget( rt );
render.SetViewPort( 0, 0, 64, 64 );
render.Clear( 0, 0, 0, 255 );
render.ClearDepth();
surface.SetDrawColor( Color( 255, 255, 255 ) );
surface.DrawLine( 0, 0, 64, 64 );
render.SetRenderTarget( last );
render.SetViewPort( 0, 0, ScrW(), ScrH() );
hook.Add( "HUDPaint", "Test", function()
surface.SetDrawColor( color_white );
surface.SetMaterial( mat );
surface.DrawTexturedRect( 128, 128, 256, 256 );
end );[/code]
[t]http://i.troll.ws/8d1762a4.png[/t]
Try wrapping the drawing code in cam.Start2D() and cam.End2D()
[QUOTE=Donkie;43488130]Try wrapping the drawing code in cam.Start2D() and cam.End2D()[/QUOTE]
Worked perfectly.
[t]http://puu.sh/6gcOr/d3efa6824a.png[/t]
Please accept your payment in lucky screwdriver.
[img]http://puu.sh/6gd0e/031007d0da.png[/img]
Sorry, you need to Log In to post a reply to this thread.