summaryrefslogtreecommitdiffstats
path: root/examples/opengl/hellogl2/glwidget.cpp
diff options
context:
space:
mode:
authorEven Oscar Andersen <even.oscar.andersen@qt.io>2024-06-25 11:51:47 +0200
committerEven Oscar Andersen <even.oscar.andersen@qt.io>2024-07-01 17:33:48 +0200
commite40fdf19abd4fe6d8f3a31088671bfc1c4aa03cc (patch)
treeed1e2482045dc9b9665270c2f6c0c691dbfa5562 /examples/opengl/hellogl2/glwidget.cpp
parent04b8b61ce56d552c1240a8f5e3f089edc7b56f52 (diff)
wasm: hellogl2 screen is black
We need to reset the OpenGL state in paintGL for the drawing to work, Also, disable the dock/add window functionality as it does not work on webassembly. Change-Id: I480d944bc2029a07d5d49f0a85c3754fbc8cd53c Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'examples/opengl/hellogl2/glwidget.cpp')
-rw-r--r--examples/opengl/hellogl2/glwidget.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/opengl/hellogl2/glwidget.cpp b/examples/opengl/hellogl2/glwidget.cpp
index 6d2ffb3b581..aad83cc2af5 100644
--- a/examples/opengl/hellogl2/glwidget.cpp
+++ b/examples/opengl/hellogl2/glwidget.cpp
@@ -7,6 +7,7 @@
#include <QCoreApplication>
#include <math.h>
+// Set from main
bool GLWidget::m_transparent = false;
GLWidget::GLWidget(QWidget *parent)
@@ -209,9 +210,11 @@ void GLWidget::setupVertexAttribs()
void GLWidget::paintGL()
{
+ glClearColor(0, 0, 0, m_transparent ? 0 : 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
+ setupVertexAttribs();
m_world.setToIdentity();
m_world.rotate(180.0f - (m_xRot / 16.0f), 1, 0, 0);