Black objects after orientation change/returning from standby on the phone/pad

Started by Windmiller, April 27, 2020, 09:06:29 AM

Previous topic - Next topic

Windmiller

Hello

Some objects (Randomly) are turning into black after screen orientation change or powering up from standby,
they do not come back from that black state.
Completely black, no light reflections or anything. It doesn't matter how many objects I'm loading or whether they have textures or not even if I'm just using Primitives getCube. This happens on both my devises that I'm testing on (a Nexus 7 and a Samsung Galaxy 8)

I don't understand why this happens, my project is the HelloWorld that I've changed a bit but not much.
Anyone who can recognize the behavior and give me a light pointing in the right direction?

Edit: seems to be something with that I'm using..


shareCompiledData(mObj);
shareTextureData(mObj);


Edit 2: Actually it seems to be in combination with this line..


.setEnvmapped(Object3D.ENVMAP_ENABLED);


If I remove the  environment mapping for the object the problem goes away!? Why??

Regards, M

MichaelJPCT

phone rotates or resumes causes framebuffer change, gl context lost...
in that situation, framebuffer must be re-created, and any render-to-texture must be rendered again.
and if texel of a texture is not kept in system ram, you need to reload the texture from file.
in Config class and Texture class , there are some setting you must know about - you are new to the engine, it will take time for you to get familiar with the engine. i used jpct a few years and there are something i still don't know.

AeroShark333

To avoid GL context loss, you might want to use GLSurfaceView#setPreserveEGLContextOnPause(true);

Otherwise you'll need to recreate the framebuffer and the textures would need to be re-uploaded like MichaelJPCT said

Windmiller

Aaah thank you for your replies and explanations, I see and understand.
It was just weird that it was working without the .setEnvmapped(Object3D.ENVMAP_ENABLED);