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

About defaultToKeepPixels

(1/5) > >>

kiffa:
If i set defaultToKeepPixels=false; the texture in vm will be free after uploaded to gpu.

And you don't suggest doing like this, because if the OpenGL context change, there will some bad things happen.

Could you explain more? When and how will the OpenGL context change? if  defaultToKeepPixels==false and OpenGL conext changed, what will happen?

EgonOlsen:
The context changes if you rotate the screen, pause/resume the app...and in some Android versions even right after startup. Without the pixels, you'll lose textures because they have to be uploaded and bound to the new context. If you are using a Virtualizer, you are not gaining any memory by setting this to false btw.

Thomas.:
Context is not changed while rotating the screen if you have line below in your manifest.

--- Code: ---android:restoreNeedsApplication="true"
--- End code ---

edit: How can I back textures after context changes? I tried load all textures, but it causes out of memory error...

EgonOlsen:
You have to flush the TextureManager and load everything from scratch. But it's easier to use the Virtualizer instead. I still don't get what you are doing that eats up all the memory...how large are your assets? If loading the textures causes trouble, then they are either too big, too many...or the rest of the data used is too large.

Thomas.:
Ok, I'll try it. If I set "Texture.defaultToKeepPixels = false;" my game has 17MB, otherwise 48MB. All textures are in 1024*1024 (I prefer larger textures, It looks much better in my opinion).

edit: could you tell me what is on the line 2134 in GLRenderer? I have some NullPointerException... But when I think about uploading of new textures, TextureManager.flush() causes a lot of problems in this case. Texture layers is linked by texture id, and this id will be probably completely different in new texture manager... Is there any way how to keep textures out of main memory, but avoid problems when context is changed?

edit2: oh, just two posts before... Virtualizer, it is much, much slower (loading time increased about 50%), but I have much more free VM.

And is possible find how much free GPU memory is?

Navigation

[0] Message Index

[#] Next page

Go to full version