Hi all,

switching my application from using QGLWidget to the new QOpenGLWidget I noticed a very weird problem when using the application through Remote Desktop on Windows. The whole application is fully black, it is not properly rendered, not only the QOpenGLWidget, but also the other widgets in the application.

I created a very simple example demonstrating my issue.

MyWidget::MyWidget(QWidget* parent, Qt::WindowFlags fl)
    : QWidget(parent, fl)
{
    QVBoxLayout *vBoxLayout = new QVBoxLayout(this);
    QHBoxLayout *hLayout = new QHBoxLayout;

    QLabel *myLabel = new QLabel("Test", this);
    QPushButton *myButton = new QPushButton("Test", this);
    hLayout->addWidget(myLabel);
    hLayout->addWidget(myButton);

    QGLWidget *myOPenGLWidget = new QGLWidget(this);
// QOpenGLWidget *myOPenGLWidget = new QOpenGLWidget(this);// this causes bad app rendering on Remote Desktop

    vBoxLayout->addItem(hLayout);
    vBoxLayout->addWidget(myOPenGLWidget);
}

When I use QGLWidget the widgets are properly rendered, as you can see in the attached image. When I replace the QGLWidget with its counter part QOpenGLWidget then the whole app is fully black when launched through remote desktop (on Windows), no widget is rendered (see other image attached). If I run the application on my local machine, then everything is properly rendered.

Am I doing something wrong? Or is this a limit/bug in Qt (I'm using latest Qt version, 5.4.1)?

This is my main

int main( int argc, char *argv[] )
{
    QApplication appMain(argc, argv);

    MyWidget *mainWin = new MyWidget;
    mainWin->show();

    return appMain.exec();
}

I enabled qt.qpa.gl debugging and this is the output of the application in the two cases.

Output in case of QGLWidget enabled:
[...]
qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 1, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 1, samples -1, swapBehavior 2, swapInterval -1, profile 0)
qt.qpa.gl: Qt: Using WGL and OpenGL from "opengl32.dll"
qt.qpa.gl: QOpenGLStaticContext::create OpenGL: "Microsoft Corporation","GDI Generic" default ContextFormat: v1.1 profile: 0 options: QFlags(0x4)
Extensions: 3
qt.qpa.gl: QWindowsGLContext::QWindowsGLContext 0x6be850 GDI requested: QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 1, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 1, samples -1, swapBehavior 2, swapInterval -1, profile 0) obtained # 8 GDI QSurfaceFormat(version 1.1, options QFlags(0x4), depthBufferSize 16, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile 0) PIXELFORMATDESCRIPTOR dwFlags=0x465 PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL PFD_GENERIC_FORMAT PFD_DOUBLEBUFFER iPixelType=0 cColorBits=32 cRedBits=8 cRedShift=16 cGreenBits=8 cGreenShift=8 cBlueBits=8 cBlueShift=0 cDepthBits=16 cStencilBits=8 iLayerType=0 cAlphaBits=8 cAlphaShift=0 cAccumBits=64 cAccumRedBits=16 cAccumGreenBits=16 cAccumBlueBits=16 cAccumAlphaBits=16 swap interval: -1
    default: ContextFormat: v1.1 profile: 0 options: QFlags(0x4)
    HGLRC=0x20000
[...]

Output in case of QOpenGLWidget enabled:
[...]
qt.qpa.gl: QWindowsIntegration::createPlatformOpenGLContext QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize -1, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior 0, swapInterval 1, profile 0)
qt.qpa.gl: Qt: Using WGL and OpenGL from "opengl32.dll"
qt.qpa.gl: QOpenGLStaticContext::create OpenGL: "Microsoft Corporation","GDI Generic" default ContextFormat: v1.1 profile: 0 options: QFlags(0x4)
Extensions: 3
qt.qpa.gl: QWindowsGLContext::QWindowsGLContext 0x4c0e68 GDI requested: QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize -1, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior 0, swapInterval 1, profile 0) obtained # 7 GDI QSurfaceFormat(version 1.1, options QFlags(0x4), depthBufferSize 32, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile 0) PIXELFORMATDESCRIPTOR dwFlags=0x465 PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL PFD_GENERIC_FORMAT PFD_DOUBLEBUFFER iPixelType=0 cColorBits=32 cRedBits=8 cRedShift=16 cGreenBits=8 cGreenShift=8 cBlueBits=8 cBlueShift=0 cDepthBits=32 cStencilBits=8 iLayerType=0 cAlphaBits=8 cAlphaShift=0 cAccumBits=64 cAccumRedBits=16 cAccumGreenBits=16 cAccumBlueBits=16 cAccumAlphaBits=16 swap interval: -1
    default: ContextFormat: v1.1 profile: 0 options: QFlags(0x4)
    HGLRC=0x20000
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
bool __thiscall QOpenGLTextureBlitter::create(void) Could not link shader program:
 ""
QOpenGLBuffer::bind(): buffer not created
QOpenGLBuffer::release(): buffer not created
QOpenGLBuffer::bind(): buffer not created
QOpenGLBuffer::release(): buffer not created
[...]

Thanks in advance for your help!
Calogero

--
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to