Custom Textures (VGUI, Huds, Derma menu skins - etc)
4 replies, posted
Lastnight I spent like 3 hours looking up tutorials, changing settings, trying different things, comparing my vmt's to others, etc and I couldn't get it to work. I'm trying to make my own textures/materials to draw on your screen (like hud, or draw on a derma menu)
And I couldn't get it to work. I'm using an in-game file browser and the vmt/vtf is the same size and looks the same.
[img_thumb] http://i54.tinypic.com/2r22ey1.png [/img_thumb]
Can someone help me, or point me to a place where I can find out how to convert image files for use in drawing things clientside? (Not like, materials/textures for putting on a wall in hammer for example.)
[i] PS I got photoshop and VTFedit [/i]
post vmt file and folder structure please.
[editline]27th February 2011[/editline]
Oh and the code.
Alright. Give me a sec.
edit: [url]http://www.mediafire.com/?9jt8n9bjb8r081k[/url]
code:
[lua]
local SKIN = {}
function SKIN:DrawGenericBackground( x, y, w, h, color )
surface.SetDrawColor( 10, 10, 233, 100 )
surface.DrawRect( x, y, w, h )
surface.SetDrawColor( 2, 2, 2, 200 )
surface.DrawOutlinedRect( x, y, w, h )
if LocalPlayer():GetNWFloat("class")=="Recon" then tex = surface.GetTextureID("test_gamemode/test_material_class_01.vtf") -- this doesn't.
else tex=surface.GetTextureID("vgui/class_portraits/all_class.vmt") end --This code works, (mat from tf2.)
surface.SetTexture(tex)
surface.SetDrawColor(255,255,255,255)
surface.DrawTexturedRect(x,y,w,h)
end
derma.DefineSkin( "skin", "*insert generic skin description here?*", SKIN )
[/lua]
Not sure if it's your problem, but [b][url=http://wiki.garrysmod.com/?title=Surface.GetTextureID]Surface.GetTextureID [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] states that the file extension should not be included.
Quote from that wiki page:
Example:
A texture file is located at garrysmod/materials/custom/my_texture.vtf You would then use the following piece of code to retrieve it:
[lua]
surface.GetTextureID("custom/my_texture")[/lua]
hmm. But, the class_portraits/all_class work. Even with the extension.
edit: Yeah. I know :3. I think the problem is with settings or the actual image im making into the vtf+vmt.
Sorry, you need to Log In to post a reply to this thread.