David Torrey
David Torrey

Reputation: 1342

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?

Upvotes: 4

Views: 2439

Answers (1)

Bartek Banachewicz
Bartek Banachewicz

Reputation: 39370

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.

Upvotes: 4

Related Questions