problem with surface.SetTexture()

Hello Facepunch.

so this is my problem, stars dosen’t render correctly

http://bizen.dk/starfuck.jpg

Lua Code:

[lua]
local texture = surface.GetTextureID(“wantedmod/xmas”)
local function DrawStars()
for i=1,26 do
surface.SetTexture(texture)
surface.SetDrawColor(255,255,255,255)
surface.DrawTexturedRect((i*34),ScrH()*0.5-32,32,32)
end
end
[/lua]

VMT Code:



"LightmappedGeneric"
{
	"$basetexture" "star"
	"$decal" 1
 	"$decalscale" 0.25
  	"$translucent" 1
}



ask if you need anymore infomation about this, Thanks :slight_smile:

I am not sure if this would help but have you tried to convert them in .png and use them as Materials not as Textures.

That ain’t working :confused:

Looks like it’s trying to light the material, use the “UnlitGeneric” shader, also use Materials via surface.SetMaterial instead, texture IDs sometimes fuck up.

did you mean it like this, beacuse it ain’t working :frowning:

[lua]
local material = Material(“wantedmod/xmas”)
local function DrawStars()
for i=1,26 do
surface.SetDrawColor(255,255,255,255)
surface.SetMaterial(material)
surface.DrawTexturedRect((i*34),ScrH()*0.5-32,32,32)
end
end
hook.Add(“HUDPaint”,“draw stars”,DrawStars)
[/lua]

VMT



"LightmappedGeneric"
{
	"$basetexture" "wantedmod/xmas"
	"$decal" 1
 	"$decalscale" 0.25
  	"$translucent" 1
	"$UnlitGeneric" 1
}


Correct VMT:



"UnlitGeneric"
{
	"$basetexture" "wantedmod/xmas"
	"$vertexcolor" 		1
	"$vertexalpha" 		1
	"$nolod" 		1
	"$nocull"		1
}

Thank you, it’s working perfectly now!!! :smiley: <3