Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - AeroShark333

Pages: 1 ... 7 8 [9] 10 11 ... 13
121
Support / Re: TextureInfo multi-texture question
« on: April 05, 2016, 12:08:08 am »
Ah I see...
Another thing, what is the maximum amount of texture layers that is supported by all OpenGL2.0 Android devices?
I hope it is higher than just one, two would be fine.
Apparently my device cannot support more than 3 texture stages on one Object3D while it's not an old phone really. (HTC Desire 826)
3 or more would give me this error: A/libc(21927): Fatal signal 11 (SIGSEGV), code 2

In the documentation it says TextureInfo.MAX_PHYSICAL_TEXTURE_STAGES is 4...
However, here http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Config.html#maxTextureLayers Config.maxTextureLayers is 2...
So why is that?
Is there a way to find out the maximum amount of texture layers?

122
Support / Re: TextureInfo multi-texture question
« on: April 04, 2016, 03:06:45 pm »
Ahhh, hmm interesting.
But it wouldn't be possible to rotate 2 texture stages when you have 3 stages in total, right?
Would it be possible to have a method like this: Object3D.setTextureMatrix(Matrix mat, int stage);

Nevermind this, I see how this can be done by using a shader

One thing I noticed, the default shader doesn't seem to apply lighting (and perhaps other things too) correctly (it doesn't at all?) to higher texture stages...
I won't really be using the default shaders anyway... but maybe it is worth mentioning it.
I guess I know what the problem is: the colors in the texturestages aren't processed with '* vertexColor'.

123
Support / TextureInfo multi-texture question
« on: April 04, 2016, 03:45:41 am »
Hello,

So I have a little problem...

Let's say I have an Object3D and I need to apply one texture with transparent parts on it.
Object3D.setTexture("textureName"); would apply the texture correctly.
The Object3D is a sphere.

But now I want to apply the same texture on a new texturelayer using TextureInfo.
Well okay, that works fine using TextureInfo.add(textureId, MODE);

But I would like to have the texture on stage 1 and I would like the same texture to have a rotation  (of let's say 90, 180 or 270 degrees) compared to the texture of stage 1 on stage 2.
The textures are squared (width=height) so a 90, 180, 270 degrees rotation should still give a squared texture...
If these rotations are possible, then I wonder if rotations like 30 degrees would work too...
And is it possible to 'translate' the texture for the new/second stage. So when you translate the texture with a certain amount of x, the texture will be shifted to the right (and what was on the right side will replace the 'empty' space  (caused by the translation) on the left)...
Sorry for the bad explanation, I can draw pictures to clarify it if needed...

Current solutions I have:
- I could also upload the rotated/translated texture and use that for the second stage... but the texture I use is rather big... I don't really want to waste memory if it is not needed... And I don't want OutOfMemoryError's obviously...
- (currently using this solution) I create another Object3D (and re-use the mesh of the original) and apply these 'texture rotations' I want by rotating the new Object3D in both the x-axis and the y-axis. And I can get these so called 'texture translations' by rotating the Object3D around the z-axis. Because both Object3D's are basically overlapping each other, it looks like one sphere. So okay, this solution seems fine but I noticed that using multiple texturelayers is much faster than having multiple Object3D's. The World.draw(FrameBuffer); method seems to execute faster when having one multitextured object instead of having multiple single-textured Object3D's.

Cheers,
Abiram

124
Bugs / Re: Textures and the virtualizer
« on: November 24, 2015, 12:29:52 am »
Hmm, I see. Thanks for the reply.

What will the Virtualizer do when the SD card is (almost) full?

125
Bugs / Re: Textures and the virtualizer
« on: November 18, 2015, 06:58:26 pm »
So... I have had two users of my app saying that their phone broke thanks to my application.
And I was utterly confused how that could happen.
My app barely uses any permission.

So the only thing I could think of that could have caused this, was the Virtualizer.
Is it possible? Since I think the Virtualizer is basically the same thing as swap.
And I do know that swap can degrade the lifetime of a sd-card.

My app is a live wallpaper.
Both users were using a Galaxy Y.

126
Bugs / Re: Textures and the virtualizer
« on: November 07, 2015, 09:07:53 pm »
I guess it was a mistake on my side...

This solved my problem:
Code: [Select]
if (textureManager.getVirtualizer() == null) {
final Virtualizer vz = new Virtualizer();
vz.setContext(getApplicationContext());
textureManager.setVirtualizer(vz);
System.out.println("New Virtualizer set!");
}else{
System.out.println("Virtualizer has already been set!");
}

127
Bugs / Textures and the virtualizer
« on: November 07, 2015, 08:06:37 pm »
Hello,

But when I virtualize textures, then the textures shown on my Object3Ds are just black sometimes.

I use the virtualizer for my live wallpaper.
And it seems that when the textures do load properly for the actual live wallpaper of the homescreen, it does not work for the live wallpaper preview/apply screen.
And when it does work for the live wallpaper preview/apply screen, it does not work for the actual live wallpaper.
This is not always the case... but it is hard to reproduce this...

Is there some conflict perhaps between two different activities/services trying to virtualize?

Can this be fixed or am I doing something wrong?

Cheers,
AeroShark333

128
Support / Re: Inversed lighting
« on: October 29, 2015, 02:20:30 am »
Thanks!
Code: [Select]
obj.getMesh().setVertexController(
new GenericVertexController() {

@Override
public void apply() {
for (int c = 0; c < this.getSourceNormals().length; c++) {
final SimpleVector temp = this
.getSourceNormals()[c];
temp.scalarMul(-1f);
this.getDestinationNormals()[c] = temp;
}
}

}, false);
obj.getMesh().applyVertexController();
obj.getMesh().removeVertexController();
worked.

129
Support / Inversed lighting
« on: October 26, 2015, 05:39:23 pm »
Hello,

Is it possible for an Object3D to have inversed lighting?
Basically the part that is lit by an light source becomes a shadow and the rest of the Object3D looks lit.

Cheers,
Abiram

130
Support / Re: Color bug
« on: October 20, 2015, 01:28:12 am »
Not sure, but could my EGLConfig be an issue?:
Code: [Select]
public class CustomEGLConfig implements EGLConfigChooser {
final private static int EGL_OPENGL_ES1_BIT = 0x01;
final private static int EGL_OPENGL_ES2_BIT = 0x04;

private static int[] mMinimumSpec2 = {
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,

EGL10.EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT,

EGL10.EGL_TRANSPARENT_TYPE, EGL10.EGL_NONE,

EGL10.EGL_NONE };
private static int[] mMinimumSpec1 = {
EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES1_BIT,

EGL10.EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT,

EGL10.EGL_TRANSPARENT_TYPE, EGL10.EGL_NONE,

EGL10.EGL_NONE };

private int[] mValue = new int[1];
protected int mAlphaSize;
protected int mBlueSize;
protected int mDepthSize;
protected int mGreenSize;
protected int mRedSize;
protected int mStencilSize;
protected boolean openGL2;

@SuppressWarnings("deprecation")
public CustomEGLConfig(int depth, int stencil, boolean useOpenGl2,
Display display) {
int pixelFormatVal;
try {
pixelFormatVal = display.getPixelFormat();
} catch (NullPointerException e) {
e.printStackTrace();
pixelFormatVal = PixelFormat.RGBA_8888;
}
final int aBits, rBits, gBits, bBits;

if (pixelFormatVal > 0) {

PixelFormat info = new PixelFormat();
PixelFormat.getPixelFormatInfo(pixelFormatVal, info);

if (PixelFormat.formatHasAlpha(pixelFormatVal)) {

if (info.bitsPerPixel >= 24) {
aBits = 8;
} else {
aBits = 6; // total guess
}

} else {
aBits = 0;
}

if (info.bitsPerPixel >= 24) {
rBits = 8;
gBits = 8;
bBits = 8;
} else if (info.bitsPerPixel >= 16) {
rBits = 5;
gBits = 6;
bBits = 5;
} else {
rBits = 4;
gBits = 4;
bBits = 4;
}

} else {
rBits = 8;
gBits = 8;
bBits = 8;
aBits = 8;
}

mRedSize = rBits;
mGreenSize = gBits;
mBlueSize = bBits;
mAlphaSize = aBits;

mDepthSize = depth;
mStencilSize = stencil;
openGL2 = useOpenGl2;
}

@Override
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
int[] arg = new int[1];
if (openGL2) {
egl.eglChooseConfig(display, mMinimumSpec2, null, 0, arg);
} else {
egl.eglChooseConfig(display, mMinimumSpec1, null, 0, arg);
}
int numConfigs = arg[0];

if (numConfigs <= 0) {
int[] attributes = new int[] { EGL10.EGL_DEPTH_SIZE, 16,
EGL10.EGL_NONE };
EGLConfig[] configs = new EGLConfig[1];
int[] result = new int[1];
egl.eglChooseConfig(display, attributes, configs, 1, result);
return configs[0];

}

EGLConfig[] configs = new EGLConfig[numConfigs];
if (openGL2) {
egl.eglChooseConfig(display, mMinimumSpec2, configs, numConfigs,
arg);
} else {
egl.eglChooseConfig(display, mMinimumSpec1, configs, numConfigs,
arg);
}

EGLConfig chosen = chooseConfig(egl, display, configs);

if (chosen == null) {
throw new RuntimeException(
"Could not find a matching configuration out of "
+ configs.length + " available.");
}

return chosen;
}

public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
EGLConfig[] configs) {
EGLConfig bestMatch = null;
int bestR = Integer.MAX_VALUE, bestG = Integer.MAX_VALUE, bestB = Integer.MAX_VALUE, bestA = Integer.MAX_VALUE, bestD = Integer.MAX_VALUE, bestS = Integer.MAX_VALUE;

for (EGLConfig config : configs) {
int r = findConfigAttrib(egl, display, config, EGL10.EGL_RED_SIZE,
0);
int g = findConfigAttrib(egl, display, config,
EGL10.EGL_GREEN_SIZE, 0);
int b = findConfigAttrib(egl, display, config, EGL10.EGL_BLUE_SIZE,
0);
int a = findConfigAttrib(egl, display, config,
EGL10.EGL_ALPHA_SIZE, 0);
int d = findConfigAttrib(egl, display, config,
EGL10.EGL_DEPTH_SIZE, 0);
int s = findConfigAttrib(egl, display, config,
EGL10.EGL_STENCIL_SIZE, 0);

if (r <= bestR && g <= bestG && b <= bestB && a <= bestA
&& d <= bestD && s <= bestS && r >= mRedSize
&& g >= mGreenSize && b >= mBlueSize && a >= mAlphaSize
&& d >= mDepthSize && s >= mStencilSize) {
bestR = r;
bestG = g;
bestB = b;
bestA = a;
bestD = d;
bestS = s;
bestMatch = config;
}
}

return bestMatch;
}

