[Interest] Qt5.5 Qt3D Demos: QOpenGLShader::compile(Vertex): ERROR: 2:1: '' : syntax error: #version is mandatory and should be set before any other token

privet56 hotmail.com privet56 at hotmail.com
Tue Jul 28 15:45:33 CEST 2015


Hi,

The "normal" Qt Demos of Qt 5.5 are working fine when opening + building with QtCreator 3.4.2
but
None of the Qt3D Demos are working; they fail with the below error output
( see also screenshot: http://privet.bplaced.net/temp/qt55_qt3d_examples.png )
What is wrong?
How can I fix this?

-------------------------------------------------------------------------
Starte C:\Qt\5.5\Src\qt3d\build-examples-5_5_desktop_64bit_vs2013-Release\qt3d\anaglyph-rendering\release\anaglyph-rendering.exe...
QOpenGLShader::compile(Vertex): ERROR: 2:1: '' : syntax error: #version is mandatory and should be set before any other token


*** Problematic Vertex shader source code ***
#define lowp
#define mediump
#define highp
#line 1
attribute vec3 vertexPosition;
varying vec3 texCoord0;

uniform mat4 mvp;
uniform mat4 inverseProjectionMatrix;
uniform mat4 inverseModelView;

void main()
{
    texCoord0 = vertexPosition.xyz;
    gl_Position = vec4(mvp * vec4(vertexPosition, 1.0)).xyww;
}

***
Failed to compile shader: "ERROR: 2:1: '' : syntax error: #version is mandatory and should be set before any other token\n\n"
QOpenGLShader::compile(Fragment): ERROR: 2:1: '' : syntax error: #version is mandatory and should be set before any other token


*** Problematic Fragment shader source code ***
#define lowp
#define mediump
#define highp
#line 1
varying highp vec3 texCoord0;
uniform samplerCube skyboxTexture;

void main()
{
    gl_FragColor = textureCube(skyboxTexture, texCoord0);
}


***
Failed to compile shader: "ERROR: 2:1: '' : syntax error: #version is mandatory and should be set before any other token\n\n"
QOpenGLShader::link: "Link called without any attached shader objects.\n"
Failed to link shader program: "Link called without any attached shader objects.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::compile(Vertex): ERROR: 2:1: '' : syntax error: #version is mandatory and should be set before any other token


*** Problematic Vertex shader source code ***
#define lowp
#define mediump
#define highp
#line 1
attribute vec3 vertexPosition;
attribute vec3 vertexNormal;

varying vec3 position;
varying vec3 normal;

uniform mat4 modelView;
uniform mat3 modelViewNormal;
uniform mat4 mvp;

void main()
{
    normal = normalize( modelViewNormal * vertexNormal );
    position = vec3( modelView * vec4( vertexPosition, 1.0 ) );

    gl_Position = mvp * vec4( vertexPosition, 1.0 );
}

***
Failed to compile shader: "ERROR: 2:1: '' : syntax error: #version is mandatory and should be set before any other token\n\n"
QOpenGLShader::compile(Fragment): ERROR: 2:3: '' : syntax error: #version is mandatory and should be set before any other token


*** Problematic Fragment shader source code ***
#define lowp
#define mediump
#define highp
#line 1
#define FP highp

uniform FP vec4 lightPosition;
uniform FP vec3 lightIntensity;

// TODO: Replace with a struct
uniform FP vec3 ka;            // Ambient reflectivity
uniform FP vec3 kd;            // Diffuse reflectivity
uniform FP vec3 ks;            // Specular reflectivity
uniform FP float shininess;    // Specular shininess factor

varying FP vec3 position;
varying FP vec3 normal;

FP vec3 adsModel( const FP vec3 pos, const FP vec3 n )
{
    // Calculate the vector from the light to the fragment
    FP vec3 s = normalize( vec3( lightPosition ) - pos );

    // Calculate the vector from the fragment to the eye position
    // (origin since this is in "eye" or "camera" space)
    FP vec3 v = normalize( -pos );

    // Reflect the light beam using the normal at this fragment
    FP vec3 r = reflect( -s, n );

    // Calculate the diffuse component
    FP float diffuse = max( dot( s, n ), 0.0 );

    // Calculate the specular component
    FP float specular = 0.0;
    if ( dot( s, n ) > 0.0 )
        specular = pow( max( dot( r, v ), 0.0 ), shininess );

    // Combine the ambient, diffuse and specular contributions
    return lightIntensity * ( ka + kd * diffuse + ks * specular );
}

void main()
{
    gl_FragColor = vec4( adsModel( position, normalize( normal ) ), 1.0 );
}

***
Failed to compile shader: "ERROR: 2:3: '' : syntax error: #version is mandatory and should be set before any other token\n\n"
QOpenGLShader::link: "Link called without any attached shader objects.\n"
Failed to link shader program: "Link called without any attached shader objects.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"
QOpenGLShader::link: "ERROR: Definition for \"void main()\" not found.\n"

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150728/6b49a6a7/attachment.html>


More information about the Interest mailing list