Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

glVertexAttrib vs glVertexAttribPointer

I'm reading through and trying to learn shaders, but I suddenly got confused with passing information into the shader.

What is the difference between glVertexAttrib and glVertexAttribPointer? Are there different times to use them? Are they just two different ways to do the same thing? Does one provide better or worse performance?

like image 562
David Torrey Avatar asked Oct 19 '25 09:10

David Torrey


1 Answers

glVertexAttrib sets the value of an attribute for a given set of vertices.

glVertexAttribPointer sets the location of the attribute for every vertex.

So essentially these two are different functions, and you can't compare them in terms of speed. Anyway, setting the attribute pointer isn't the bottleneck in most rendering appliances.

like image 163
Bartek Banachewicz Avatar answered Oct 22 '25 05:10

Bartek Banachewicz