private int findConfigAttrib(EGL10 egl, EGLDisplay display,
EGLConfig config, int attribute, int defaultValue) {

if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) {
return mValue[0];
}

return defaultValue;
}
}

Called like:
Code: [Select]
gLView.setEGLConfigChooser(new CustomEGLConfig(16, 0, true, this
.getWindowManager().getDefaultDisplay()));
'this' -> Activity context

131
Support / Re: Color bug
« on: October 19, 2015, 10:53:40 pm »
This is another device with the same bug: http://www.phonearena.com/phones/Lenovo-Tab-S8-50_id8885
Again it is a device with Intel HD Graphics.

I assume the user does use the latest version of the application where I did give all Bitmaps a ARGB_8888 config.

132
Support / Re: Color bug
« on: October 04, 2015, 01:35:59 am »
I'm using the latest version of jPCT-AE.

Texture loading code:
Code: [Select]
         public void addOrReplaceTexture(final TextureManager textureManager,
final String textureName, final Texture texture) {
texture.setClamping(true);
texture.setFiltering(false);
texture.setMipmap(true);
if (textureManager.containsTexture(textureName)) {
textureManager.replaceTexture(textureName, texture);
} else {
textureManager.addTexture(textureName, texture);
}

}

@SuppressWarnings("deprecation")
public void loadTextures() {
System.gc();
toaster("Loading...", Toast.LENGTH_LONG);

com.threed.jpct.Config.unloadImmediately = false;

Texture.defaultTo4bpp(true);
// Texture.defaultToMipmapping(true);

final TextureManager textureManager = TextureManager.getInstance();

// For flipping the bitmap from left to right
final Matrix mHor = new Matrix();
mHor.preScale(-1, 1);
// For flipping the bitmap upside-down
final Matrix mVer = new Matrix();
mVer.preScale(1, -1);
// load background (moved down!)

Texture bg = null;

final Bitmap tempSkin = this.gLkinScaledBitmap(skin);

this.addOrReplaceTexture(
textureManager,
"snow",
new Texture(((BitmapDrawable) this.getResources().getDrawable(
R.drawable.snow)).getBitmap(), false));
this.addOrReplaceTexture(
textureManager,
"rain",
new Texture(((BitmapDrawable) this.getResources().getDrawable(
R.drawable.rain)).getBitmap(), false));

this.addOrReplaceTexture(
textureManager,
"hamburger",
new Texture(((BitmapDrawable) this.getResources().getDrawable(
R.drawable.hamburger)).getBitmap(), false));

// (tex, coordX, coordY, sizeX, sizeY)
if (hasOldSkinDimensions(tempSkin)) {
final int height = tempSkin.getHeight();
final int width = tempSkin.getWidth();

// HEAD
final Bitmap headFront1 = Bitmap.createBitmap(tempSkin, width / 8,
height / 4, width / 8, height / 4); // x,y,x,y (64,32,64,32)
final Bitmap headTop1 = Bitmap.createBitmap(tempSkin, width / 8, 0,
width / 8, height / 4);
final Bitmap headBack1 = Bitmap.createBitmap(tempSkin,
width / 8 * 3, height / 4, width / 8, height / 4);
final Bitmap headRight1 = Bitmap.createBitmap(tempSkin, 0,
height / 4, width / 8, height / 4, mHor, false);
final Bitmap headLeft1 = Bitmap.createBitmap(tempSkin, width / 4,
height / 4, width / 8, height / 4);
final Bitmap headBottom1 = Bitmap.createBitmap(tempSkin, width / 4,
0, width / 8, height / 4);

final Texture headFront2 = new Texture(headFront1, true);
final Texture headTop2 = new Texture(headTop1, true);
final Texture headBack2 = new Texture(headBack1, true);
final Texture headRight2 = new Texture(headRight1, true);
final Texture headLeft2 = new Texture(headLeft1, true);
final Texture headBottom2 = new Texture(headBottom1, true);

// HAT
final Bitmap hatFront1 = Bitmap.createBitmap(tempSkin,
width / 8 * 5, height / 4, width / 8, height / 4);
final Bitmap hatTop1 = Bitmap.createBitmap(tempSkin, width / 8 * 5,
0, width / 8, height / 4);
final Bitmap hatBack1 = Bitmap.createBitmap(tempSkin,
width / 8 * 7, height / 4, width / 8, height / 4);
final Bitmap hatRight1 = Bitmap.createBitmap(tempSkin, width / 2,
height / 4, width / 8, height / 4, mHor, false);
final Bitmap hatLeft1 = Bitmap.createBitmap(tempSkin,
width / 4 * 3, height / 4, width / 8, height / 4);
final Bitmap hatBottom1 = Bitmap.createBitmap(tempSkin,
width / 4 * 3, 0, width / 8, height / 4);

final Texture hatFront2 = new Texture(hatFront1, true);
final Texture hatTop2 = new Texture(hatTop1, true);
final Texture hatBack2 = new Texture(hatBack1, true);
final Texture hatRight2 = new Texture(hatRight1, true);
final Texture hatLeft2 = new Texture(hatLeft1, true);
final Texture hatBottom2 = new Texture(hatBottom1, true);

// BODY
final Bitmap bodyFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 5, height / 8 * 5,
width / 8, height / 8 * 3), 64, 64, false);
final Bitmap bodyTop1 = Bitmap.createBitmap(tempSkin,
width / 16 * 5, 16, width / 8, height / 4);
final Bitmap bodyBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 2, height / 8 * 5,
width / 8, height / 8 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 4, height / 8 * 5,
width / 16, height / 8 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 7, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap bodyBottom1 = Bitmap.createBitmap(tempSkin,
width / 16 * 7, height / 2, width / 8, height / 4);

