No mesh rendered when changing the platform.

  • Sorry, I am a newbie. I have a problem to render a certain mesh in Window 7/ATI Radeon HD 5700 Series.

    Previously, I can perfectly render it in Mac OS X/Intel Graphics HD 3000. Everything works fine. But after I change to Window 7/ATI Radeon HD 5700 Series, The viewport renders only the background (no mesh rendered). I use the same codes and same shaders, and ,also, already change the corresponding path.

    Opengl version : 3.2
    GLSL version : 1.5
    Qt : 5.1

    This is my own vertex shader :
    @#version 150

    in vec3 vertexPosition;
    in vec2 vertexTexCoord;
    in vec3 vertexNormal;

    out vec2 TexCoord;
    out vec3 Normal_eye;
    out vec4 vPos_to_lightPos_eye;
    out vec4 vPos_to_CamPos_eye;

    uniform mat4 ModelMatrix;
    uniform mat4 ViewMatrix;
    uniform mat4 ProjMatrix;
    uniform vec3 LightPos_0;

    void main()
    vec4 Position_model = vec4(vertexPosition, 1.0);
    vec4 Normal_model = vec4(vertexNormal, 1.0);
    vec4 lightPos = vec4(LightPos_0,1.0);

    vec4 vPos_eye = ViewMatrix * ModelMatrix * Position_model;
    vec4 lightPos_eye = ViewMatrix * lightPos;
    // Compute gl_NormalMatrix
    mat3 ModelMatrix3x3 = mat3(ModelMatrix);
    mat3 ViewMatrix3x3 = mat3(ViewMatrix);
    mat3 NormalMatrix = transpose(inverse(mat3(ViewMatrix) * mat3(ModelMatrix)));
    // Output
    Normal_eye = NormalMatrix *;
    vPos_to_lightPos_eye = lightPos_eye - vPos_eye;
    vPos_to_CamPos_eye = -vPos_eye;
    TexCoord = vertexTexCoord;
    gl_Position = ProjMatrix*ViewMatrix*ModelMatrix * Position_model;


    And this is fragment shader:
    @#version 150

    in vec3 Normal_eye;
    in vec2 TexCoord;
    in vec4 vPos_to_lightPos_eye;
    in vec4 vPos_to_CamPos_eye;

    out vec4 OutColor;

    uniform sampler2D sampler1;

    uniform vec4 LightColor_0; // Cl
    uniform vec4 AmbientColor; // Ca
    uniform vec4 SpecularColor; // Cp
    uniform float PhongExponent; // p

    void main()
    vec4 DiffuseColor = texture(sampler1,TexCoord); // Cr = Diffuse Reflectance

    vec3 normalized_Normal_eye = normalize(;
    vec3 normalized_vPos_to_lightPos_eye = normalize(;
    vec3 normalized_vPos_to_CamPos_eye = normalize(;
    vec3 h = normalize(normalized_vPos_to_lightPos_eye + normalized_vPos_to_CamPos_eye);
    float DiffuseTerm = max(0.0, dot(normalized_Normal_eye, normalized_vPos_to_lightPos_eye));
    float SpecularTerm = pow(max(0.0, dot(normalized_Normal_eye,h)),PhongExponent);
    OutColor = DiffuseColor*(AmbientColor + LightColor_0 * DiffuseTerm) + (LightColor_0 * SpecularColor * SpecularTerm);


    and this is the opengl context setup :
    @// Tell Qt we will use OpenGL for this window
    setSurfaceType( OpenGLSurface );

    // Specify the format we wish to use
    QSurfaceFormat format;
    format.setDepthBufferSize( 24 );
    //format.setOption( QSurfaceFormat::DebugContext );
    resize( 800,600 );
    setFormat( format );
    // Create an OpenGL context
    m_context = new QOpenGLContext;
    m_context->setFormat( format );
    m_context->makeCurrent( this );
    // Check OpenGL version
    qDebug("OpenGL Version = %s", glGetString(GL_VERSION));
    const char *version = (char*)glGetString(GL_VERSION);
    QString showVersion = QString("OpenGL Version : ") + version;
    this->setTitle("ARM GL >> " + showVersion);
    // Setup our scene
    m_scene->setContext( m_context );
    // Make sure we tell OpenGL about new window sizes
    connect( this, SIGNAL( widthChanged( int ) ), this, SLOT( resizeGL() ) );
    connect( this, SIGNAL( heightChanged( int ) ), this, SLOT( resizeGL() ) );
    // This timer drives the scene updates
    QTimer* timer = new QTimer( this );
    connect( timer, SIGNAL( timeout() ), this, SLOT( updateScene() ) );
    timer->start( 16 ); // 62.5 fps@

    I do not know if it is the graphics card issue or not. I have been searching for the solution on many forums and eventually, I could not fix it.

  • Lifetime Qt Champion


    IIRC, I saw another thread recently discussing ATI problems so it might be a bug/regression.

    I think you should post your question on the interest mailing list, you'll find Qt's developers/maintainers there (this forum is more user oriented) maybe also check the "bug report system": to see if someone already report this.

  • Sorry for posting it here and thanks for your advice.

  • Lifetime Qt Champion

    You're welcome !

    No need for excuses, it's still a good question to be posted :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.