libGDX:将TextureRegion转换为纹理

libGDX:将TextureRegion转换为纹理,libgdx,textures,texturepacker,Libgdx,Textures,Texturepacker,如何使用我的龙作为纹理 atlas = new TextureAtlas("myPack.atlas"); dragon = dragon.findRegion("dragon"); // returns TextureRegion 从TextureRegion创建Texture完全没有意义 您的纹理区域具有纹理的矩形点,因此您可以将特定纹理写入pixmap,然后从该pixmap创建纹理 TextureAtlas.TextureAtlasData.Region dragon = atlas

如何使用我的龙作为纹理

atlas = new TextureAtlas("myPack.atlas"); 
dragon = dragon.findRegion("dragon"); // returns TextureRegion

TextureRegion
创建
Texture
完全没有意义


您的
纹理区域
具有纹理的矩形点,因此您可以将特定纹理写入pixmap,然后从该
pixmap
创建
纹理

TextureAtlas.TextureAtlasData.Region dragon = atlas.getRegion("dragon");
Pixmap pixmap = new Pixmap(dragon.width, dragon.height, Pixmap.Format.RGBA8888);
FileHandle pngFile = dragon.page.textureFile;

Pixmap completePix = new Pixmap(pngFile);
pixmap.drawPixmap(completePix, 0, 0, dragon.left, dragon.top, dragon.width, dragon.height);

Texture dragonTex=new Texture(pixmap);
atlas.findRegion(“龙”)