final Texture bodyFront2 = new Texture(bodyFront1, true);
final Texture bodyTop2 = new Texture(bodyTop1, true);
final Texture bodyBack2 = new Texture(bodyBack1, true);
final Texture bodyRight2 = new Texture(bodyRight1, true);
final Texture bodyLeft2 = new Texture(bodyLeft1, true);
final Texture bodyBottom2 = new Texture(bodyBottom1, true);

// ARM
final Bitmap armFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 11, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap armTop1 = Bitmap.createBitmap(tempSkin,
width / 16 * 11, height / 2, width / 16, height / 8);
final Bitmap armBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 13, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap armRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 8 * 5, height / 8 * 5,
width / 16, height / 8 * 3, mHor, false), 64, 64,
false);
final Bitmap armLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 4 * 3, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap armBottom1 = Bitmap.createBitmap(tempSkin,
width / 4 * 3, height / 2, width / 16, height / 8);

final Texture armFront2 = new Texture(armFront1, true);
final Texture armTop2 = new Texture(armTop1, true);
final Texture armBack2 = new Texture(armBack1, true);
final Texture armRight2 = new Texture(armRight1, true);
final Texture armLeft2 = new Texture(armLeft1, true);
final Texture armBottom2 = new Texture(armBottom1, true);

// LEG
final Bitmap legFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap legTop1 = Bitmap.createBitmap(tempSkin, width / 16,
height / 2, width / 16, height / 8);
final Bitmap legBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, width / 16 * 3, height / 8 * 5,
width / 16, height / 8 * 3), 64, 64, false);
final Bitmap legRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, height / 8 * 5, width / 16,
height / 8 * 3, mHor, false), 64, 64, false);
final Bitmap legLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 8, height / 8 * 5, width / 16,
height / 8 * 3), 64, 64, false);
final Bitmap legBottom1 = Bitmap.createBitmap(tempSkin, width / 8,
height / 2, width / 16, height / 8);

final Texture legFront2 = new Texture(legFront1, true);
final Texture legTop2 = new Texture(legTop1, true);
final Texture legBack2 = new Texture(legBack1, true);
final Texture legRight2 = new Texture(legRight1, true);
final Texture legLeft2 = new Texture(legLeft1, true);
final Texture legBottom2 = new Texture(legBottom1, true);

final Bitmap rightLegFront1 = Bitmap.createBitmap(legFront1, 0, 0,
legFront1.getWidth(), legFront1.getHeight(), mHor, false);
final Texture leftLegFront2 = new Texture(rightLegFront1, true);

final Bitmap rightArmFront1 = Bitmap.createBitmap(armFront1, 0, 0,
legFront1.getWidth(), legFront1.getHeight(), mHor, false);
final Texture leftArmFront2 = new Texture(rightArmFront1, true);

final int maxDimension;
if (Build.VERSION.SDK_INT > 12) {
// Prevents OOM's
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
maxDimension = Math.max(size.x, size.y);
} else {
Display display = getWindowManager().getDefaultDisplay();
maxDimension = Math
.max(display.getWidth(), display.getHeight());
}

