Author Topic: Changing textures!  (Read 4327 times)

-Melssj5-

  • Guest
Changing textures!
« on: July 10, 2005, 05:10:16 am »
Hello, can I change the textures of the Object3D while the application is running.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Changing textures!
« Reply #1 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.