Qt4.6.2 crashing after 'simpleShaderProg' fails to compile over ssh
-
When trying to run our app over ssh -Y/-X we are experiencing a crash in Qt due to a shader not being compiled. Linux to Linux crashes (multiple versions of Xorg tested), Mac to Linux is o.k.
We've recompiled Qt4.6.2 from source, fixing the NULL-ptr-access crash but now we're getting some strange rendering results.
In case it helps someone else to fix the crash: simply added some extra guarding around currentShaderProg in QGLengineShaderManager::useCorrectShaderProg() where currentShaderProg is used to call QGLContextPrivate::setVertexAttribArrayEnabled() in qglengineshadermanager.cpp .
The Qt specific log output we're getting is :
@Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile
Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile
Errors linking blit shader: ""@I think we're not using Qt's OpenGL setup correctly but being relatively new to Qt (and OpenGL with Qt) I'm not sure how to go about working out where we're going wrong. Are there any particular state objects I should be looking at or any particular parameters I should be passing to the QGLWidget or QGLFormat?
We can't easily move to a newer Qt version, so we're looking to fix our use of 4.6.2 (or, if neccessary, fix-up 4.6.2) if we can.
Thanks in advance.
p.s. I've found this which seems vaguely related but it for a more recent version of Qt which 4.6.2 doesn't support :
http://developer.qt.nokia.com/forums/viewthread/4856I also found this closed bug which mentions the area I'm looking at but doesn't address the specific problem I'm trying to fix.
https://bugreports.qt.nokia.com/browse/QTBUG-6514?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel#issue-tabs -
A bare-bones example snippet.
@void TestOGLWidget::paintEvent(QPaintEvent* event)
{
QPainter p;
p.begin(this);p.beginNativePainting();
makeCurrent();glClearColor( 0, 0, 0.1f, 0.0 );
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glColor3f(.9f, .7f, .7f);
glBegin(GL_QUADS);
glVertex2i(5, 200);
glVertex2i(200, 200);
glVertex2i(200, 5);
glVertex2i(5, 5);
glEnd();p.drawText(10, 30, "Test 111111");
p.endNativePainting();p.end();
}@TestOGLWidget inherits from QGLWidget.
Over ssh p.drawText(10, 30, "Test 111111"); doesn't render and we get the following warnings :
bq. Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile
Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile
Errors linking simple shader: ""
Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile
Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile
Errors linking blit shader: ""