if (maxDimension <= 512) {
// minimum
bg = new Texture(Bitmap.createScaledBitmap(Bitmap.createBitmap(
background, 0, 0, background.getWidth(),
background.getHeight(), mVer, false), 256, 256, false));
} else if (maxDimension <= 1024) {
// default
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 512,
512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 256,
256, false));
}
} else if (maxDimension <= 1536) {
// big
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 1024,
1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
512, 512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
256, 256, false));
}

}
} else {
// maximum
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 2048,
2048, false));
} catch (final OutOfMemoryError e3) {
e3.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
1024, 1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 512, 512,
false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 256, 256,
false));
}

}
}
}

// BACKGROUND
addOrReplaceTexture(textureManager, "bg", bg);
// HEAD
addOrReplaceTexture(textureManager, "headfront", headFront2);
addOrReplaceTexture(textureManager, "headtop", headTop2);
addOrReplaceTexture(textureManager, "headback", headBack2);
addOrReplaceTexture(textureManager, "headright", headRight2);
addOrReplaceTexture(textureManager, "headleft", headLeft2);
addOrReplaceTexture(textureManager, "headbottom", headBottom2);
// HAT
addOrReplaceTexture(textureManager, "hatfront", hatFront2);
addOrReplaceTexture(textureManager, "hattop", hatTop2);
addOrReplaceTexture(textureManager, "hatback", hatBack2);
addOrReplaceTexture(textureManager, "hatright", hatRight2);
addOrReplaceTexture(textureManager, "hatleft", hatLeft2);
addOrReplaceTexture(textureManager, "hatbottom", hatBottom2);
// BODY
addOrReplaceTexture(textureManager, "bodyfront", bodyFront2);
addOrReplaceTexture(textureManager, "bodytop", bodyTop2);
addOrReplaceTexture(textureManager, "bodyback", bodyBack2);
addOrReplaceTexture(textureManager, "bodyright", bodyRight2);
addOrReplaceTexture(textureManager, "bodyleft", bodyLeft2);
addOrReplaceTexture(textureManager, "bodybottom", bodyBottom2);
// RIGHTARM
addOrReplaceTexture(textureManager, "outerrightarmfront", armFront2);
addOrReplaceTexture(textureManager, "outerrightarmtop", armTop2);
addOrReplaceTexture(textureManager, "outerrightarmback", armBack2);
addOrReplaceTexture(textureManager, "outerrightarmright", armRight2);
addOrReplaceTexture(textureManager, "outerrightarmleft", armLeft2);
addOrReplaceTexture(textureManager, "outerrightarmbottom",
armBottom2);
// LEFTARM
addOrReplaceTexture(textureManager, "outerleftarmfront",
leftArmFront2);
addOrReplaceTexture(textureManager, "outerleftarmtop", armTop2);
addOrReplaceTexture(textureManager, "outerleftarmback", armBack2);
addOrReplaceTexture(textureManager, "outerleftarmright", armRight2);
addOrReplaceTexture(textureManager, "outerleftarmleft", armLeft2);
addOrReplaceTexture(textureManager, "outerleftarmbottom",
armBottom2);
// RIGHTLEG
addOrReplaceTexture(textureManager, "outerrightlegfront", legFront2);
addOrReplaceTexture(textureManager, "outerrightlegtop", legTop2);
addOrReplaceTexture(textureManager, "outerrightlegback", legBack2);
addOrReplaceTexture(textureManager, "outerrightlegright", legRight2);
addOrReplaceTexture(textureManager, "outerrightlegleft", legLeft2);
addOrReplaceTexture(textureManager, "outerrightlegbottom",
legBottom2);
// LEFTLEG
addOrReplaceTexture(textureManager, "outerleftlegfront",
leftLegFront2);
addOrReplaceTexture(textureManager, "outerleftlegtop", legTop2);
addOrReplaceTexture(textureManager, "outerleftlegback", legBack2);
addOrReplaceTexture(textureManager, "outerleftlegright", legRight2);
addOrReplaceTexture(textureManager, "outerleftlegleft", legLeft2);
addOrReplaceTexture(textureManager, "outerleftlegbottom",
legBottom2);

} else {
// NEW SKIN TEMPLATE!
final int dimen = tempSkin.getHeight(); // default = 64

// HEAD
final Bitmap headFront1 = Bitmap.createBitmap(tempSkin, dimen / 8,
dimen / 8, dimen / 8, dimen / 8);
final Bitmap headTop1 = Bitmap.createBitmap(tempSkin, dimen / 8, 0,
dimen / 8, dimen / 8);
final Bitmap headBack1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 3, dimen / 8, dimen / 8, dimen / 8);
final Bitmap headRight1 = Bitmap.createBitmap(tempSkin, 0,
dimen / 8, dimen / 8, dimen / 8, mHor, false);
final Bitmap headLeft1 = Bitmap.createBitmap(tempSkin, dimen / 4,
dimen / 8, dimen / 8, dimen / 8);
final Bitmap headBottom1 = Bitmap.createBitmap(tempSkin, dimen / 4,
0, dimen / 8, dimen / 8);

final Texture headFront2 = new Texture(headFront1, true);
final Texture headTop2 = new Texture(headTop1, true);
final Texture headBack2 = new Texture(headBack1, true);
final Texture headRight2 = new Texture(headRight1, true);
final Texture headLeft2 = new Texture(headLeft1, true);
final Texture headBottom2 = new Texture(headBottom1, true);

// HAT
final Bitmap hatFront1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 5, dimen / 8, dimen / 8, dimen / 8);
final Bitmap hatTop1 = Bitmap.createBitmap(tempSkin, dimen / 8 * 5,
0, dimen / 8, dimen / 8);
final Bitmap hatBack1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 7, dimen / 8, dimen / 8, dimen / 8);
final Bitmap hatRight1 = Bitmap.createBitmap(tempSkin, dimen / 2,
dimen / 8, dimen / 8, dimen / 8, mHor, false);
final Bitmap hatLeft1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, dimen / 8, dimen / 8, dimen / 8);
final Bitmap hatBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, 0, dimen / 8, dimen / 8);

final Texture hatFront2 = new Texture(hatFront1, true);
final Texture hatTop2 = new Texture(hatTop1, true);
final Texture hatBack2 = new Texture(hatBack1, true);
final Texture hatRight2 = new Texture(hatRight1, true);
final Texture hatLeft2 = new Texture(hatLeft1, true);
final Texture hatBottom2 = new Texture(hatBottom1, true);

// BODY
final Bitmap bodyFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 5, dimen / 16 * 5,
dimen / 8, dimen / 16 * 3), 64, 64, false);
final Bitmap bodyTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 5, dimen / 4, dimen / 8, dimen / 8);
final Bitmap bodyBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 2, dimen / 16 * 5,
dimen / 8, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap bodyLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 7, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap bodyBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 7, dimen / 4, dimen / 8, dimen / 8);

