Skip to content

[BUG] SKGLView don't redraw after return from other page on Android In Maui #2445

Open
@xtuzy

Description

@xtuzy

Description
I use SKGLView in Maui, when it run Android, it will don't redraw after return from other page, see video:

sharex-20230419174159.mp4

I copy your GLTextureView and SKGLTextureView to my project, and create handler for it, Maui view name SKGpuView, when run, the log will show this line:

LogDebug($"[GLThread {Id}] Waiting mHaveEglContext={haveEglContext} mHaveEglSurface={haveEglSurface} mFinishedCreatingEglSurface={finishedCreatingEglSurface} paused={paused} hasSurface={hasSurface} surfaceIsBad={surfaceIsBad} mWaitingForSurface={waitingForSurface} mWidth={width} mHeight={height} mRequestRender={requestRender} mRenderMode={renderMode}");

I find log show width and height is 0 after return from other page.

I read source code of GLTextureView , search where set width and height:

  1. when go to other page, surface will destory, when return from other page, will load GLTextureView.OnAttachedToWindow, then create new GLThread, and set width and height equal to 0.
  2. when GLTextureView.OnLayoutChange, then load GLTextureView.OnSurfaceTextureSizeChanged to set GLThread.OnWindowResize, and then set width and height .

when return from other page, GLTextureView.OnLayoutChange don't be invoked. so width and height is 0

I try use width and height as params of OnSurfaceCreated and set width and height of GLThread, my SKGpuView work.

Code

Expected Behavior

Actual Behavior

Basic Information

  • Version with issue: 2.88.2
  • Last known good version:
  • IDE: Visual Studio
  • Platform Target Frameworks:
    • Android: 12 Api31
    • iOS:
    • Linux:
    • macOS:
    • Tizen:
    • tvOS:
    • UWP:
    • watchOS:
    • Windows Classic:
  • Target Devices:
    • Android Emulator
Detailed IDE/OS information (click to expand)

PASTE ANY DETAILED VERSION INFO HERE

Screenshots

Reproduction Link

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions