Im confused about interaction of this two extensions. Problem is in custom vertex attributes…
When setup some VBO I also setup standard vertex attribute pointers (pos, norm, color, texcoord).
In render stage, I bind some VBO and all pointers for this VBO are already prepared (no need to setup pointers again).
But, whats happend with custom vertex attributes in GLSL? For example I have several GLSL vert&frag programs for static geometry. Should I setup this custom vertex attribute pointers for each shader? Is this pointers safe from VBO switching?
But, whats happend with custom vertex attributes in GLSL? For example I have several GLSL vert&frag programs for static geometry. Should I setup this custom vertex attribute pointers for each shader? Is this pointers safe from VBO switching?
Not sure I understand you.
In each shader, you have something like myvertex and mynormal and mytexcoord right?
You need to bind them with the generic attributes (for each shader of course).
Im confused about interaction of this two extensions. Problem is in custom vertex attributes…
When setup some VBO I also setup standard vertex attribute pointers (pos, norm, color, texcoord).
In render stage, I bind some VBO and all pointers for this VBO are already prepared (no need to setup pointers again).
But, whats happend with custom vertex attributes in GLSL? For example I have several GLSL vert&frag programs for static geometry. Should I setup this custom vertex attribute pointers for each shader? Is this pointers safe from VBO switching?
yooyo
ps… soory for by bad english…[/b]
What you seem to imply is that *Pointer calls and BindBuffer calls are unrelated.
They are not. The *Pointer calls capture the array buffer currently bound.
So if you do
BindBuffer(ARRAY_BUFFER, 1)
VertexPointer(…)
BindBuffer(ARRAY_BUFFER, 2)
DrawArrays(…)
your vertices will come from the vertex buffer 1, not 2. That is true for built in attribute as much as for generic ones.
If I understand your question correctly, you are wondering whether after calling UseProgramObject, you need to emit AttribPointer calls again. You do not need to. These are totally separated from the program.
Thinking more about it, I guess your question might be related to the fact that each program potentially maps a generic attribute to a different location.
You can force the mapping to one that you want (so that your generic attributes never move between programs) through BindAttribLocation before the link happened on the program. Hope this helps.
I think that the gl*Pointer semantics do current hardware more justice than the DirectX-style vertex declarations. Hardware typically has a set of DMA streams to fetch from.
I personally haven’t measured any difference between interleaved and non-interleaved arrays, however this dates back to the times of GF2-GF4.