final Texture bodyFront2 = new Texture(bodyFront1, true);
final Texture bodyTop2 = new Texture(bodyTop1, true);
final Texture bodyBack2 = new Texture(bodyBack1, true);
final Texture bodyRight2 = new Texture(bodyRight1, true);
final Texture bodyLeft2 = new Texture(bodyLeft1, true);
final Texture bodyBottom2 = new Texture(bodyBottom1, true);

// OUTERBODY
final Bitmap outerBodyFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 5, dimen / 16 * 9,
dimen / 8, dimen / 16 * 3), 64, 64, false);
final Bitmap outerBodyTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 5, dimen / 2, dimen / 8, dimen / 8);
final Bitmap outerBodyBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 2, dimen / 16 * 9,
dimen / 8, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerBodyRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerBodyLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 7, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerBodyBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 7, dimen / 2, dimen / 8, dimen / 8);

final Texture outerBodyFront2 = new Texture(outerBodyFront1, true);
final Texture outerBodyTop2 = new Texture(outerBodyTop1, true);
final Texture outerBodyBack2 = new Texture(outerBodyBack1, true);
final Texture outerBodyRight2 = new Texture(outerBodyRight1, true);
final Texture outerBodyLeft2 = new Texture(outerBodyLeft1, true);
final Texture outerBodyBottom2 = new Texture(outerBodyBottom1, true);

// INNERRIGHTARM
final Bitmap innerRightArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 11, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 11, dimen / 4, dimen / 16, dimen / 16);
final Bitmap innerRightArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 13, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 5, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap innerRightArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4 * 3, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, dimen / 4, dimen / 16, dimen / 16);

final Texture innerRightArmFront2 = new Texture(
innerRightArmFront1, true);
final Texture innerRightArmTop2 = new Texture(innerRightArmTop1,
true);
final Texture innerRightArmBack2 = new Texture(innerRightArmBack1,
true);
final Texture innerRightArmRight2 = new Texture(
innerRightArmRight1, true);
final Texture innerRightArmLeft2 = new Texture(innerRightArmLeft1,
true);
final Texture innerRightArmBottom2 = new Texture(
innerRightArmBottom1, true);

// OUTERRIGHTARM
final Bitmap outerRightArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 11, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 11, dimen / 2, dimen / 16, dimen / 16);
final Bitmap outerRightArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 13, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 5, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerRightArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4 * 3, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 4 * 3, dimen / 2, dimen / 16, dimen / 16);

final Texture outerRightArmFront2 = new Texture(
outerRightArmFront1, true);
final Texture outerRightArmTop2 = new Texture(outerRightArmTop1,
true);
final Texture outerRightArmBack2 = new Texture(outerRightArmBack1,
true);
final Texture outerRightArmRight2 = new Texture(
outerRightArmRight1, true);
final Texture outerRightArmLeft2 = new Texture(outerRightArmLeft1,
true);
final Texture outerRightArmBottom2 = new Texture(
outerRightArmBottom1, true);

// INNERRIGHTLEG
final Bitmap innerRightLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16, dimen / 4, dimen / 16, dimen / 16);
final Bitmap innerRightLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 3, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, dimen / 16 * 5, dimen / 16,
dimen / 16 * 3, mHor, false), 64, 64, false);
final Bitmap innerRightLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8, dimen / 16 * 5,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerRightLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8, dimen / 4, dimen / 16, dimen / 16);

final Texture innerRightLegFront2 = new Texture(
innerRightLegFront1, true);
final Texture innerRightLegTop2 = new Texture(innerRightLegTop1,
true);
final Texture innerRightLegBack2 = new Texture(innerRightLegBack1,
true);
final Texture innerRightLegRight2 = new Texture(
innerRightLegRight1, true);
final Texture innerRightLegLeft2 = new Texture(innerRightLegLeft1,
true);
final Texture innerRightLegBottom2 = new Texture(
innerRightLegBottom1, true);

// OUTERRIGHTLEG
final Bitmap outerRightLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16, dimen / 2, dimen / 16, dimen / 16);
final Bitmap outerRightLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 3, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, dimen / 16 * 9, dimen / 16,
dimen / 16 * 3, mHor, false), 64, 64, false);
final Bitmap outerRightLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8, dimen / 16 * 9,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerRightLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8, dimen / 2, dimen / 16, dimen / 16);

final Texture outerRightLegFront2 = new Texture(
outerRightLegFront1, true);
final Texture outerRightLegTop2 = new Texture(outerRightLegTop1,
true);
final Texture outerRightLegBack2 = new Texture(outerRightLegBack1,
true);
final Texture outerRightLegRight2 = new Texture(
outerRightLegRight1, true);
final Texture outerRightLegLeft2 = new Texture(outerRightLegLeft1,
true);
final Texture outerRightLegBottom2 = new Texture(
outerRightLegBottom1, true);

// OUTERLEFTLEG
final Bitmap outerLeftLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap outerLeftLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 3, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, 0, dimen / 16 * 13, dimen / 16,
dimen / 16 * 3, mHor, false), 64, 64, false);
final Bitmap outerLeftLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8, dimen / 4 * 3, dimen / 16, dimen / 16);

final Texture outerLeftLegFront2 = new Texture(outerLeftLegFront1,
true);
final Texture outerLeftLegTop2 = new Texture(outerLeftLegTop1, true);
final Texture outerLeftLegBack2 = new Texture(outerLeftLegBack1,
true);
final Texture outerLeftLegRight2 = new Texture(outerLeftLegRight1,
true);
final Texture outerLeftLegLeft2 = new Texture(outerLeftLegLeft1,
true);
final Texture outerLeftLegBottom2 = new Texture(
outerLeftLegBottom1, true);

// INNERLEFTLEG
final Bitmap innerLeftLegFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 5, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftLegTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 5, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap innerLeftLegBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 7, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftLegRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap innerLeftLegLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 3, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftLegBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 3, dimen / 4 * 3, dimen / 16, dimen / 16);

final Texture innerLeftLegFront2 = new Texture(innerLeftLegFront1,
true);
final Texture innerLeftLegTop2 = new Texture(innerLeftLegTop1, true);
final Texture innerLeftLegBack2 = new Texture(innerLeftLegBack1,
true);
final Texture innerLeftLegRight2 = new Texture(innerLeftLegRight1,
true);
final Texture innerLeftLegLeft2 = new Texture(innerLeftLegLeft1,
true);
final Texture innerLeftLegBottom2 = new Texture(
innerLeftLegBottom1, true);

// INNERLEFTARM
final Bitmap innerLeftArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 9, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 9, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap innerLeftArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 11, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 2, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap innerLeftArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 5, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap innerLeftArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 5, dimen / 4 * 3, dimen / 16, dimen / 16);

