Vertexbuffer not working an amd graphics (hd 5400)

Hello everyone,

Im working at some game quite a time now, and everything is working perfect so far (maybe an wip soon).

However when i try the game on a pc with a hd5400 graphics card (drivers are up to date), all vbo draws simply dont draw anything.
I have rewritten stuff several times, without any progress, while it always works perfectly on my nvidia card.
Im getting kinda deperate now, does anyone have an clue what im doing wrong?

Code to draw the buffers:


    public void InitDrawing(){
        glBindBuffer(GL_ARRAY_BUFFER, pointbufferid);
        if(updatepointbuffer){ 
            glBufferData(GL_ARRAY_BUFFER, pointbufferdata, type); 
            updatepointbuffer = false;
        }
        
        glEnableClientState(GL_VERTEX_ARRAY);
        glVertexPointer(3, GL_FLOAT, stride, 0);
        int pointerloc = 12;
        for(int i = 0; i < attribs.size(); i++){ 
            pointerloc = attribs.get(i).Enable(stride, pointerloc);
        }
        
        
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexbufferid);
        if(updateindexbuffer){ 
            FillTriangleData();
            glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexbuferdata, type); 
            updateindexbuffer = false;
        }
    }
    
    public void Draw(){       
        InitDrawing();

        glDrawElements(GL_TRIANGLES, indexsize, GL_UNSIGNED_INT, 0);
        
        FinishDrawing();
    }
    
    public void DrawPartial(int start, int count){
        glDrawElements(GL_TRIANGLES, count*3, GL_UNSIGNED_INT, start*3);
    }
    
    public void FinishDrawing(){
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
        glBindBuffer(GL_ARRAY_BUFFER, 0);
        
        glDisableClientState(GL_VERTEX_ARRAY);
        
        for(int i = 0; i < attribs.size(); i++){ 
            attribs.get(i).Disable();
        }
    }

The attribs beinig bound:


    public int Enable(int stride, int pointerloc){
        glEnableVertexAttribArray(loc);
        glVertexAttribPointer(loc, amount, type, false, stride, pointerloc);
        
        return pointerloc + getSize();
    }

Any help / comments is welcome.
Thanks in advance.

Hi

Are you sure you need to call glVertexPointer? I would just use a VAO for that like here:
http://www.swiftless.com/tutorials/opengl4/4-opengl-4-vao.html

I’m sorry to say that some OpenGL drivers have “unexpected behaviour” (they aren’t bugs since they don’t violate the OpenGL specification) which can sometimes cause very annoying results. For example, one old NVidia graphics card I have requires me to have a shader in use before I can update any uniform variables.

I expect you’ve already done a thorough Google search but I think that’s the way to go. Please bear in mind that in may not be the HD 5400 but rather the NVidia which has the problem ie it allows you to do something that other’s don’t. In fact, this may be completely wrong but I think NVidia tends to have more of these "unexpected behaviour"s than other cards. That may be complete slander but I think.

@Gouessej Yes that’s what you would do, but he is not using VAOs.

He uses vertex attributes, you can see that he calls glEnableVertexAttribArray and glVertexAttribPointer. He should call glGetAttribLocation instead of assuming that the next location is pointerloc + getSize(). Moreover, glVertexAttribPointer should be enough, glVertexPointer is not required even without VAOs. I advise you to look at JMonkeyEngine 3 renderers, especially the one based on LWJGL:
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglRenderer.java?r=8283#2191

@Gouessej: Actually, now you mention it I think that is the problem. I just skimmed that bit.

@RobinB: glEnableVertexAttribArray() http://www.opengl.org/sdk/docs/man2/xhtml/glEnableVertexAttribArray.xml takes the index of the attribute not its location in memory. You bind an attribute to an index with glBindAttribLocation() http://www.opengl.org/sdk/docs/man2/xhtml/glBindAttribLocation.xml. Maybe your code is fine, but from the look of it I very much doubt it.

@Gouessej: It is perfectly okay to use both generic vertex attribs and the old fixed function vertex position attribute together.

Maybe it’s in the gray zone, you know, the kind of thing that should be supported but sometimes it’s not.

Thanks for the comments.

Thank you very much i removed glVertexPointer now :), didnt know i could replace it.

Maybe my code causes some confusion.
Written out it does this:


bindShader(shader);
//Get atribute location (inside the shader)
int loc = glGetAttribLocation(shader, name);

//Enable attribute
glEnableVertexAttribArray(loc);

//Bind attribute to pointer
//amount = number of variables
//type = GL_FLOAT and others
//stride is total size of attributes.
glVertexAttribPointer(loc, amount, type, false, stride, pointerloc);

Is this right, or am i understanding this wrongly?