Author Topic: Does TextureManager Operate on a Parallel Thread?  (Read 338 times)

Offline AGP

  • quad
  • ******
  • Posts: 1592
    • View Profile
Does TextureManager Operate on a Parallel Thread?
« on: January 12, 2018, 05:45:37 pm »
If so, how do I wait for it? My app is failing to find a texture after it's been added to the TextureManager.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11866
    • View Profile
    • http://www.jpct.net
Re: Does TextureManager Operate on a Parallel Thread?
« Reply #1 on: January 12, 2018, 05:51:41 pm »
No, it doesn't. There are no threads on jPCT other than the ones used by the software renderer (optional) and the SEAT Renderer. If you add a texture, it's in there when the method returns.

Offline AGP

  • quad
  • ******
  • Posts: 1592
    • View Profile
Re: Does TextureManager Operate on a Parallel Thread?
« Reply #2 on: January 12, 2018, 05:57:40 pm »
I have loadModels() method whose first line is loadTextures(). But the loader fails at finding the texture even before loadTextures prints its name. What gives?

Offline AGP

  • quad
  • ******
  • Posts: 1592
    • View Profile
Re: Does TextureManager Operate on a Parallel Thread?
« Reply #3 on: January 12, 2018, 06:17:19 pm »
It's not the model loader that's failing, it's the TextureManager. Any chance you could improve the error message here, to indicate that it's the TextureManager that's failing to add the texture?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11866
    • View Profile
    • http://www.jpct.net
Re: Does TextureManager Operate on a Parallel Thread?
« Reply #4 on: January 13, 2018, 12:09:38 am »
It actually can't fail. It's a simple list of names associated with texture instances. addTexture is an extremely simple operation. If you can't assign a texture, chances are that it hasn't been added by your code. You can obtain all the names from the manager. Try to check if it contains the ones that you think it should.

Offline AGP

  • quad
  • ******
  • Posts: 1592
    • View Profile
Re: Does TextureManager Operate on a Parallel Thread?
« Reply #5 on: January 13, 2018, 06:41:15 am »
It did because the loader and the texture weren't in the same directory. I fixed it by getting the absolute path. Would it be possible to add a line identifying the fact that the problem is coming from trying to load the texture, rather than when loading the model?