diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
index f5d1e6d..da70c0a 100644
--- a/src/core/api/qtwebenginecoreglobal.cpp
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -43,13 +43,16 @@
 #include <QOpenGLContext>
 #include <QThread>
 
+#ifndef QT_NO_OPENGL
 QT_BEGIN_NAMESPACE
 Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
 Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
 QT_END_NAMESPACE
+#endif
 
 namespace QtWebEngineCore {
 
+#ifndef QT_NO_OPENGL
 static QOpenGLContext *shareContext;
 
 static void deleteShareContext()
@@ -57,6 +60,7 @@ static void deleteShareContext()
     delete shareContext;
     shareContext = 0;
 }
+#endif
 
 // ### Qt 6: unify this logic and Qt::AA_ShareOpenGLContexts.
 // QtWebEngine::initialize was introduced first and meant to be called
@@ -69,6 +73,7 @@ QWEBENGINE_PRIVATE_EXPORT void initialize()
     qputenv("QT_D3DCREATE_MULTITHREADED", "1");
 #endif
 
+#ifndef QT_NO_OPENGL
     // No need to override the shared context if QApplication already set one (e.g with Qt::AA_ShareOpenGLContexts).
     if (qt_gl_global_share_context())
         return;
@@ -100,5 +105,6 @@ QWEBENGINE_PRIVATE_EXPORT void initialize()
 
     // Classes like QOpenGLWidget check for the attribute
     app->setAttribute(Qt::AA_ShareOpenGLContexts);
