Author Topic: Apply Texture Unsupported Texture width (Not using Drawable)  (Read 1281 times)

Offline dubbox

  • byte
  • *
  • Posts: 24
    • View Profile
Apply Texture Unsupported Texture width (Not using Drawable)
« on: September 30, 2014, 11:45:22 pm »
Hey Guys,

I know there are many topics on this theme but i am not getting it to work

I try to load a .ser object with texture

Code: [Select]
Texture th= new Texture(masterContext.getResources().openRawResource(R.raw.th));
TextureManager tm = TextureManager.getInstance();
if(!tm.containsTexture("teppichHems.JPG")){
tm.addTexture("teppichHems.JPG", th);
}

i keep getting the error: unsupportedTextureWidth: 254


i know there is a way to rescale it with a bitmap

but is there another way ?
if not can sombody explain to me how to use a bitmap i never did that before

the code for serializing the object is here i got it from an tutorial i think it works fine no errors here

Code: [Select]
public static void main(String[] args) {
if(args.length > 3){
int last = args.length - 1;
for(int i = 0; i <= last; i++){
if(args[i].equals("-i3ds")){
if(i == last){
System.err.println("Error missing parameters! "
+ usageMessage);
System.exit(-1);
}else{
objName += args[i + 1];
}
}else if(args[i].equals("-t")){
if(i == last){
System.err.println("Error missing parameters! "
+ usageMessage);
System.exit(-1);
}else{
int k=i;
textureFileName = new String[last-k];
for(int j=0; j<textureFileName.length;j++){
textureFileName[j]="";
}
while(k != last){
k++;
textureFileName[k-i-1] += args[k];
}
}
}
}
}else{
System.err.println(usageMessage);
System.exit(-1);
}
if(objName.equals("") || textureFileName.length==0){
System.err.println(usageMessage);
System.exit(-1);
}

TextureManager tm = TextureManager.getInstance();
for(int i=0; i<textureFileName.length;i++){
tm.addTexture(textureFileName[i],new
Texture(inputPath+textureFileName[i]));
}
try{
File objfile = new File(inputPath+""+objName+".3DS");
Object3D[] obj = Loader.load3DS(new FileInputStream(objfile),
1);
inputObject3D = Object3D.mergeAll(obj);
}catch(FileNotFoundException fnfEX){
System.err.println(""+fnfEX);
System.exit(-1);
};
inputObject3D.build();
DeSerializer deSer = new DeSerializer();
try {
fileSer = new File(inputPath+""+objName+".ser");
FileOutputStream outStreamSer = new FileOutputStream(fileSer);
deSer.serialize(inputObject3D, outStreamSer, true);
} catch (FileNotFoundException e) {
System.err.println(""+e);
System.exit(-1);
}
System.out.println("Finished!");
}

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11980
    • View Profile
    • http://www.jpct.net
Re: Apply Texture Unsupported Texture width (Not using Drawable)
« Reply #1 on: October 01, 2014, 12:01:21 am »
Just don't use textures of that size. Width and height have to be a power of two (so in your case 256, not 254). So just go ahead and rescale your textures in some image editing program. That's far better than doing any kind of rescaling in the app itself.
« Last Edit: October 01, 2014, 08:26:49 am by EgonOlsen »

Offline dubbox

  • byte
  • *
  • Posts: 24
    • View Profile
Re: Apply Texture Unsupported Texture width (Not using Drawable)
« Reply #2 on: October 02, 2014, 09:28:49 am »
thanks egon !!!

but now there is another problem

i created the model using blender and everything looks rigth the texture is applied via uv-map and is saved correctly
but when i add the tex onto the model in java and move the camera it gets the effect like a fisheye sorry dont know how to explain it but the tex near to the camera looks like the camera would be a fisheye how can i avoid this?

thanks for your great help and work Egon  :)
« Last Edit: October 02, 2014, 09:36:16 am by dubbox »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11980
    • View Profile
    • http://www.jpct.net
Re: Apply Texture Unsupported Texture width (Not using Drawable)
« Reply #3 on: October 02, 2014, 12:07:24 pm »
Do you have a screen shot? I'm not sure what you mean... ???

Offline dubbox

  • byte
  • *
  • Posts: 24
    • View Profile
Re: Apply Texture Unsupported Texture width (Not using Drawable)
« Reply #4 on: October 05, 2014, 05:07:45 pm »
sorry for not giving you feedback i was busy

it was just an emulator bug on my smartphone everything is fine so its all good

thank you for your fast help egon