www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: Davi on October 28, 2011, 04:34:20 am
-
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
world = new World();
world.setAmbientLight(150, 150, 150);
TextureManager.getInstance().addTexture("tris3", new Texture(BitmapFactory.decodeResource(this.getResources(), R.drawable.tris3)));
snork = Loader.loadMD2(LoadAssets.loadf("tris3.md2"), scale);
snork.setTexture("tris3");
snork.strip();
snork.build();
world.addObject(snork);
}
public void onSurfaceChanged(GL10 gl, int width, int height) {
if (fb != null) {
fb = null;
}
this.width=width;
this.height=height;
fb = new FrameBuffer(gl,width, height);
}
onDrawFrame(GL10 gl) {
doAnim();
world.renderScene(fb);
world.draw(fb);
fb.display();
}
above is my key code to show texture,the md2 model loading is ok,but the texture can't show on the model,I don't know what wrong is?
Please help me ?
-
Can you post the complete output log please.
-
can you see that log
[attachment deleted by admin]
-
That's not the important part. I would like to see the part where it actually loads the texture. And please post logs as text in code-tags, not as a jpg...
-
jPCT-AE Loading Texture...
[ 131979264098] - WARNING: Unsupported Texture width (384)... resizing to 256
Loading file from InputStream
....
Skin width:256
Skin height:256
Frame size:1612
Number of skins:5
Number of Vertices:393
Number of Texture coordinates:561
Number of triangles:764
Number of GL_COMMANDS:3833
Number of Frames:198
Reading Texture coordinates
Done!
-
??? Which version of jPCT-AE is that? This message doesn't appear in the last ones. The automatic rescale has been removed and the message has been changed to an error....this can't be from any current version...???
-
oh,I am sorry,my engine is older one, I have download the jpct-ae1.23, and change it as a new one. and then,when I run it,my project has been crashed!!!it is very strange. the older engine doesn't crash,why the new one can crash!
the error log as blew:
ERROR: Unsupported Texture width:171
ERROR:java.lang.RuntimeException
at com.thread.jpct.Logger.log
at com.thread.jpct.Texture.loadTexture
at com.thread.jpct.Texture.<init>
-
That's by design. As said, rescaling of textures isn't supported anymore for various reasons. It's up to you to provide properly sized textures. Texture width and height have to be a power of 2. Everything else will be treated as an error.
-
but my texture has a proper size, 256*256, why the log show error message that my width is 171?? :( ,it's so strange,
-
Are your textures in a 'drawable-xxdpi' folder?
Place your textures in 'drawable-nodpi' to stop Android from resizing the textures automatically.
-
yeh,it works,Thanks very much. ;)
but the model is still white, the texture can't show on the model, my key code is on the first floor,can you help to find where the wrong is?
-
No idea. The code looks fine at first glance. Maybe you can upload the model and the texture, so that i can see for myself?
-
How did you create the 3D Model?
Maybe it's missing UV texture co-ordinates.
Try using the jPCT Object3D function to calculate the texture using sphere mapping to get around invalid UV co-ordinates.