Example #1
0
void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
{
    if (!context || !context->handle()) {
        qWarning("%s: '%s' requested for null context or context without handle.", __FUNCTION__, resource.constData());
        return 0;
    }
    QWindowsGLContext *windowsContext = static_cast<QWindowsGLContext *>(context->handle());
    if (resource == "renderingContext")
        return windowsContext->renderingContext();

    qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
    return 0;
}
Example #2
0
void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
{
    if (!context || !context->handle()) {
        qWarning("%s: '%s' requested for null context or context without handle.", __FUNCTION__, resource.constData());
        return 0;
    }
#ifdef QT_OPENGL_ES_2
    QWindowsEGLContext *windowsEglContext = static_cast<QWindowsEGLContext *>(context->handle());
    if (resource == QByteArrayLiteral("eglDisplay"))
        return windowsEglContext->eglDisplay();
    if (resource == QByteArrayLiteral("eglContext"))
        return windowsEglContext->eglContext();
    if (resource == QByteArrayLiteral("eglConfig"))
        return windowsEglContext->eglConfig();
#else // QT_OPENGL_ES_2
    QWindowsGLContext *windowsContext = static_cast<QWindowsGLContext *>(context->handle());
    if (resource == QByteArrayLiteral("renderingContext"))
        return windowsContext->renderingContext();
#endif // !QT_OPENGL_ES_2

    qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
    return 0;
}