Author Topic: Textures in applet shifted  (Read 2919 times)

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Textures in applet shifted
« on: August 01, 2008, 11:00:55 pm »
I just tried loading the mouse character in my applet and the textures that were fine in the application are all shifted over in the applet. 
click here->Fireside 7 Games<-

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Textures in applet shifted
« Reply #1 on: August 01, 2008, 11:06:20 pm »
Do you have a screen shot to compare both?

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Textures in applet shifted
« Reply #2 on: August 02, 2008, 12:03:08 am »


These are the same model and texture.  One only uses ambient light, but you can see how the black nose is in the right place on the one and off on the other.
click here->Fireside 7 Games<-

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Textures in applet shifted
« Reply #3 on: August 02, 2008, 03:14:16 pm »
Have you called build() on the model used in the applet. There is no difference between an applet and an application for jPCT. If the mapping is wrong, it has to be something in your code that differs. Are you using the hardware renderer in the application and the software one in the applet?

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Textures in applet shifted
« Reply #4 on: August 02, 2008, 10:11:58 pm »
I'm using the same model loading function except the applet loads from a stream and I'm using the software renderer for the applet.  The load function does a build. Then I set the texture after in both programs.  I do a set scale in the applet after the load and texture setting that I don't think I do in the application.
« Last Edit: August 02, 2008, 10:18:58 pm by fireside »
click here->Fireside 7 Games<-

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Textures in applet shifted
« Reply #5 on: August 02, 2008, 10:14:36 pm »
You have to call build() after setting the textures. build() should be called right after the object is "ready to render". Without properly set textures, it isn't. The hardware renderer is just more forgiving in this respect than the software one.

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Textures in applet shifted
« Reply #6 on: August 02, 2008, 10:19:34 pm »
OK, I'll try that.
click here->Fireside 7 Games<-

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Textures in applet shifted
« Reply #7 on: August 02, 2008, 10:23:00 pm »
That fixed it, thanks.
click here->Fireside 7 Games<-

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: Textures in applet shifted
« Reply #8 on: August 02, 2008, 10:29:05 pm »
You may also use recreateTextureCoords(); which is cheaper than build() if build() has already been called at least once before. But on todays hardware, it shouldn't matter anyway...