www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: -Melssj5- on July 10, 2005, 05:10:16 am

Title: Changing textures!
Post by: -Melssj5- on July 10, 2005, 05:10:16 am
Hello, can I change the textures of the Object3D while the application is running.
Title: Changing textures!
Post by: EgonOlsen on July 11, 2005, 09:29:37 am
The for whole Object3D (i.e. one texture for the whole mesh), use setTexture(...) in Object3D. If you want to modify only parts of the object, things are more complicated and you can use the PolygonManager for this. An example:
Code: [Select]
for (int i=0; i<level.getMesh().getTriangleCount(); i++) {
          level.getPolygonManager().setPolygonTexture(i,TextureManager.getInstance().getTextureID("ql1.jpg"));
}


If you want to modify the texture's pixel data itself, you can use a ITextureEffect for that. But beware that this may be slow when using OpenGL.

Hope this helps.