final Texture innerLeftArmFront2 = new Texture(innerLeftArmFront1,
true);
final Texture innerLeftArmTop2 = new Texture(innerLeftArmTop1, true);
final Texture innerLeftArmBack2 = new Texture(innerLeftArmBack1,
true);
final Texture innerLeftArmRight2 = new Texture(innerLeftArmRight1,
true);
final Texture innerLeftArmLeft2 = new Texture(innerLeftArmLeft1,
true);
final Texture innerLeftArmBottom2 = new Texture(
innerLeftArmBottom1, true);

// OUTERLEFTARM
final Bitmap outerLeftArmFront1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 13, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftArmTop1 = Bitmap.createBitmap(tempSkin,
dimen / 16 * 13, dimen / 4 * 3, dimen / 16, dimen / 16);
final Bitmap outerLeftArmBack1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 16 * 15, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
// /
final Bitmap outerLeftArmRight1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 4 * 3, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3, mHor, false), 64, 64,
false);
final Bitmap outerLeftArmLeft1 = Bitmap.createScaledBitmap(Bitmap
.createBitmap(tempSkin, dimen / 8 * 7, dimen / 16 * 13,
dimen / 16, dimen / 16 * 3), 64, 64, false);
final Bitmap outerLeftArmBottom1 = Bitmap.createBitmap(tempSkin,
dimen / 8 * 7, dimen / 4 * 3, dimen / 16, dimen / 16);

final Texture outerLeftArmFront2 = new Texture(outerLeftArmFront1,
true);
final Texture outerLeftArmTop2 = new Texture(outerLeftArmTop1, true);
final Texture outerLeftArmBack2 = new Texture(outerLeftArmBack1,
true);
final Texture outerLeftArmRight2 = new Texture(outerLeftArmRight1,
true);
final Texture outerLeftArmLeft2 = new Texture(outerLeftArmLeft1,
true);
final Texture outerLeftArmBottom2 = new Texture(
outerLeftArmBottom1, true);

final int maxDimension;
if (Build.VERSION.SDK_INT > 12) {
// Prevents OOM's
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
maxDimension = Math.max(size.x, size.y);
} else {
Display display = getWindowManager().getDefaultDisplay();
maxDimension = Math
.max(display.getWidth(), display.getHeight());
}

if (maxDimension <= 512) {
// minimum
bg = new Texture(Bitmap.createScaledBitmap(Bitmap.createBitmap(
background, 0, 0, background.getWidth(),
background.getHeight(), mVer, false), 256, 256, false));
} else if (maxDimension <= 1024) {
// default
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 512,
512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 256,
256, false));
}
} else if (maxDimension <= 1536) {
// big
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 1024,
1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
512, 512, false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
256, 256, false));
}

}
} else {
// maximum
try {
bg = new Texture(Bitmap.createScaledBitmap(
Bitmap.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false), 2048,
2048, false));
} catch (final OutOfMemoryError e3) {
e3.printStackTrace();
System.gc();
try {
bg = new Texture(Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(), mVer, false),
1024, 1024, false));
} catch (final OutOfMemoryError e2) {
e2.printStackTrace();
System.gc();
try {
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 512, 512,
false));
} catch (final OutOfMemoryError e1) {
e1.printStackTrace();
System.gc();
bg = new Texture(
Bitmap.createScaledBitmap(Bitmap
.createBitmap(background, 0, 0,
background.getWidth(),
background.getHeight(),
mVer, false), 256, 256,
false));
}

}
}
}

// BACKGROUND
addOrReplaceTexture(textureManager, "bg", bg);
// HEAD
addOrReplaceTexture(textureManager, "headfront", headFront2);
addOrReplaceTexture(textureManager, "headtop", headTop2);
addOrReplaceTexture(textureManager, "headback", headBack2);
addOrReplaceTexture(textureManager, "headright", headRight2);
addOrReplaceTexture(textureManager, "headleft", headLeft2);
addOrReplaceTexture(textureManager, "headbottom", headBottom2);
// HAT
addOrReplaceTexture(textureManager, "hatfront", hatFront2);
addOrReplaceTexture(textureManager, "hattop", hatTop2);
addOrReplaceTexture(textureManager, "hatback", hatBack2);
addOrReplaceTexture(textureManager, "hatright", hatRight2);
addOrReplaceTexture(textureManager, "hatleft", hatLeft2);
addOrReplaceTexture(textureManager, "hatbottom", hatBottom2);
// BODY
addOrReplaceTexture(textureManager, "innerbodyfront", bodyFront2);
addOrReplaceTexture(textureManager, "innerbodytop", bodyTop2);
addOrReplaceTexture(textureManager, "innerbodyback", bodyBack2);
addOrReplaceTexture(textureManager, "innerbodyright", bodyRight2);
addOrReplaceTexture(textureManager, "innerbodyleft", bodyLeft2);
addOrReplaceTexture(textureManager, "innerbodybottom", bodyBottom2);
// OUTERBODY
addOrReplaceTexture(textureManager, "bodyfront", outerBodyFront2);
addOrReplaceTexture(textureManager, "bodytop", outerBodyTop2);
addOrReplaceTexture(textureManager, "bodyback", outerBodyBack2);
addOrReplaceTexture(textureManager, "bodyright", outerBodyRight2);
addOrReplaceTexture(textureManager, "bodyleft", outerBodyLeft2);
addOrReplaceTexture(textureManager, "bodybottom", outerBodyBottom2);
// INNERRIGHTARM
addOrReplaceTexture(textureManager, "innerrightarmfront",
innerRightArmFront2);
addOrReplaceTexture(textureManager, "innerrightarmtop",
innerRightArmTop2);
addOrReplaceTexture(textureManager, "innerrightarmback",
innerRightArmBack2);
addOrReplaceTexture(textureManager, "innerrightarmright",
innerRightArmRight2);
addOrReplaceTexture(textureManager, "innerrightarmleft",
innerRightArmLeft2);
addOrReplaceTexture(textureManager, "innerrightarmbottom",
innerRightArmBottom2);

// OUTERRIGHTARM
addOrReplaceTexture(textureManager, "outerrightarmfront",
outerRightArmFront2);
addOrReplaceTexture(textureManager, "outerrightarmtop",
outerRightArmTop2);
addOrReplaceTexture(textureManager, "outerrightarmback",
outerRightArmBack2);
addOrReplaceTexture(textureManager, "outerrightarmright",
outerRightArmRight2);
addOrReplaceTexture(textureManager, "outerrightarmleft",
outerRightArmLeft2);
addOrReplaceTexture(textureManager, "outerrightarmbottom",
outerRightArmBottom2);

