Author Topic: Help with Texture Offset  (Read 2038 times)

Offline tyronetudehope

  • byte
  • *
  • Posts: 7
    • View Profile
Help with Texture Offset
« on: February 24, 2011, 11:20:00 am »
Hi,

I'm trying to get a Min3D example running using jPCT, however, I cannot figure out how to go about modifying the textures offset.

The example I'm referring to is ExampleTextureOffset.java found in Min3D's google code repo.

Is this possible? I thought maybe I need to use the ITextureEffect interface, however, I cannot quite figure out how it works, and am not sure of the U/V values either.

Any help will be greatly appreciated.

Thanks,
Tyrone

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11970
    • View Profile
    • http://www.jpct.net
Re: Help with Texture Offset
« Reply #1 on: February 24, 2011, 12:11:22 pm »
ITextureEffect isn't the right way of implementing this. You can use an implementation of an IVertexController for this. That's the slower but more compatible solution. Or use Object3D.setTextureMatrix(<Matrix>) to apply any possible transformation to the texture of an object. That's the faster solution, but it has problems on some older phones like mine with poorly implemented drivers. I expect it to work on newer phones though.

Offline tyronetudehope

  • byte
  • *
  • Posts: 7
    • View Profile
Re: Help with Texture Offset
« Reply #2 on: February 24, 2011, 02:06:01 pm »
Ah ok thanks, I figured ITextureEffect was the wrong way to go  :)

I've successfully transformed the texture, however, am now trying to figure out something else. I can't work out how to apply two different textures of different sizes. I'm using the earth and clouds.png textures from the min3d samples :o

Earth is 512^2 and clouds are 256^2

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11970
    • View Profile
    • http://www.jpct.net
Re: Help with Texture Offset
« Reply #3 on: February 24, 2011, 02:21:00 pm »
Size doesn't matter here. You can assign multiple textures using the TextureInfo-class regardless of their physical size, because everything is normalized anyway. Just make sure that the texture that you want to transform is on stage 0.