use of com.badlogic.gdx.graphics.TextureData in project libgdx by libgdx.
the class FileTextureArrayData method consumeTextureArrayData.
@Override
public void consumeTextureArrayData() {
for (int i = 0; i < textureDatas.length; i++) {
if (textureDatas[i].getType() == TextureData.TextureDataType.Custom) {
textureDatas[i].consumeCustomData(GL30.GL_TEXTURE_2D_ARRAY);
} else {
TextureData texData = textureDatas[i];
Pixmap pixmap = texData.consumePixmap();
boolean disposePixmap = texData.disposePixmap();
if (texData.getFormat() != pixmap.getFormat()) {
Pixmap temp = new Pixmap(pixmap.getWidth(), pixmap.getHeight(), texData.getFormat());
temp.setBlending(Pixmap.Blending.None);
temp.drawPixmap(pixmap, 0, 0, 0, 0, pixmap.getWidth(), pixmap.getHeight());
if (texData.disposePixmap()) {
pixmap.dispose();
}
pixmap = temp;
disposePixmap = true;
}
Gdx.gl30.glTexSubImage3D(GL30.GL_TEXTURE_2D_ARRAY, 0, 0, 0, i, pixmap.getWidth(), pixmap.getHeight(), 1, pixmap.getGLInternalFormat(), pixmap.getGLType(), pixmap.getPixels());
if (disposePixmap)
pixmap.dispose();
}
}
}
use of com.badlogic.gdx.graphics.TextureData in project libgdx by libgdx.
the class FileTextureArrayData method prepare.
@Override
public void prepare() {
int width = -1;
int height = -1;
for (TextureData data : textureDatas) {
data.prepare();
if (width == -1) {
width = data.getWidth();
height = data.getHeight();
continue;
}
if (width != data.getWidth() || height != data.getHeight()) {
throw new GdxRuntimeException("Error whilst preparing TextureArray: TextureArray Textures must have equal dimensions.");
}
}
prepared = true;
}
use of com.badlogic.gdx.graphics.TextureData in project commons-gdx by gemserk.
the class GpuMemUtils method getFilePath.
private static String getFilePath(Texture texture) {
String path = null;
TextureData textureData = texture.getTextureData();
if (textureData instanceof FileTextureData) {
FileTextureData fileTextureData = (FileTextureData) textureData;
path = fileTextureData.getFileHandle().path();
}
return path;
}
Aggregations