<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How can I show a blank QGLWidget as a popup?]]></title><description><![CDATA[<p dir="auto">I already have  a main window with a number of widgets and a QGLWidget on it.</p>
<p dir="auto">I want to create another QGLWidget which opens as a new window.</p>
<p dir="auto">ProjectedHand.h<br />
@#ifndef _GLWIDGET_H<br />
#define _GLWIDGET_H</p>
<p dir="auto">#include &lt;QtOpenGL/QGLWidget&gt;<br />
#include &lt;QDebug&gt;</p>
<p dir="auto">class ProjectedHand : public QGLWidget {</p>
<pre><code>Q_OBJECT // must include this if you use Qt signals/slots
</code></pre>
<p dir="auto">public:<br />
ProjectedHand(QWidget *parent = NULL);</p>
<p dir="auto">protected:<br />
void initializeGL();<br />
void resizeGL(int w, int h);<br />
void paintGL();<br />
};</p>
<p dir="auto">#endif  /* _GLWIDGET_H */@</p>
<p dir="auto">ProjectedHand.cpp<br />
@#include &lt;QtGui/QMouseEvent&gt;<br />
#include "ProjectedHand.h"</p>
<p dir="auto">ProjectedHand::ProjectedHand(QWidget *parent) : QGLWidget(parent) {</p>
<p dir="auto">}</p>
<p dir="auto">void ProjectedHand::initializeGL() {<br />
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);<br />
}</p>
<p dir="auto">void ProjectedHand::resizeGL(int w, int h) {</p>
<p dir="auto">}<br />
void ProjectedHand::paintGL() {<br />
static bool screenOnBlank = false;<br />
if (!screenOnBlank) {<br />
qDebug("Painting grey-ness");<br />
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);<br />
glClear(GL_COLOR_BUFFER_BIT);<br />
screenOnBlank = true;<br />
}<br />
}@</p>
<p dir="auto">Then, from another class, I call:<br />
@ProjectedHand *window =  new ProjectedHand(NULL);<br />
window-&gt;resize(800,600);<br />
window-&gt;show();@</p>
<p dir="auto">It gives me a popup, but the window is not blank. It's a window containing a distorted view of what I see on my main window.</p>
]]></description><link>https://forum.qt.io/topic/29544/how-can-i-show-a-blank-qglwidget-as-a-popup</link><generator>RSS for Node</generator><lastBuildDate>Sat, 06 Jun 2026 22:43:14 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/29544.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 17 Jul 2013 14:19:32 GMT</pubDate><ttl>60</ttl></channel></rss>