Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. No mesh rendered when changing the platform.

No mesh rendered when changing the platform.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hesheit
    wrote on last edited by
    #1

    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 * Normal_model.xyz;
    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(Normal_eye.xyz);
    vec3 normalized_vPos_to_lightPos_eye = normalize(vPos_to_lightPos_eye.xyz);
    vec3 normalized_vPos_to_CamPos_eye = normalize(vPos_to_CamPos_eye.xyz);
    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.setMajorVersion(3);
    format.setMinorVersion(2);
    format.setSamples(16);
    format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
    format.setProfile(QSurfaceFormat::CoreProfile);
    //format.setOption( QSurfaceFormat::DebugContext );
    
    resize( 800,600 );
    setFormat( format );
    create();
    
    // Create an OpenGL context
    m_context = new QOpenGLContext;
    m_context->setFormat( format );
    m_context->create();
    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 );
    initializeGL();
    
    // 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() ) );
    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      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":http://bugreports.qt-project.org/issues to see if someone already report this.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hesheit
        wrote on last edited by
        #3

        Sorry for posting it here and thanks for your advice.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're welcome !

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved