surface.SetTexture can't find my texture

Hello!
I just started with LUA, and I’m trying to make a nice toolbar.
But I can’t load a texture?

Screenie:

Code:



     local money = surface.GetTextureID("VGUI/money")    
     surface.SetTexture( money )  
     surface.SetDrawColor ( 255, 255, 255, 255 )  
     surface.DrawTexturedRect( ScrW()-85, ScrH()-85, 85, 95 )  


GMod is searching in the correct folder, because I tested it too with another texture and it worked fine.

This is my home made texture I want to load in:

It’s 128x128 made with PhotoShop and exported to VTF + VMT with VTFEdit.
Can anybody tell me what I’m doing wrong?

Thanks in advance,
ZaroX.

Are you sure the texture even exists? If you are, are you sending it to your clients?

Yes it exists.
What do you mean with sending to clients? Do I’ve to put the texture at init.lua?

My code above is located at cl_init.lua

VMF or VMT?

Both of them, created with VTFEdit.

I assume you mean VTF and VMT; if so, please post your VMT code.

I’ve got a VMT and a VTF file.

Code from VMT:



"LightmappedGeneric"
{
	"$basetexture" "vgui/money"
	"$translucent" 1
}


Edited.

A VMF file is a “Valve Map File”; you need a VMT file (Valve Material Type).

Rename your VMF file to “money.vmt” and you should be fine.

Oh sorry, my mistake.
I tought that: “VMF” was a abbreviation for “Valve Material File”.

So I’ve edited my post above.

Okay, I feel very silly now… -_- I had to restart my Garry’s Mod window before I could see something change.

Screens:

Two problems left: Sometimes when I move the camera the texture becomes totally black. The other problem: the white part of the texture won’t be transperant.

Thats probably a texture / material problem (VMT). Not really my area of expertise.

Use UnlitGeneric instead of LightmappedGeneric in the VMT.

I tried it, but it doesn’t work.
A screenshot from my settings:

Should I change it?



"UnlitGeneric"
{
	"$basetexture" "vgui/money"
	"$nolod" 1
	"$translucent" 1
	"$vertexalpha" 1
	"$vertexcolor" 1
}


Try that, same settings I use for all my textures, just paste that over your original VMT code.

It’s not blinking between white and black anymore, but it’s still don’t have a transparent background. =[

Finaly it works!

I loaded a .PNG in VTFEdit in stead of a TGA/BMP which every tutorial recommend me. After that I used these settings:

Screen:

Last problem: the quality is shitty :\

EDIT: Oh never mind, it’s blinking again… I’m going to make a new topic at the correct subforum.

Post the exact png you want to use.

I PM’d you the .PNG, I don’t want people who’re using my PNG.

You have to send it to the client on join anyway…

People will only copy what is worth copying, which is her clearly not the case :pseudo: