Swapping Textures for shapebase
by Huimin Loi · in Torque Game Engine · 07/26/2010 (10:16 am) · 5 replies
Hi Guys
i'm trying to swap some textures for my shapebase using setOverrideTexture.
Everything's fine when there's no alpha involved. When using a png with alpha, the setOverrideTexture command does not seem to do anything...
I've also tried modifying the material list but not having much success there.. maybe i'm not doing it right.
anyone know of a solution or workaround?
any help will be greatly appreciated
Huimin
i'm trying to swap some textures for my shapebase using setOverrideTexture.
Everything's fine when there's no alpha involved. When using a png with alpha, the setOverrideTexture command does not seem to do anything...
I've also tried modifying the material list but not having much success there.. maybe i'm not doing it right.
anyone know of a solution or workaround?
any help will be greatly appreciated
Huimin
#2
not re-implementing skin name
my game requires me to have a bunch of floating runes made using a png file with alpha. the alphaed rune loads fine when i start the game up.
but when i try to use the setOverrideTexture function in shapebase.cc nothing seems to happen. If the png that i use does not contains alpha, i am able use setoverridetexture to swap the texture.
was suspecting its something to do with the material settings... but i'm a noob at this...
07/29/2010 (2:57 am)
thanks for ur reply. not re-implementing skin name
my game requires me to have a bunch of floating runes made using a png file with alpha. the alphaed rune loads fine when i start the game up.
but when i try to use the setOverrideTexture function in shapebase.cc nothing seems to happen. If the png that i use does not contains alpha, i am able use setoverridetexture to swap the texture.
was suspecting its something to do with the material settings... but i'm a noob at this...
#3
Using setOverrideTexture completely overrides all materials in the material list. It also has some hard coded texture functions when used. I also have a feeling that when you use setOverrideTexture TSMesh::setMaterial does not enable blending but I haven't tested that. If you're using the same texture just with an alpha channel that would explain why it appears to be doing nothing when in fact it is swapping textures just not enabling blending.
07/29/2010 (3:18 am)
I guess what I was trying to do was understand why you're using setOverrideTexture to swap textures. If you're trying to swap textures on a shapebase object use setSkinName because it updates the material list. Or create a function like it that updates the material list.Using setOverrideTexture completely overrides all materials in the material list. It also has some hard coded texture functions when used. I also have a feeling that when you use setOverrideTexture TSMesh::setMaterial does not enable blending but I haven't tested that. If you're using the same texture just with an alpha channel that would explain why it appears to be doing nothing when in fact it is swapping textures just not enabling blending.
#4
07/29/2010 (4:00 am)
If you do want to force it though you can use setAlphaAlways with a value less than 0.99 and it might enable blending for you but your texture will be very slightly transparent.
#5
http://www.torquepowered.com/community/resources/view/14366
which allowed me to swap the textures with the alpha!
thanks!
07/29/2010 (9:07 am)
i took a look at setskinname and found some resource at http://www.torquepowered.com/community/resources/view/14366
which allowed me to swap the textures with the alpha!
thanks!
Torque Owner Wes Macdonald