+#endif
 }
 } // namespace QtWebEngineCore
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 8da5e26..fdf0e9d 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -315,12 +315,14 @@ private:
 
 void ShareGroupQtQuick::AboutToAddFirstContext()
 {
+#ifndef QT_NO_OPENGL
     // This currently has to be setup by ::main in all applications using QQuickWebEngineView with delegated rendering.
     QOpenGLContext *shareContext = qt_gl_global_share_context();
     if (!shareContext) {
         qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function.");
     }
     m_shareContextQtQuick = make_scoped_refptr(new QtShareGLContext(shareContext));
+#endif
 }
 
 class QuotaPermissionContextQt : public content::QuotaPermissionContext {
diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp
index 9674bbd..2a2904c 100644
--- a/src/core/delegated_frame_node.cpp
+++ b/src/core/delegated_frame_node.cpp
@@ -84,11 +84,28 @@
 #include <QSGImageNode>
 #endif
 
+
 #if !defined(QT_NO_EGL)
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
 #endif
 
+#ifndef GL_RGB
+#define GL_RGB                            0x1907
+#endif
+
+#ifndef GL_RGBA
+#define GL_RGBA                           0x1908
+#endif
+
+#ifndef GL_LINEAR
+#define GL_LINEAR                         0x2601
+#endif
+
+#ifndef GL_TEXTURE_2D
+#define GL_TEXTURE_2D                     0x0DE1
+#endif
+
 #ifndef GL_TIMEOUT_IGNORED
 #define GL_TIMEOUT_IGNORED                0xFFFFFFFFFFFFFFFFull
 #endif
@@ -99,7 +116,12 @@
 
 namespace QtWebEngineCore {
 
-class MailboxTexture : public QSGTexture, protected QOpenGLFunctions {
+class MailboxTexture
+        : public QSGTexture
+#ifndef QT_NO_OPENGL
+        , protected QOpenGLFunctions
+#endif
+{
 public:
     MailboxTexture(const gpu::MailboxHolder &mailboxHolder, const QSize textureSize);
     virtual int textureId() const Q_DECL_OVERRIDE { return m_textureId; }
@@ -198,6 +220,7 @@ static QSGNode *buildLayerChain(QSGNode *chainParent, const cc::SharedQuadState
     return layerChain;
 }
 
+#ifndef QT_NO_OPENGL
 static void waitChromiumSync(gfx::TransferableFence *sync)
 {
     // Chromium uses its own GL bindings and stores in in thread local storage.
@@ -284,6 +307,7 @@ static void deleteChromiumSync(gfx::TransferableFence *sync)
     // If Chromium was able to create a sync, we should have been able to handle its type here too.
     Q_ASSERT(!*sync);
 }
+#endif
 
 MailboxTexture::MailboxTexture(const gpu::MailboxHolder &mailboxHolder, const QSize textureSize)
     : m_mailboxHolder(mailboxHolder)
@@ -292,7 +316,9 @@ MailboxTexture::MailboxTexture(const gpu::MailboxHolder &mailboxHolder, const QS
     , m_hasAlpha(false)
     , m_target(GL_TEXTURE_2D)
 {
+#ifndef QT_NO_OPENGL
     initializeOpenGLFunctions();
+#endif
 
     // Assume that resources without a size will be used with a full source rect.
     // Setting a size of 1x1 will let any texture node compute a normalized source
@@ -303,7 +329,9 @@ MailboxTexture::MailboxTexture(const gpu::MailboxHolder &mailboxHolder, const QS
 
 void MailboxTexture::bind()
 {
+#ifndef QT_NO_OPENGL
     glBindTexture(m_target, m_textureId);
+#endif
 #ifdef Q_OS_QNX
     if (m_target == GL_TEXTURE_EXTERNAL_OES) {
         static bool resolved = false;
@@ -580,7 +608,7 @@ void DelegatedFrameNode::commit(ChromiumCompositorData *chromiumCompositorData,
                 QSGGeometryNode *geometryNode = new QSGGeometryNode;
 
                 QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 4);
-                geometry->setDrawingMode(GL_LINE_LOOP);
+                geometry->setDrawingMode(QSGGeometry::DrawLineLoop);
                 geometry->setLineWidth(dbquad->width);
                 // QSGGeometry::updateRectGeometry would actually set the corners in the following order:
                 // top-left, bottom-left, top-right, bottom-right, leading to a nice criss cross, instead
@@ -728,6 +756,7 @@ void DelegatedFrameNode::fetchAndSyncMailboxes(QList<MailboxTexture *> &mailboxe
         m_textureFences.swap(transferredFences);
     }
 
+#ifndef QT_NO_OPENGL
     Q_FOREACH (gfx::TransferableFence sync, transferredFences) {
         // We need to wait on the fences on the Qt current context, and
         // can therefore not use GLFence routines that uses a different
@@ -786,6 +815,7 @@ void DelegatedFrameNode::fetchAndSyncMailboxes(QList<MailboxTexture *> &mailboxe
         }
     }
 #endif
+#endif
 }
 
 
diff --git a/src/core/gl_context_qt.cpp b/src/core/gl_context_qt.cpp
index 0cf8736..5d29f41 100644
--- a/src/core/gl_context_qt.cpp
+++ b/src/core/gl_context_qt.cpp
@@ -63,11 +63,15 @@ namespace {
 
 inline void *resourceForContext(const QByteArray &resource)
 {
+#ifndef QT_NO_OPENGL
     QOpenGLContext *shareContext = qt_gl_global_share_context();
     if (!shareContext) {
         qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function.");
     }
     return qApp->platformNativeInterface()->nativeResourceForContext(resource, shareContext);
+#else
+    return nullptr;
+#endif
 }
 
 inline void *resourceForIntegration(const QByteArray &resource)
diff --git a/src/core/stream_video_node.cpp b/src/core/stream_video_node.cpp
index 81b76a2..9da1849 100644
--- a/src/core/stream_video_node.cpp
+++ b/src/core/stream_video_node.cpp
@@ -43,6 +43,7 @@
 
 namespace QtWebEngineCore {
 
+#ifndef QT_NO_OPENGL
 class StreamVideoMaterialShader : public QSGMaterialShader
 {
 public:
@@ -131,6 +132,7 @@ void StreamVideoMaterialShader::updateState(const RenderState &state, QSGMateria
 
     program()->setUniformValue(m_id_texMatrix, mat->m_texMatrix);
 }
+#endif
 
 StreamVideoMaterial::StreamVideoMaterial(QSGTexture *texture, TextureTarget target)
     : m_texture(texture)
@@ -140,7 +142,11 @@ StreamVideoMaterial::StreamVideoMaterial(QSGTexture *texture, TextureTarget targ
 
 QSGMaterialShader *StreamVideoMaterial::createShader() const
 {
+#ifndef QT_NO_OPENGL
     return new StreamVideoMaterialShader(m_target);
+#else
+    return nullptr;
+#endif
 }
 
 StreamVideoNode::StreamVideoNode(QSGTexture *texture, bool flip, TextureTarget target)
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 43dc943..cb523c1 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -110,6 +110,7 @@ void destroyContext()
     sContext = 0;
 }
 
+#ifndef QT_NO_OPENGL
 bool usingANGLE()
 {
 #if defined(Q_OS_WIN)
@@ -155,6 +156,7 @@ bool usingQtQuick2DRenderer()
     // Anything other than the default OpenGL device will need to render in 2D mode.
     return device != QLatin1String("default");
 }
+#endif
 
 #if defined(ENABLE_PLUGINS)
 void dummyGetPluginCallback(const std::vector<content::WebPluginInfo>&)
@@ -301,6 +303,7 @@ WebEngineContext::WebEngineContext()
 
     GLContextHelper::initialize();
 
+#ifndef QT_NO_OPENGL
     if (usingANGLE() || usingSoftwareDynamicGL() || usingQtQuick2DRenderer()) {
         parsedCommandLine->AppendSwitch(switches::kDisableGpu);
     } else {
@@ -326,6 +329,9 @@ WebEngineContext::WebEngineContext()
 
         parsedCommandLine->AppendSwitchASCII(switches::kUseGL, glType);
     }
+#else
+    parsedCommandLine->AppendSwitch(switches::kDisableGpu);
+#endif
 
     content::UtilityProcessHostImpl::RegisterUtilityMainThreadFactory(content::CreateInProcessUtilityThread);
     content::RenderProcessHostImpl::RegisterRendererMainThreadFactory(content::CreateInProcessRendererThread);
diff --git a/src/core/yuv_video_node.cpp b/src/core/yuv_video_node.cpp
index 16e5257..e9d9005 100644
--- a/src/core/yuv_video_node.cpp
+++ b/src/core/yuv_video_node.cpp
@@ -50,6 +50,8 @@
 
 namespace QtWebEngineCore {
 
+#ifndef QT_NO_OPENGL
+
 class YUVVideoMaterialShader : public QSGMaterialShader
 {
 public:
@@ -320,6 +322,7 @@ void YUVAVideoMaterialShader::updateState(const RenderState &state, QSGMaterial
     glFuncs.glActiveTexture(GL_TEXTURE0);
 }
 
+#endif
 
 YUVVideoMaterial::YUVVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, QSGTexture *vTexture,
                                    const QRectF &yaTexCoordRect, const QRectF &uvTexCoordRect, const QSizeF &yaTexSize, const QSizeF &uvTexSize,
@@ -340,7 +343,11 @@ YUVVideoMaterial::YUVVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture, Q
 
 QSGMaterialShader *YUVVideoMaterial::createShader() const
 {
+#ifndef QT_NO_OPENGL
     return new YUVVideoMaterialShader;
+#else
+    return nullptr;
+#endif
 }
 
 int YUVVideoMaterial::compare(const QSGMaterial *other) const
@@ -365,7 +372,11 @@ YUVAVideoMaterial::YUVAVideoMaterial(QSGTexture *yTexture, QSGTexture *uTexture,
 
 QSGMaterialShader *YUVAVideoMaterial::createShader() const
 {
+#ifndef QT_NO_OPENGL
     return new YUVAVideoMaterialShader;
+#else
+    return nullptr;
+#endif
 }
 
 int YUVAVideoMaterial::compare(const QSGMaterial *other) const
