jPCT-AE - a 3d engine for Android > Bugs

Config.maxTextures doesn't work as assumed

(1/2) > >>

say-V:
By default Conf.maxTextures = 64 that's clear. But I assumed this means that there can not be more textures than 64 at a time, but sure can be more in the whole lifecycle of the app. In my case I use a lot of textures, but not at a time, I also unload and remove old textures that I don't need anymore. I have never more than ~30 textures in use at a time, but nevertheless after some time I get an error.

--- Quote ---ERROR: Too many textures added to the TextureManager. Adjust Config.maxTextures!
--- End quote ---

Pseudo-Code for testing:

--- Code: ---for i = 0 ... 100
   textureName = "label" + i
   textureManager.addTexture(textureName, createTextureFromString(textureName)
   testPlane.setTexture(textureName)  // so it gets uploaded to GPU
   if (i >= 30) {
      textureManager.removeAndUnload("label" + (i - 30), fb)  // should remove and unload from GPU and TextureManager
      Logger.log(textureManager.getTextureCount())
   }
end for

--- End code ---

Of course I could increase Conf.maxTextures. But that doesn't change the root problem, so I thought I post it.

btw:
--- Quote ---The manager wil increase the value if needed
--- End quote ---
there is a spelling mistake (and I think the manager doesn't increase the value, otherwise there would be no error I assume).

I'm already looking forward to finish my project and post it here on the board  :D
jPCT-AE is a great engine!!!

EgonOlsen:
Which version of jPCT-AE are you using? 1.24 should actually fix this problem. That aside, it's better to use replaceTexture() instead of removeTexture()/addTexture() if possible.

say-V:
A side note: in the meantime I tried to use Config.maxTextures = Integer.maxValue; but this approach failed already on launching because it seems that an array with length Config.maxTextures is allocated by TextureManager. So using big values for this variable is really not a good idea.

I'm using 1.24 now and it works almost perfect. But when I set eg. Config.maxTextures = 10; and I add more than 10 textures I don't get a error from the texture manager anymore, but instead an ArrayIndexOutOfBoundsException from runtime directly. Maybe you want to fix that.

replaceTexture() -> thanks for the tipp!


EgonOlsen:
Opps...that shouldn't happen. I'll look at it...

EgonOlsen:
I can't verify this problem...can you please post a complete stack trace?

Navigation

[0] Message Index

[#] Next page

Go to full version