0

I have an application displaying some 3D rendering. I encounter some graphical problems with VBO, when integrating my application on different user's laptops. Vertex Buffer Object work perfectly fine in out development stations

First laptop embeds a AMD Radeon HD 6470M -> OpenGL 4.1

On this laptop, I've got some : old fashion way opengl code, working fine. vbo implemented : No data of the VBO is displayed

Here the code responsible of the drawing of my VBO :

    // Compute this on the client side to attempt compute it for each vertex
    Matrix4 modelview = view * model;

    // Links matrix values to entry shader matrices for the specified shader
    glUniformMatrix4fv(glGetUniformLocation(shaderID, "projection"), 1, GL_TRUE, projection.getValues());
    glUniformMatrix4fv(glGetUniformLocation(shaderID, "modelview"), 1, GL_TRUE, modelview.getValues());
    GLfloat color[4] = {material_->getDiffuse()[0], material_->getDiffuse()[1], material_->getDiffuse()[2], lgc3d::alphaFromSelection(selected)};
    glUniform4fv(glGetUniformLocation(shaderID, "color"), 1, color);


    // Get the positions in the shader for data
    glEnableVertexAttribArray(VPos_index);
    glEnableVertexAttribArray(VNor_index);
    glEnableVertexAttribArray(VTex_index);

    // Bind the buffers we want access
    glBindBuffer(GL_ARRAY_BUFFER, VBO_index_vertices);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, VBO_index_indices3);
    glBindTexture(GL_TEXTURE_2D, material_->getTexture().getID());
    {
        // Precise how the data have to be read by OpenGL (defining offset), for triangles
        glVertexAttribPointer(VPos_index, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), BUFFER_OFFSET(0));
        glVertexAttribPointer(VNor_index, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), BUFFER_OFFSET(offsetof(Vertex, normals)));
        glVertexAttribPointer(VTex_index, 2, GL_FLOAT, GL_TRUE, sizeof(Vertex), BUFFER_OFFSET(offsetof(Vertex, textcoords)));
        glDrawElements(GL_TRIANGLES, nb_tri_ * 3, GL_UNSIGNED_INT, 0);
    }

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, VBO_index_indices4);
    {
        // Precise how the data have to be read by OpenGL (defining offset), for quads
        glVertexAttribPointer(VPos_index, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), BUFFER_OFFSET(0));
        glVertexAttribPointer(VNor_index, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), BUFFER_OFFSET(offsetof(Vertex, normals)));
        glVertexAttribPointer(VTex_index, 2, GL_FLOAT, GL_TRUE, sizeof(Vertex), BUFFER_OFFSET(offsetof(Vertex, textcoords)));
        glDrawElements(GL_QUADS, nb_qua_ * 4, GL_UNSIGNED_INT, 0);
    }

    // Unbind everything
    glDisableVertexAttribArray(VPos_index);
    glDisableVertexAttribArray(VNor_index);
    glDisableVertexAttribArray(VTex_index);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    glBindTexture(GL_TEXTURE_2D, 0);

Do I use any too recent function ? I really don't have this feeling.

The non-VBO objects are displayed perfectly:

    {
    // defines an array of generic vertex attribute data, of index 0
    glEnableVertexAttribArray(0);

        // Get eye position
        Vector3D eyev(cam->getEyePosition());
        float eyet[3] = {(float)eyev.X, (float)eyev.Y, (float)eyev.Z};

        // Specify data location for OpenGL
        glVertexAttribPointer(0, 3, GL_DOUBLE, GL_FALSE, 0, vertices_);

        // Links matrix values to entry shader matrices for the specified shader
        glUniformMatrix4fv(glGetUniformLocation(shaderID, "projection"), 1, GL_TRUE, projection.getValues());
        glUniformMatrix4fv(glGetUniformLocation(shaderID, "modelview"), 1, GL_TRUE, modelview.getValues());
        glUniform3fv(glGetUniformLocation(shaderID, "cameraEye"), 1, eyet);

        glLineWidth(1);

        // Order OpenGL to draw
        glDrawArrays(GL_LINES, 0, nb_coord_ / 3);

    // Inactivates the generic vertex attribute data of index 0
    glDisableVertexAttribArray(0);
}

Second laptop embeds a Intel Graphic 3000 -> OpenGL 3.0

Here, if I only drop the mouse over the OpenGL canevas, it crashes. Nothing is never displayed... even the background clearing color.

I spent attention do not to use deprecated functions and I really thought that everything would be compatible with a huge bunch a computers/laptops. Does anyone have any idea ?

Everything is displayed in a QGLWidget, with Qt5.8. Problems happens on 64bits platforms, tested on Windows 7 Professional.

Quentin Tealrod
  • 309
  • 3
  • 14
  • 1
    "*I really thought that everything would be compatible with a huge bunch a computers/laptops.*" Yeah, driver quality for anything that doesn't support at least GL 3.3 is almost certainly going to be terrible. – Nicol Bolas Jul 14 '17 at 13:48
  • older **Intel HD graphics** cards are not very good with opengl above 1.0 ... however **VBO** usually works unless some more advanced stuff is used. You can fully forget about **FBO** they do not work at all for example try to render to texture (without GPU->CPU->GPU memory transfers like `glReadPixels`)...Multiple contexts is also buggy beond usability. I stop supporting Intel long time ago (they will never fix their drivers either so what is the point) and using just simplified **GL1 .0** rendering for those recommend you to do the same will save you from a lot of headaches and time wasted – Spektre Jul 14 '17 at 15:59
  • Which context version do you ask for before any gl-command is used? – Ripi2 Jul 14 '17 at 16:22

0 Answers0