Problem with MaskImage

Blitz3D Forums/Blitz3D Beginners Area/Problem with MaskImage

Chad(Posted 2006) [#1]
What appears to be wrong with this code? I want the purple color to be transparent, so I hope I'm doing this right.

tree=loadmesh("tree.b3d")
treetex=loadmesh("trest.png")
entitytexture tree,treetex
maskimage treetex,255,0,255
positionentitytree,0,0,0


I get a Memory Access Violation and the media is there. Thanks,
Chad


Wayne(Posted 2006) [#2]
Yeah but you used loadmesh twice instead of loadmesh, then loadtexture. Like this:

tree=loadmesh("tree.b3d")
treetex=loadtexture("trest.png")
entitytexture tree,treetex
maskimage treetex,255,0,255
positionentitytree,0,0,0


Matty(Posted 2006) [#3]
Maskimage only works with 2d images, not textures. The mask for a texture is black (rgb 0,0,0). In the code archives is a method for changing the mask color of a texture:

http://www.blitzbasic.com/codearcs/codearcs.php?code=1013