Author Topic: Black objects after orientation change/returning from standby on the phone/pad  (Read 2447 times)

Offline Windmiller

  • byte
  • *
  • Posts: 21
    • View Profile
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..

Code: [Select]
shareCompiledData(mObj);
shareTextureData(mObj);

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

Code: [Select]
.setEnvmapped(Object3D.ENVMAP_ENABLED);

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

Regards, M
« Last Edit: December 18, 2021, 06:11:05 pm by Windmiller »

Offline MichaelJPCT

  • float
  • ****
  • Posts: 265
    • View Profile
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.

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
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

Offline Windmiller

  • byte
  • *
  • Posts: 21
    • View Profile
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);