Exemplo n.º 1
0
static void *eglContextForContext(QOpenGLContext *context)
{
    Q_ASSERT(context);

    QEglFSContext *handle = static_cast<QEglFSContext *>(context->handle());
    if (!handle)
        return 0;

    return handle->eglContext();
}
Exemplo n.º 2
0
QEGLPlatformContext *QEglFSIntegration::createContext(const QSurfaceFormat &format,
                                                      QPlatformOpenGLContext *shareContext,
                                                      EGLDisplay display,
                                                      QVariant *nativeHandle) const
{
    QEglFSContext *ctx;
    QSurfaceFormat adjustedFormat = qt_egl_device_integration()->surfaceFormatFor(format);
    if (!nativeHandle || nativeHandle->isNull()) {
        EGLConfig config = QEglFSIntegration::chooseConfig(display, adjustedFormat);
        ctx = new QEglFSContext(adjustedFormat, shareContext, display, &config, QVariant());
    } else {
        ctx = new QEglFSContext(adjustedFormat, shareContext, display, 0, *nativeHandle);
    }
    *nativeHandle = QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), display));
    return ctx;
}
Exemplo n.º 3
0
QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
    EGLDisplay dpy = context->screen() ? static_cast<QEglFSScreen *>(context->screen()->handle())->display() : display();
    QPlatformOpenGLContext *share = context->shareHandle();
    QVariant nativeHandle = context->nativeHandle();

    QEglFSContext *ctx;
    QSurfaceFormat adjustedFormat = qt_egl_device_integration()->surfaceFormatFor(context->format());
    if (nativeHandle.isNull()) {
        EGLConfig config = QEglFSIntegration::chooseConfig(dpy, adjustedFormat);
        ctx = new QEglFSContext(adjustedFormat, share, dpy, &config, QVariant());
    } else {
        ctx = new QEglFSContext(adjustedFormat, share, dpy, 0, nativeHandle);
    }
    nativeHandle = QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), dpy));

    context->setNativeHandle(nativeHandle);
    return ctx;
}