Question

I have this code, I am using a test for my Engine I am working on.

On My NVIDIA NVS 4200M it displays the GL_TRIANGLE_STRIP as expected. On my ATI Radeon 5800 it appears to draw a Triangle.

shader.begin();

    Matrix4<float> temp = getActiveCamera()->getProjectionMatrix() * getActiveCamera()->getObjectToWorld().fastInverse();

    glUniformMatrix4fv(shader["mvp"], 1, GL_TRUE, temp.getArray());

    glBegin(GL_TRIANGLE_STRIP);

        glVertexAttrib3f(shader["colour"],0,1,0);
        glVertexAttrib3f(shader["coord3d"],-.5,-.5,0); 

        glVertexAttrib3f(shader["colour"],1,1,0);
        glVertexAttrib3f(shader["coord3d"],0.5,-.5,0);

        glVertexAttrib3f(shader["colour"],1,0,1);
        glVertexAttrib3f(shader["coord3d"],-.5,.5,0); 

        glVertexAttrib3f(shader["colour"],0,1,1);
        glVertexAttrib3f(shader["coord3d"],.5,.5,0);

    glEnd();

shader.end();

Here are what it actually looks like on my two computers.

https://www.dropbox.com/s/sgm2j978tx2ipnp/not%20working.png

https://www.dropbox.com/s/27idv0b8k0p4pcx/working.png

Was it helpful?

Solution

This issue can be fixed by moving to a higher GLSL version, I am now using 330, In addition I switched to using #version 330 making all my attributes "in" making my varying "out" and using layout(location = #).

OTHER TIPS

What are the values of your camera projection and model view matrices? If they are the standard ones (no changes from the initial) you should be looking down the -z axis in which case the seam of the two triangles should be from (.5, -.5) to (-.5, .5) (lower right to upper left). In the case of the ATI card this is not true (it is going from lower left to upper right). If you are actually looking at the back faces of the triangles then the OpenGL driver for the card might be culling the faces. If this is true I wouldn't expect it to draw anything, but you never know.

One test of this would be to call glDisable(GL_CULL_FACE) and see if it draws what you expect.

References on face culling: http://www.khronos.org/opengles/documentation/opengles1_0/html/glCullFace.html

Have fun,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top