Texture compression like DXT but lossless

@pspeed said: An 8192x8192 texture? But my monitor at max can only show 1920x1200. Seems like more data is provided than is needed.

We may need to know more about what you are doing and why you can’t page in relevant sections as needed.


Yeah, I wanted to avoid paging if possible, but if nothing else will work I’ll look into it.
Could you please help me with how can I save an Image to disk from code in the ARGB4444 format? Is it even supported by jMonkey?

@jadam said: Yeah, I wanted to avoid paging if possible, but if nothing else will work I'll look into it. Could you please help me with how can I save an Image to disk from code in the ARGB4444 format? Is it even supported by jMonkey?

In code?
http://docs.oracle.com/javase/6/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,%20java.lang.String,%20java.io.File)

@pspeed said: In code? http://docs.oracle.com/javase/6/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,%20java.lang.String,%20java.io.File)
Thanks! Another question: if I implement paging of my province map, can I somehow force jMonkey to unload textures? Is losing reference enough to let GC happen on loaded textures or do I have to do something else too?
@jadam said: Thanks! Another question: if I implement paging of my province map, can I somehow force jMonkey to unload textures? Is losing reference enough to let GC happen on loaded textures or do I have to do something else too?

I hereby invoke the ancient power of the javadoc whose knowledge has been passed down from generation to generation from my ancestors who first came to this world. This ancient lore has been mine to safeguard against the forces of tyranny, that it be used only for good and to further knowledge. Elements of earth and sky! Heed my will and conjure forth said link:
http://hub.jmonkeyengine.org/javadoc/com/jme3/asset/DesktopAssetManager.html#deleteFromCache(com.jme3.asset.AssetKey)

:slight_smile: Sometimes people get upset when I just paste a link.

2 Likes
@pspeed said: I hereby invoke the ancient power of the javadoc whose knowledge has been passed down from generation to generation from my ancestors who first came to this world. This ancient lore has been mine to safeguard against the forces of tyranny, that it be used only for good and to further knowledge. Elements of earth and sky! Heed my will and conjure forth said link: http://hub.jmonkeyengine.org/javadoc/com/jme3/asset/DesktopAssetManager.html#deleteFromCache(com.jme3.asset.AssetKey)

:slight_smile: Sometimes people get upset when I just paste a link.


That’s fine, just fine! Thanks a lot!

@pspeed said: I hereby invoke the ancient power of the javadoc whose knowledge has been passed down from generation to generation from my ancestors who first came to this world. This ancient lore has been mine to safeguard against the forces of tyranny, that it be used only for good and to further knowledge. Elements of earth and sky! Heed my will and conjure forth said link: http://hub.jmonkeyengine.org/javadoc/com/jme3/asset/DesktopAssetManager.html#deleteFromCache(com.jme3.asset.AssetKey)

:slight_smile: Sometimes people get upset when I just paste a link.


Hey,

I’ve went forward and implemented the paged system but when I scroll through the map and monitor the memory consumption of my game via task manager I see only in increase. Like if memory is not freed even though I’m pretty sure I got rid of all references and called the deleteFromCache on the texture as well.

Or will the memory consumption decrease be not visible, is it only the GC taking time to work?

Here is how I free up my texture:

[java]
mapPartGeometry.removeFromParent();
mapPartGeometry = null;
((DesktopAssetManager)assetManager).deleteFromCache(provinceMap.getKey());
((DesktopAssetManager)assetManager).deleteFromCache(mapPartMaterial.getKey());
provinceMap = null;
mapPartMaterial = null;
[/java]

Might be, try limiting the heap to a lower amount and see if this triggers garbagecollections.

@pspeed said: In code? http://docs.oracle.com/javase/6/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,%20java.lang.String,%20java.io.File)

It seems that BufferedImage does not support ARGB4444, is this format for Android only or is there a way to save an image in that format on the PC (short of writing my own encoder)?

@jadam said: Hey,

I’ve went forward and implemented the paged system but when I scroll through the map and monitor the memory consumption of my game via task manager I see only in increase. Like if memory is not freed even though I’m pretty sure I got rid of all references and called the deleteFromCache on the texture as well.

Or will the memory consumption decrease be not visible, is it only the GC taking time to work?

Here is how I free up my texture:

[java]
mapPartGeometry.removeFromParent();
mapPartGeometry = null;
((DesktopAssetManager)assetManager).deleteFromCache(provinceMap.getKey());
((DesktopAssetManager)assetManager).deleteFromCache(mapPartMaterial.getKey());
provinceMap = null;
mapPartMaterial = null;
[/java]

You can’t really see direct memory in any of javas ways to show how much memory it uses, it actually doesn’t know about direct memory which is why it handles it so poorly. The java heap size does not include direct memory for example, only the memory for the reference to the direct memory chunk, which is negligible. This is why counter-intuitively lowering the heap memory might alleviate direct memory issues because the GC runs more often. Memory usage displays integrated in the OS (Task Manager etc.) might give you more insight about how much memory your java app uses but is also not a 100% accurate display.

…and if you run on Java 7 then JME’s MemoryUtils class can also show you how much direct memory is used.

@normen said: Memory usage displays integrated in the OS (Task Manager etc.) might give you more insight about how much memory your java app uses but is also not a 100% accurate display.

What are the inaccuracies here?
I know about chunking effects and that memory is never returned, but is there more?
'cause chunking and never returning aren’t a problem if you want to see whether there’s a memory leak, that one you can see. Usually, anyway.

Please take a look at
http://hirt.se/blog/?p=401

There are some options to help with native memory tracking.