1 Replies - 1428 Views - Last Post: 15 December 2013 - 09:24 AM Rate Topic: -----

#1 dreaminxna   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 71
  • Joined: 10-June 13

When to use Uniform and Attribute in GLSL?

Posted 14 December 2013 - 03:40 PM

Until now i am not sure when to use Uniform and Attribute.

Whats the difference between this two? If I just Uniform is it Okay?
Is This A Good Question/Topic? 0
  • +

Replies To: When to use Uniform and Attribute in GLSL?

#2 stayscrisp   User is offline

  • フカユ
  • member icon

Reputation: 1040
  • View blog
  • Posts: 4,325
  • Joined: 14-February 08

Re: When to use Uniform and Attribute in GLSL?

Posted 15 December 2013 - 09:24 AM

There are lots of great descriptions of the difference between Uniform and Attribute variables online. Here's a good description that found


The difference between attribute and uniform variable is that attribute variables contain data which is vertex specific so they are reloaded with a new value from the vertex buffer for each shader invocation while the value of uniform variables remains constant across the entire draw call. This means that you load the value before making the draw call and then you can access the same value in each invocation of the vertex shader. Uniform variables are useful for storing data such as lighting parameters (light position and direction, etc), transformation matrices, texture objects handles and so on.

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1