Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Mesh:setTexture and TextureRegion — Gideros Forum

Mesh:setTexture and TextureRegion

romkaromka Member
edited February 2014 in General questions
Hi, Everyone!

When I use following code it works ok:
local mesh_texture = Texture.new("some-name.png", true, {wrap = Texture.REPEAT})
 
local mesh = Mesh.new() 
mesh:setTexture(mesh_texture)
But when I'd tried to replace Texture with TextureRegion:
local textures = TexturePack.new('tex.txt', 'tex.png')
local mesh_texture = textures:getTextureRegion('some-name.png')
 
local mesh = Mesh.new() 
mesh:setTexture(mesh_texture)
I got error message "bad argument #1 to 'setTexture' (TextureBase expected, got table)" (tex.txt contains line with item some-name.png). How should I pass TextureRegion object to the setTexture() method? I tried to do something like this:
local mesh_texture = Texture.new(textures:getTextureRegion('some-name.png'))
but this code doesn't work also.

Comments

Sign In or Register to comment.