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.
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 );