Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

UWP and openGL version problem



  • I'm trying to port my Qt 5.12 Desktop Opengl application to a UWP application compatible with Windows Store.

    At startup, I get errors concerning the compilation of shaders. I didn't write these shaders. These are certainly the shaders of the qml box that opens when my application starts.

    The compilation tells me that there is a problem with the OPEN ES version. The program seems to start in ES 2 and the opengl version should be at least 3.

    QOpenGLShader::compile(Vertex): ERROR: 0:1: 'core' : unexpected token
    ERROR: 0:4: 'in' : storage qualifier supported in GLSL ES 3.00 and above only
    ERROR: 0:5: 'in' : storage qualifier supported in GLSL ES 3.00 and above only
    ERROR: 0:7: 'out' : storage qualifier supported in GLSL ES 3.00 and above only
    ERROR: 0:9: 'in' : storage qualifier supported in GLSL ES 3.00 and above only
    
    *** Problematic Vertex shader source code ***
    #version 150 core
    #line 1
    
    uniform mat4 qt_Matrix;
    
    in vec4 qt_VertexPosition;
    in vec2 qt_VertexTexCoord;
    
    out vec2 qt_TexCoord;
    
    in float _qt_order;
    uniform float _qt_zRange;
    void main()
    {
        qt_TexCoord = qt_VertexTexCoord;
        gl_Position = qt_Matrix * qt_VertexPosition;
        gl_Position.z = (gl_Position.z * _qt_zRange + _qt_order) * gl_Position.w;
    }
    ***
    QOpenGLShader::compile(Fragment): ERROR: 0:1: 'core' : unexpected token
    ERROR: 0:2: 'in' : storage qualifier supported in GLSL ES 3.00 and above only
    ERROR: 0:2: '' : No precision specified for (float)
    ERROR: 0:4: 'out' : storage qualifier supported in GLSL ES 3.00 and above only
    ERROR: 0:4: '' : No precision specified for (float)
    ERROR: 0:10: 'texture' : no matching overloaded function found
    ERROR: 0:10: '=' : dimension mismatch
    ERROR: 0:10: 'assign' : cannot convert from 'const mediump float' to 'out 4-component vector of float'
    

    My main.cpp file looks like this:

    int main(int argc, char* argv[])
    {
    	
    	qreal dimx, dimy;
    
    	static int Result;
    
    	QQuickStyle::setStyle("Material");
    
    	QGuiApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
    
    	QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
    
    	QApplication app(argc, argv);
    
    	QScreen *screen = QGuiApplication::primaryScreen();
    
    	
    		screen->setOrientationUpdateMask(Qt::LandscapeOrientation);
    		dimx = screen->availableGeometry().width();
    		dimy = screen->availableGeometry().height();
    		PixelRatio = screen->devicePixelRatio();
    		physicalSize = screen->physicalSize().width();
    	
    
    	QSurfaceFormat format;
    	format.setDepthBufferSize(24);
    
    	QSurfaceFormat::SwapBehavior swap = QSurfaceFormat::DefaultSwapBehavior;
    
    	if (buffer == "SingleBuffer") swap = QSurfaceFormat::SingleBuffer;
    	if (buffer == "DoubleBuffer") swap = QSurfaceFormat::DoubleBuffer;
    	if (buffer == "TripleBuffer") swap = QSurfaceFormat::TripleBuffer;
    
    	format.setSwapBehavior(swap);
    
    #if defined(Q_OS_ANDROID)
    	format.setRenderableType(QSurfaceFormat::OpenGLES);
    #else
    	format.setRenderableType(QSurfaceFormat::OpenGL);	
    #endif
    
    	format.setBlueBufferSize(8);
    	format.setRedBufferSize(8);
    	format.setGreenBufferSize(8);
    	format.setSamples(multisampling.toInt());
    
    	format.setProfile(QSurfaceFormat::CoreProfile);
    	format.setOption(QSurfaceFormat::DebugContext);
    
    
    	QSurfaceFormat::setDefaultFormat(format);
    
    	QIcon icon(":res/icon.jpg");
    	app.setWindowIcon(icon);
    
    #ifndef QT_NO_OPENGL
    
    	QApplication *widget;
    	widget = new QApplication ();
    
    	widget->setAttribute(Qt::WA_AcceptTouchEvents);
    
    	widget->setAttribute(Qt::WA_DeleteOnClose);
    	
    	widget->grabGesture(Qt::PinchGesture);
    
    	if (FullScreen)
    	{
    		widget->showFullScreen();
    	}
    	else
    	{
    		widget->showMaximized();
    	}
    
    #else
    	QLabel note("OpenGL Support required");
    	note.show();
    #endif
    
    #if defined(Q_OS_ANDROID)
    
    	widget->resizeGL(dimx, dimy);
    
    #endif
    
    	Result = app.exec();
    
    	return Result;
    }
    

    Why does the program start in openGl ES when I ask it to use OpenGL?

    What's wrong with you?

    Thanx !


Log in to reply