[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] Issue with enable vertex attributes and re-binding VBOs



Hi List

This may be a very dumb question, but is it actually specifically stated anywhere that you must enable vertex attributes each time you bind to a buffer target?

I've found (empirically) that unless you re-enable all the vertex attributes each time you *re-use* a buffer, the following drawElements/drawArrays displays the data from the last VBO originally created. In other words, if you create VBO A, B and C and then redraw A, B or C, each time you redraw them you must go through the enableVertexAttribute stuff, even if the bindings are unchanged. If you don't when you re-draw A or B you get the data from C.

What happened was the the first time I drew a scene everything was fine, but as soon as it was redrawn (e.g. camera move) all the rendered objects changed to the geometry of the last object originally created. I've fixed it by now specifically enabling vertex attributes as required (and then disabling them again). My inspiration in this was the San Angeles demo which appears to work this way.

I have no idea whether this is GL ES 2.0 behavior - I have found nothing in either the spec or the man pages to indicate that the above would happen. There's an example in the GL3.0/3.1 Programmer's guide which only enables the vertex attributes once, but of course, that's not GL ES 2/WebGL.


Regards

Alan




----------------------------------------------------------- You are currently subscribed to public_webgl@khronos.org. To unsubscribe, send an email to majordomo@khronos.org with the following command in the body of your email: