Thread Tools Display Modes
08-30-12, 12:39 PM   #1
Spawnova
A Warpwood Thunder Caller
 
Spawnova's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2012
Posts: 96
SetTexture problem

I'm trying to display an image when a certain buff is active and everything works except i always get a green box instead of the image
here my code:

Code:
local frame = CreateFrame("Frame")
local texture = frame:CreateTexture()
frame:SetPoint("CENTER",0,-80)
frame:SetWidth(128)
frame:SetHeight(24)
texture:SetAllPoints(frame)
texture:SetTexture("Interface\\Addons\\DSN\\DSN.tga")
frame:RegisterEvent("UNIT_AURA")
i've run out of ideas and googled it a bit but couldn't find the problem

EDIT:
Problem was my file size was incorrect

Last edited by Spawnova : 08-30-12 at 12:59 PM.
  Reply With Quote
08-30-12, 02:31 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
For future reference, a green box indicates one of two things:

(1) no file existed at the path you specified (or did not exist when WoW launched; if you add files after opening WoW you must completely exit and restart in order to have them detected),

or

(2) the file at the path you specified is not a valid WoW texture file.

On a side note, you don't need to include the file extension (".tga") in the path. It doesn't hurt anything, but it's not necessary either.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-30-12, 03:11 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,331
Originally Posted by Phanx View Post
On a side note, you don't need to include the file extension (".tga") in the path. It doesn't hurt anything, but it's not necessary either.
They may have fixed it, but starting with Cataclysm (4.0), if while working on an addon and you have a PNG source image and an exported TGA file with the same name, it'll try to load the PNG file even though WoW doesn't support it yet. If you don't have any other files with the same name (different extension) then adding the extension isn't necessary. Otherwise, if you do, it's an extra step to make sure WoW loads in the correct image.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
08-30-12, 03:29 PM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Make sure to reload WoW. Textures added while the game is running will not be recognized.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
08-30-12, 07:47 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by SDPhantom View Post
... if while working on an addon and you have a PNG source image and an exported TGA file with the same name, it'll try to load the PNG file even though WoW doesn't support it yet.
The Mac client supports PNG. Sounds like an oversight on Blizzard's part that the Windows client can even see PNG files... though I can't think of any reason why they wouldn't just add PNG support in the Windows client either.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SetTexture problem


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off