18QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(
const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display)
19 : QEGLPlatformContext(format, share, display,
nullptr)
23void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface)
25 if (surface->surface()->surfaceClass() != QSurface::Window) {
26 QEGLPlatformContext::swapBuffers(surface);
30 QAndroidPlatformOpenGLWindow *window =
static_cast<QAndroidPlatformOpenGLWindow *>(surface);
37 if (window->ensureEglSurfaceCreated(eglConfig())) {
39 QEGLPlatformContext::makeCurrent(surface);
41 QEGLPlatformContext::swapBuffers(surface);
46bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface)
48 if (surface->surface()->surfaceClass() != QSurface::Window)
49 return QEGLPlatformContext::makeCurrent(surface);
51 QAndroidPlatformOpenGLWindow *window =
static_cast<QAndroidPlatformOpenGLWindow *>(surface);
54 if (window->eglSurface(eglConfig()) == EGL_NO_SURFACE) {
55 qWarning() <<
"makeCurrent(): no EGLSurface, likely Surface destroyed by Android.";
59 const bool ok = QEGLPlatformContext::makeCurrent(surface);
66EGLSurface QAndroidPlatformOpenGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
68 if (surface->surface()->surfaceClass() == QSurface::Window) {
69 return static_cast<QAndroidPlatformOpenGLWindow *>(surface)->eglSurface(eglConfig());
71 if (
auto *platformOffscreenSurface =
dynamic_cast<QAndroidPlatformOffscreenSurface *>(surface))
72 return platformOffscreenSurface->surface();
74 return static_cast<QEGLPbuffer *>(surface)->pbuffer();