I know there have been recent threads talking about this, but it's still an apparent problem. I don't want to do a cheap hax fix just to create a material with a transparent background..
Alpha: 255
[t]http://puu.sh/6gJ5L/c6bece12b4.png[/t]
Alpha: 127
[t]http://puu.sh/6gJ7m/5d0ee302e4.png[/t]
Line 27:
[code]local TEXTURE_FLAGS_CLAMP_S = 0x0004;
local TEXTURE_FLAGS_CLAMP_T = 0x0008;
local rt = GetRenderTarget( "test", 64, 64,
RT_SIZE_NO_CHANGE,
MATERIAL_RT_DEPTH_SEPARATE,
bit.bor(TEXTURE_FLAGS_CLAMP_S, TEXTURE_FLAGS_CLAMP_T),
CREATERENDERTARGETFLAGS_UNFILTERABLE_OK,
IMAGE_FORMAT_RGBA8888
);
local mat = CreateMaterial( "test", "UnlitGeneric", {
["$ignorez"] = 1,
["$vertexcolor"] = 1,
["$vertexalpha"] = 1,
["$nolod"] = 1,
["$basetexture"] = rt:GetName()
});
local last = render.GetRenderTarget();
render.SetViewPort( 0, 0, 64, 64 );
render.SetRenderTarget( rt );
-- If this is 0, the entire texture is blank.
-- If it's 127, the entire texture is half opaque. (Undesired)
render.Clear( 0, 0, 0, 127, true, true );
cam.Start2D();
surface.SetDrawColor( color_white );
surface.SetMaterial( Material( "icon16/accept.png" ) );
surface.DrawTexturedRect( 0, 0, 64, 64 );
cam.End2D();
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, 64, 64 );
end );[/code]
It's a very huge problem still, please fix it!
I made a few threads like 4 months ago but nobody bothered to fix it.
[URL]http://facepunch.com/showthread.php?t=1276498[/URL]
i love u garry pls fix
Sorry, you need to Log In to post a reply to this thread.