How can I create a borderless OpenGL window that covers the whole screen? Currently I'm working in Vista but I would like it to work anywhere.
I have inherited from QGLWidget and gave it no parent so it would be a top level window. I'm currently drawing a fullscreen quad in my paintGL() function. Since Qt doesn't seem to have the ability to change the video mode, I do that using win32 function calls similar to here.
Part of the problem is, I would like this window to be on my second monitor in a dual-monitor setup, and I'll have other Qt windows on the first monitor.
I detect the geometry of the second monitor just fine using:
int j = 0;
for (j
= 0; j <
QApplication::desktop()->numScreens
();
++j
) { if (j != i)
break;
}
int i = QApplication::desktop()->primaryScreen();
int j = 0;
for (j = 0; j < QApplication::desktop()->numScreens(); ++j) {
if (j != i)
break;
}
const QRect rect = QApplication::desktop()->screenGeometry(j);
To copy to clipboard, switch view to plain text mode
I then:
setGeometry(rect);
updateGeometry();
setGeometry(rect);
updateGeometry();
To copy to clipboard, switch view to plain text mode
Which seems to work, except I can see the border of the window on my primary monitor. Also, I can minimize and move the window on the second monitor, which I would like to prevent.
I have tried:
this->showFullscreen();
this->showFullscreen();
To copy to clipboard, switch view to plain text mode
This leaves a black bar above my fullscreen quad that seems to be about the size of the title bar if the title bar was visible.
I have also tried:
setFixedSize(w, h);
setWindowFlags(Qt::FramelessWindowHint);
setFixedSize(w, h);
setWindowFlags(Qt::FramelessWindowHint);
To copy to clipboard, switch view to plain text mode
which fails to create the QGLWidget because the QGLContext fails to create. Apparently you cannot create a frameless OpenGL widget?
I have also tried this->resize(w, h) and this->show() but none of these options seem to create what I want: a fullscreen, borderless/frameless, OpenGL window.
Anyone have any ideas? Thank you.
Bookmarks