PDA

View Full Version : VBO question



gaoyakun
08-25-2003, 03:40 PM
Hi all.

VBO extension spec says it is possible to use separated bindings for individual vertex attribute, right? I'v tried this in my project but it didn't work.
I do it like this:

Bind buffer 1;
glVertexArray (...);
Bind buffer 2;
glNormalArray (...);
... ...
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glDrawArrays (...)

if I use one binding for all attribute, it works fine. where is the problem?

satan
08-25-2003, 05:00 PM
The arrays must be enabled before writing to them. Therefor you have to place your glEnableClientState calls before assigning the arrays.

hih

(edit: had to take a closer look at the question before posting)

[This message has been edited by satan (edited 08-25-2003).]

gaoyakun
08-25-2003, 06:45 PM
It works now! Thank'u and I'll never cross post anymore!

secnuop
08-25-2003, 07:23 PM
"The arrays must be enabled before writing to them. Therefor you have to place your glEnableClientState calls before assigning the arrays."

Where does it say this in the VBO spec? This doesn't sound correct to me. In fact, it even runs contrary to the examples listed at the end of the vertex buffer object spec.

If it solved your problem, great, but I'd suspect that something else was going on...

al_bob
08-25-2003, 09:32 PM
Looks like a driver bug to me. You didn't mention your hw/driver did you?

satan
08-26-2003, 02:32 AM
Originally posted by secnuop:
"The arrays must be enabled before writing to them. Therefor you have to place your glEnableClientState calls before assigning the arrays."

Where does it say this in the VBO spec? This doesn't sound correct to me. In fact, it even runs contrary to the examples listed at the end of the vertex buffer object spec.

If it solved your problem, great, but I'd suspect that something else was going on...

It does not say this in the VBO specs but if you take a look at the glEnableClientState reference you will find for example: GL_VERTEX_ARRAY
If enabled, the vertex array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glVertexPointer.

Therefor I assumed that it is needed for VBO, too.

As you said this contradicts with the examples shown in the VBO specs so I am not sure what the correct behaviour for an OpenGL implementation should be.

You and the exmaples are right secnoup. I just tested it and it works flawlessly without enabling the clientstate before assigning the arrays. I did this on a Geforce2MX with the 4496 driver under Linux.

[This message has been edited by satan (edited 08-26-2003).]