jPCT-AE - a 3d engine for Android > Support

Unsupported texture width

(1/2) > >>

oetzi:
Hello,

I am very new to the general work with 3D objects as well as to jPCT.
Nevertheless, I got an app running, which displays a 3DS object, which I simply downloaded from http://archive3d.net/?a=download&id=527694d7 (I thought it might be a good idea to start with a very simple 3D object :) )

After being happy about this simple 3D object on my screen I have tried to load the related texture, but failed so far.
The error I get is "ERROR: Unsupported Texture width: 800"
I found several posts in this forum which deal with similar issues, but most of them were related to the use of drawables, which is not applicable for my case.


--- Code: ---inputStream = masterContext.getAssets().open("3d-objects/ball/Ball N280313.3DS");
Texture texture = new Texture(masterContext.getAssets().open("3d-objects/ball/main_product_133750009413897300.jpg"));
TextureManager.getInstance().addTexture("main_product_133750009413897300.jpg", texture);
--- End code ---

So, could anyone tell me, what I am doing wrong here?

Greetings,
oetzi




Yerst:
Your texture sizes need to be a power of two. (2^n)
So just scale your texture to 512*512 for example, and it should work.

oetzi:
Thanks Yerst, that solved indeed the problem. Although I am now a bit confused that only square textures can be used. Anyway.

Now that the texture is loaded sucessfully, I am facing the next problem. It is a bit off-topic, but hopefully you can help me with this too.
The texture is still not displayed and I assume that it simply has to do with the fact, that I do not use the correct name here for the first parameter:

--- Code: ---TextureManager.getInstance().addTexture("main_product_133750009413897300.jpg", texture);
--- End code ---
As mentioned before, I downloaded this 3D object from a website. That means that I do not know how the creator named the texture. I downloaded a zip file, which contains:
- Ball N280313.3DS
- Ball N280313.gsm
- main_product_133750009413897300.jpg

So the question is: How do I know which name I have to choose as first parameter in the addTexture() method?

Yerst:
You need to assign the texture to the Object.
It doesn't matter how you name the texture, it just needs to be the same name you called it in the TextureManager.

--- Code: ---yourBallModel.setTexture("ballTexture");
--- End code ---
Or for your Current Name:

--- Code: ---yourBallModel.setTexture("main_product_133750009413897300.jpg");
--- End code ---

oetzi:
Ah, now I see the logic. Thanks a lot!
And if my object consists of more than one part, I probably have to choose the correct order of the textures. I will try it now.

Navigation

[0] Message Index

[#] Next page

Go to full version