// INNERRIGHTLEG
addOrReplaceTexture(textureManager, "innerrightlegfront",
innerRightLegFront2);
addOrReplaceTexture(textureManager, "innerrightlegtop",
innerRightLegTop2);
addOrReplaceTexture(textureManager, "innerrightlegback",
innerRightLegBack2);
addOrReplaceTexture(textureManager, "innerrightlegright",
innerRightLegRight2);
addOrReplaceTexture(textureManager, "innerrightlegleft",
innerRightLegLeft2);
addOrReplaceTexture(textureManager, "innerrightlegbottom",
innerRightLegBottom2);

// OUTERRIGHTLEG
addOrReplaceTexture(textureManager, "outerrightlegfront",
outerRightLegFront2);
addOrReplaceTexture(textureManager, "outerrightlegtop",
outerRightLegTop2);
addOrReplaceTexture(textureManager, "outerrightlegback",
outerRightLegBack2);
addOrReplaceTexture(textureManager, "outerrightlegright",
outerRightLegRight2);
addOrReplaceTexture(textureManager, "outerrightlegleft",
outerRightLegLeft2);
addOrReplaceTexture(textureManager, "outerrightlegbottom",
outerRightLegBottom2);

// OUTERLEFTLEG
addOrReplaceTexture(textureManager, "outerleftlegfront",
outerLeftLegFront2);
addOrReplaceTexture(textureManager, "outerleftlegtop",
outerLeftLegTop2);
addOrReplaceTexture(textureManager, "outerleftlegback",
outerLeftLegBack2);
addOrReplaceTexture(textureManager, "outerleftlegright",
outerLeftLegRight2);
addOrReplaceTexture(textureManager, "outerleftlegleft",
outerLeftLegLeft2);
addOrReplaceTexture(textureManager, "outerleftlegbottom",
outerLeftLegBottom2);

// INNERLEFTLEG
addOrReplaceTexture(textureManager, "innerleftlegfront",
innerLeftLegFront2);
addOrReplaceTexture(textureManager, "innerleftlegtop",
innerLeftLegTop2);
addOrReplaceTexture(textureManager, "innerleftlegback",
innerLeftLegBack2);
addOrReplaceTexture(textureManager, "innerleftlegright",
innerLeftLegRight2);
addOrReplaceTexture(textureManager, "innerleftlegleft",
innerLeftLegLeft2);
addOrReplaceTexture(textureManager, "innerleftlegbottom",
innerLeftLegBottom2);

// OUTERLEFTARM
addOrReplaceTexture(textureManager, "outerleftarmfront",
outerLeftArmFront2);
addOrReplaceTexture(textureManager, "outerleftarmtop",
outerLeftArmTop2);
addOrReplaceTexture(textureManager, "outerleftarmback",
outerLeftArmBack2);
addOrReplaceTexture(textureManager, "outerleftarmright",
outerLeftArmRight2);
addOrReplaceTexture(textureManager, "outerleftarmleft",
outerLeftArmLeft2);
addOrReplaceTexture(textureManager, "outerleftarmbottom",
outerLeftArmBottom2);

// INNERLEFTARM
addOrReplaceTexture(textureManager, "innerleftarmfront",
innerLeftArmFront2);
addOrReplaceTexture(textureManager, "innerleftarmtop",
innerLeftArmTop2);
addOrReplaceTexture(textureManager, "innerleftarmback",
innerLeftArmBack2);
addOrReplaceTexture(textureManager, "innerleftarmright",
innerLeftArmRight2);
addOrReplaceTexture(textureManager, "innerleftarmleft",
innerLeftArmLeft2);
addOrReplaceTexture(textureManager, "innerleftarmbottom",
innerLeftArmBottom2);

}
if (this.armor != null) {
// Load armor
if (hasArmorDimensions()) {

final Bitmap bodyArmorTop1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 6, 33, 8, 6), 32, 32, false);
final Bitmap bodyArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 6, 39, 8, 13), 32,
32, false);
final Bitmap bodyArmorBack1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 20, 39, 8, 13), 32, 32,
false);
final Bitmap bodyArmorRight1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 14, 39, 6, 13), 32, 32,
false);
final Bitmap bodyArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 0, 39, 6, 13), 32,
32, false);

final Bitmap headArmorTop1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 40, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorFront1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 10, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorBack1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 30, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorRight1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 20, 54, 10, 10), 32, 32,
false);
final Bitmap headArmorLeft1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 0, 54, 10, 10), 32, 32,
false);

final Bitmap footArmorTop1 = Bitmap.createScaledBitmap(
Bitmap.createBitmap(armor, 8, 8, 6, 6), 32, 32, false);
final Bitmap footArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 34, 49, 6, 4), 32,
32, false);
final Bitmap footArmorBack1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 45, 49, 6, 4), 32,
32, false);
final Bitmap footArmorRight1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 40, 49, 5, 4), 32,
32, false);
final Bitmap footArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 29, 49, 5, 4), 32,
32, false);

final Bitmap legArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 29, 33, 4, 9), 32,
32, false);
final Bitmap legArmorBack1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 33, 33, 4, 9), 32,
32, false);
final Bitmap legArmorRight1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 37, 33, 4, 9), 32,
32, false);
final Bitmap legArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 41, 33, 4, 9), 32,
32, false);

final Bitmap shoulderArmorTop1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 51, 6, 6), 32,
32, false);
final Bitmap shoulderArmorFront1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 33, 6, 6), 32,
32, false);
final Bitmap shoulderArmorBack1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 45, 6, 6), 32,
32, false);
final Bitmap shoulderArmorRight1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 57, 6, 6), 32,
32, false);
final Bitmap shoulderArmorLeft1 = Bitmap
.createScaledBitmap(
Bitmap.createBitmap(armor, 53, 39, 6, 6), 32,
32, false);

final Drawable transparent = getResources().getDrawable(
R.drawable.transparent);

final Texture bodyArmorTop2 = new Texture(bodyArmorTop1, true);
final Texture bodyArmorFront2 = new Texture(bodyArmorFront1,
true);
final Texture bodyArmorLeft2 = new Texture(bodyArmorLeft1, true);
final Texture bodyArmorRight2 = new Texture(bodyArmorRight1,
true);
final Texture bodyArmorBack2 = new Texture(bodyArmorBack1, true);
final Texture bodyArmorBottom2 = new Texture(transparent, true);

final Texture headArmorTop2 = new Texture(headArmorTop1, true);
final Texture headArmorFront2 = new Texture(headArmorFront1,
true);
final Texture headArmorLeft2 = new Texture(headArmorLeft1, true);
final Texture headArmorRight2 = new Texture(headArmorRight1,
true);
final Texture headArmorBack2 = new Texture(headArmorBack1, true);
final Texture headArmorBottom2 = new Texture(transparent, true);

