0

i am trying to get myself familiar with opengl programming. I cant stop wondering when should i use layout for variable input to a shader (with glVertexAttribPointer) vs just setting an uniform with glUniform. What are the advantage and when should i use one over the other? kind regards

pccash
  • 11
  • 2

1 Answers1

2

It depends what you want to do with the value. If you want to pass in a single value to the shader, which won't change for each vertex, then you use a uniform. If you want to pass in multiple values so each vertex can have a different value, then you use an attribute pointer.

Sean Burton
  • 907
  • 7
  • 15