Any good ideas how to programmatically adapt to vram limits?

Well I have

x = textures and

y = vramlimit and

z = maxresolution supported by platform.

Now I try to think of a way to reduce x if needed to fit x*x.memoryneed <= y and x <= z

The basic question is, what are the ways I can reduce texture size?

Two basic ideas: Generate for each texture deifferent resolution versions and use the most appropiate.

Pro: Everything can be precalculated

Contra: Need at every location textures are used a switch depending on the wanted max resolution

Somehow abuse Mipmaps for this. Is there a way to specify wich level is loaded as level 0? So I can set the highest version to level 3 for example to have only textures sized at one third?

Pro: Again everything can be precomupted

Contra: I don’t know if mipmaps can be used this way, and I assume I have to manipulate the AssetLoader to archive this.

Any ideas on this one ?

Yes, it is possible to shift the mipmaps, so level 1 is uploaded as level 0.

However, this will only work with pre-generated mipmaps, that means all your textures must use the DDS format.

Another way is to just resize all textures through some automated utility and put them along side the other with some suffix like “_low”, Irfanview should be able to handle this job nicely.

Well the images are all in dds, since I’m about to reach the vram limits currently anyway. (Jme does use dds as a compressed format? “glCompressedTexImage2D()”).

Is there a function for that(can’t find one in Image/texture2d) already in Jme or doe I have to use low level calls/create a function for this?

And if you wonder what I’m currently trying to archive, I’m working on a megatextureatlas system for jme. Not exaclty what the System in the id5 engine does but with a similar Idea in background.

If the textures are encoded as DXT/S3TC, then they will be sent as such to OGL.

Unfortunately there’s no function to shift the mipmap that is used right now, but I see the code has been commented out for that

Well when I reached the point where I need this, i will implement one ( and also a limit for the highest level as 1x1 textures usually does not work with atlases ^^)