final Texture footArmorTop2 = new Texture(footArmorTop1, true);
final Texture footArmorFront2 = new Texture(footArmorFront1,
true);
final Texture footArmorLeft2 = new Texture(footArmorLeft1, true);
final Texture footArmorRight2 = new Texture(footArmorRight1,
true);
final Texture footArmorBack2 = new Texture(footArmorBack1, true);
final Texture footArmorBottom2 = new Texture(transparent, true);

final Texture legArmorTop2 = new Texture(transparent, true);
final Texture legArmorFront2 = new Texture(legArmorFront1, true);
final Texture legArmorLeft2 = new Texture(legArmorLeft1, true);
final Texture legArmorRight2 = new Texture(legArmorRight1, true);
final Texture legArmorBack2 = new Texture(legArmorBack1, true);
final Texture legArmorBottom2 = new Texture(transparent, true);

final Texture shoulderArmorTop2 = new Texture(
shoulderArmorTop1, true);
final Texture shoulderArmorFront2 = new Texture(
shoulderArmorFront1, true);
final Texture shoulderArmorLeft2 = new Texture(
shoulderArmorLeft1, true);
final Texture shoulderArmorRight2 = new Texture(
shoulderArmorRight1, true);
final Texture shoulderArmorBack2 = new Texture(
shoulderArmorBack1, true);
final Texture shoulderArmorBottom2 = new Texture(transparent,
true);

bodyArmorTop2.setFiltering(false);
bodyArmorFront2.setFiltering(false);
bodyArmorLeft2.setFiltering(false);
bodyArmorRight2.setFiltering(false);
bodyArmorBack2.setFiltering(false);
bodyArmorBottom2.setFiltering(false);

headArmorTop2.setFiltering(false);
headArmorFront2.setFiltering(false);
headArmorLeft2.setFiltering(false);
headArmorRight2.setFiltering(false);
headArmorBack2.setFiltering(false);
headArmorBottom2.setFiltering(false);

footArmorTop2.setFiltering(false);
footArmorFront2.setFiltering(false);
footArmorLeft2.setFiltering(false);
footArmorRight2.setFiltering(false);
footArmorBack2.setFiltering(false);
footArmorBottom2.setFiltering(false);

legArmorTop2.setFiltering(false);
legArmorFront2.setFiltering(false);
legArmorLeft2.setFiltering(false);
legArmorRight2.setFiltering(false);
legArmorBack2.setFiltering(false);
legArmorBottom2.setFiltering(false);

shoulderArmorTop2.setFiltering(false);
shoulderArmorFront2.setFiltering(false);
shoulderArmorLeft2.setFiltering(false);
shoulderArmorRight2.setFiltering(false);
shoulderArmorBack2.setFiltering(false);
shoulderArmorBottom2.setFiltering(false);

addOrReplaceTexture(textureManager, "armorbodytop",
bodyArmorTop2);
addOrReplaceTexture(textureManager, "armorbodyfront",
bodyArmorFront2);
addOrReplaceTexture(textureManager, "armorbodyleft",
bodyArmorLeft2);
addOrReplaceTexture(textureManager, "armorbodyright",
bodyArmorRight2);
addOrReplaceTexture(textureManager, "armorbodyback",
bodyArmorBack2);
addOrReplaceTexture(textureManager, "armorbodybottom",
bodyArmorBottom2);

addOrReplaceTexture(textureManager, "armorheadtop",
headArmorTop2);
addOrReplaceTexture(textureManager, "armorheadfront",
headArmorFront2);
addOrReplaceTexture(textureManager, "armorheadleft",
headArmorLeft2);
addOrReplaceTexture(textureManager, "armorheadright",
headArmorRight2);
addOrReplaceTexture(textureManager, "armorheadback",
headArmorBack2);
addOrReplaceTexture(textureManager, "armorheadbottom",
headArmorBottom2);

addOrReplaceTexture(textureManager, "armorfootbottom",
footArmorTop2);
addOrReplaceTexture(textureManager, "armorfootfront",
footArmorFront2);
addOrReplaceTexture(textureManager, "armorfootleft",
footArmorLeft2);
addOrReplaceTexture(textureManager, "armorfootright",
footArmorRight2);
addOrReplaceTexture(textureManager, "armorfootback",
footArmorBack2);
addOrReplaceTexture(textureManager, "armorfoottop",
footArmorBottom2);

addOrReplaceTexture(textureManager, "armorlegtop", legArmorTop2);
addOrReplaceTexture(textureManager, "armorlegfront",
legArmorFront2);
addOrReplaceTexture(textureManager, "armorlegleft",
legArmorLeft2);
addOrReplaceTexture(textureManager, "armorlegright",
legArmorRight2);
addOrReplaceTexture(textureManager, "armorlegback",
legArmorBack2);
addOrReplaceTexture(textureManager, "armorlegbottom",
legArmorBottom2);

addOrReplaceTexture(textureManager, "armorshouldertop",
shoulderArmorTop2);
addOrReplaceTexture(textureManager, "armorshoulderfront",
shoulderArmorFront2);
addOrReplaceTexture(textureManager, "armorshoulderleft",
shoulderArmorLeft2);
addOrReplaceTexture(textureManager, "armorshoulderright",
shoulderArmorRight2);
addOrReplaceTexture(textureManager, "armorshoulderback",
shoulderArmorBack2);
addOrReplaceTexture(textureManager, "armorshoulderbottom",
shoulderArmorBottom2);
}
}
for (final String name : textureManager.getNames()) {
textureManager.getTexture(name).setFiltering(false);
}
textureManager.compress();
}

I might have to clean up the code a bit sometime...

133
Support / Re: Color bug
« on: September 30, 2015, 12:32:10 pm »
No, I never call that method.
I do call other texture methods:
Texture.setClamping(true);
Texture.setFiltering(false);
Texture.setMipmap(true):

134
Support / Re: Color bug
« on: September 29, 2015, 11:30:27 pm »
Yes I am, I think I can disable it though

I am using TextureManager.compress()
I suppose that does the same thing?

135
Support / Re: Color bug
« on: September 22, 2015, 12:01:49 am »
I thought the Asus MeMo Pad 7 did have an Intel CPU/GPU...
https://www.asus.com/Tablets/ASUS_MeMO_Pad_7_ME176C/specifications/

I doubt that something is wrong with the way I load textures... Well, I'm not sure.
The application has had over 200k downloads so far.
And I have only had a very few reports about the color bug.

Pages: 1 ... 7 8 [9] 10 11 ... 13