19QAndroidPlatformOpenGLContext::QAndroidPlatformOpenGLContext(
const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display)
20 : QEGLPlatformContext(format, share, display,
nullptr)
24void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface)
26 if (surface->surface()->surfaceClass() != QSurface::Window) {
27 QEGLPlatformContext::swapBuffers(surface);
31 QAndroidPlatformOpenGLWindow *window =
static_cast<QAndroidPlatformOpenGLWindow *>(surface);
38 if (window->ensureEglSurfaceCreated(eglConfig())) {
40 QEGLPlatformContext::makeCurrent(surface);
42 QEGLPlatformContext::swapBuffers(surface);
47bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface)
49 if (surface->surface()->surfaceClass() != QSurface::Window)
50 return QEGLPlatformContext::makeCurrent(surface);
52 QAndroidPlatformOpenGLWindow *window =
static_cast<QAndroidPlatformOpenGLWindow *>(surface);
55 if (window->eglSurface(eglConfig()) == EGL_NO_SURFACE) {
56 qWarning() <<
"makeCurrent(): no EGLSurface, likely Surface destroyed by Android.";
60 const bool ok = QEGLPlatformContext::makeCurrent(surface);
67EGLSurface QAndroidPlatformOpenGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface)
69 if (surface->surface()->surfaceClass() == QSurface::Window) {
70 return static_cast<QAndroidPlatformOpenGLWindow *>(surface)->eglSurface(eglConfig());
72 if (
auto *platformOffscreenSurface =
dynamic_cast<QAndroidPlatformOffscreenSurface *>(surface))
73 return platformOffscreenSurface->surface();
75 return static_cast<QEGLPbuffer *>(surface)->pbuffer();