VBO initialization order wrt VAO

Greetings OpenGL Gurus,

I’m running into an order of initialization problem of VBOs in VAOs that I thought I had sorted. I was under the impression that you could initialize and upload data to a VBO with the VAO unbounded - something like this:

[b]
// setup vb0 1
gen vbo 1
bind vbo 1
buffer data 1
unbind vbo 1

// setup vbo 2
gen vbo 2
bind vbo 2
buffer data 2
unbind vbo 2[/b]

… and then…:

[b]gen vao 1
bind vao 1

bind vbo 1
vertexAttribPointer index 0
enableVertexAttribArray index 0

bind vb0 2
vertexAttribPointer index 1
enableVertexAttribArray index 1

unbind vao 1[/b]

However when I do this and then subsequently go to draw. I can’t seem to access the data for the second VBO from the shader. I would normally use gDebugger to take a look at what’s going on - but I’m writing a plug-in for Maya so I can’t easily look at it.

But things work correctly when I change things around and have this:

[b]gen vao 1
bind vao 1

// setup vbo 1 (w/o the unbind at the end)
bind vb0 1
vertexAttribPointer index 0
enableVertexAttribArray index 0

// setup vbo 2 (w/o the unbind at the end)
bind vb0 2
vertexAttribPointer index 1
enableVertexAttribArray index 1

unbind vao 1[/b]

The annoying thing is that I had a similar scenario running an Geforce 570 on Windows and everything worked fine. When I switched to Linux I had to reorder the setup.

I feel like I’m definitely missing something here - and was wondering if someone could point me in the right direction.

Thanks.

So it looks like the culprit was an outdated .o file buried somewhere in the build system. A full clean and rebuild fixes everything. Boy do I feel dumb.

However - for anyone that is interested. The order of initialization seems to not matter for the most part. I did several more experiments after things got back in working order and I was able to initialize the VBO before and after the VAO was generated and bound/unbound.

Thanks for the views.